Problem/Motivation
Drupal.Commenting.FunctionComment.MissingReturnComment is not enable for all of core yet.
Approach
We are testing coding standards with PHP CodeSniffer, using the Drupal coding standards from the Coder module. We need to do a couple of steps in order to download and configure them so we can run a coding standards check.
Step 1: Add the coding standard
Every coding standard is identified by a "sniff". For example, an imaginary coding standard that would require all llamas to be placed inside a square bracket fence would be called the "Drupal.AnimalControlStructure.BracketedFence
sniff".
Open the file core/phpcs.xml.dist
and add a line for the sniff of this ticket. The sniff name is in the issue title. Make sure your patch will include the addition of this line.
Step 2: Install PHP CodeSniffer and the ruleset from the Coder module
$ composer install
Once you have installed the phpcs package, you can list all the sniffs available to you like this:
$ ./vendor/bin/phpcs --standard=Drupal -e
This will give you a list of sniffs, and the Drupal-based ones should be present.
Step 3: Prepare the phpcs.xml file
Add <include-pattern>core/tests/*</include-pattern>
to the Drupal.Commenting.FunctionComment.MissingReturnComment rule.
Step 4: Run the test
Now you are ready to run the test! From within the core/
folder, run the following command to launch the test:
$ composer phpcs
Step 5: Fix the failures
When the test is complete it will present you a list of all the files that contain violations of your sniff, and the line numbers where the violations occur.
Steps to reproduce
Proposed resolution
Enable sniff for the directory core/tests,
Remaining tasks
Follow the 'Approach' above to fix the failures
Review
Commit
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet