- 🇳🇿New Zealand quietone
📌 Fix 'Drupal.Commenting.TodoComment' coding standard Needs work was committed.
You can check the current state of coding standards compliance using phpcs and coder from the command line:
$ cd /path/to/drupal/root/
$ composer install
$ ./vendor/bin/phpcs -p -s --standard=./vendor/drupal/coder/coder_sniffer/Drupal core/
Numbers are the errors or warnings found and the number of files. phpcs was run on 10.0 on 2022-09-29 to get the numbers.
This is a followup of #1518116: [meta] Make Core pass Coder Review → which was the original initiative from 2012 to fix coding standards in core. This new issue was made to replace the old one because the suggested workflow changed from a module-per-module approach to a sniff-per-sniff approach. The old issue has a large number of linked issues which are now obsolete.
Note that no coding standards fixes will be committed until the beta phase ends. Only when the first release candidate is released these issues will be eligible for committing.
Drupal Core fails our automated coding standards tests.
It would be impossible to fix all coding standards at once. We will split up the work in manageable chunks. In a previous effort ( #1518116: [meta] Make Core pass Coder Review → ) we split up the work per module, but this proved to be less than ideal since it requires intimate knowledge of ALL coding standards for everyone involved in the issue: developers as well as reviewers.
Instead we will now split up the work per type of coding standard. For example in separate issues we'll deal with trailing whitespace, inline comments, line lengths, etc. This will be much easier to review, since every patch will only contain very similar fixes.
In addition to fixing the coding standards, we'll also add automatic coding standards checking to the DrupalCI test bot. Once a particular coding standard is fixed, all new patches will be automatically checked and will fail if they do not meet this standard. This way we can progressively fix all coding standards, and ensure that what is once fixed will remain fixed.
An XML file (phpcs.xml.dist) was added to core to list all coding standards currently passing and it is used by the automated coding standards check. Whenever a particular standard is fixed we will add that sniff to phpcs.xml.dist or remove the exception from it, so it will be automatically checked from that point onwards.
Eventually phpcs.xml.dist would contain all sniffs defined in Drupal CS along with their configuration from ruleset.xml. All the sniffs defined in other CS and referenced in ruleset.xml should also be present in phpcs.xml.dist.
If rulesest.xml is modified or new sniffs are defined in Drupal CS, phpcs.xml.dist should also be modified.
Work is done in the child issues on a per-sniff basis. We can conserve resources by not running all the tests on these patches, until it is ready for RTBC. This is done by modifying the drupalci.yml file. There is an example → in #3048495#comment-19 📌 Fix Drupal.Semantics.FunctionTriggerError coding standard Downport . That file also removes all the other sniffs from the phpcs.xml file and only adds the sniff being tested there.
This list contains all sniffs for which we don't have an issue yet:
Active
10.1 ✨
It involves compliance with, or the content of coding standards. Requires broad community agreement.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
📌 Fix 'Drupal.Commenting.TodoComment' coding standard Needs work was committed.