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:

  1.     <exclude name="Drupal.Commenting.ClassComment.Missing"/>
    
  2.   <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

Command icon 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

xjm created an issue. See original summary.

xjm’s picture

Issue summary: View changes

Added a core followup.

xjm’s picture

Issue summary: View changes
smustgrave’s picture

Came 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?

klausi’s picture

I'm open to pull requests at https://github.com/pfrenssen/coder if you want to unify this.

klausi’s picture

Version: 8.x-2.x-dev » 8.3.x-dev

  • klausi committed b4b253d7 on 9.x
    refactor(ruleset): Replace serverity syntax with exclude syntax (#...
klausi’s picture

Version: 8.3.x-dev » 9.x-dev
Status: Active » Fixed

Created merge request with Github Copilot AI, prompt was "convert all 0 settings to the exclude name= format for consistency".

Merged into 9.x.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • klausi committed 755dfb5c on 9.x
    refactor(ruleset): Replace serverity syntax with exclude syntax for...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.