Problem/Motivation
Coming from #2901739: Fix 'Squiz.Arrays.ArrayDeclaration' coding standard. We have two different ways of excluding sub-rules in core's phpcs.xml.dist:
-
<exclude name="Drupal.Commenting.ClassComment.Missing"/> -
<rule ref="PEAR.Files.IncludingFile.UseIncludeOnce"> <severity>0</severity> </rule>
We want core's phpcs.xml.dist to match the Drupal standard.
Proposed resolution
Prefer the "exclude" format, since it is less verbose and more readable. According to @mfernea there is not a difference between the two for our usecase.
Reference: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
Update the ruleset to that end: http://cgit.drupalcode.org/coder/tree/coder_sniffer/Drupal/ruleset.xml
Remaining tasks
Once we've updated the coder standards, update core's phpcs.xml.dist to match: #2909268: Prefer "exclude" format over "severity 0" format in ruleset for readability once coder does
mfernea should receive credit for this issue.
Issue fork coder-2909267
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
xjmAdded a core followup.
Comment #3
xjmComment #4
smustgrave commentedCame here from #2909268: Prefer "exclude" format over "severity 0" format in ruleset for readability once coder does and see there are still 41 instances in cores phpcs.xml, is this something still worth pursuing?
Comment #5
klausiI'm open to pull requests at https://github.com/pfrenssen/coder if you want to unify this.
Comment #6
klausiComment #9
klausiCreated merge request with Github Copilot AI, prompt was "convert all 0 settings to the exclude name= format for consistency".
Merged into 9.x.