File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -594,12 +594,23 @@ public function processRuleset($rulesetPath, $depth=0)
594
594
echo "\t\tExcluding rule \"" .$ exclude ['name ' ].'" ' .PHP_EOL ;
595
595
}
596
596
597
- $ excludedSniffs = array_merge (
598
- $ excludedSniffs ,
599
- $ this ->_expandRulesetReference ($ exclude ['name ' ], $ rulesetDir , ($ depth + 1 ))
600
- );
601
- }
602
- }
597
+ // Check if a single code is being excluded, which is a shortcut
598
+ // for setting the severity of the message to 0.
599
+ $ parts = explode ('. ' , $ exclude ['name ' ]);
600
+ if (count ($ parts ) === 4 ) {
601
+ $ this ->ruleset [(string ) $ exclude ['name ' ]]['severity ' ] = 0 ;
602
+ if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
603
+ echo str_repeat ("\t" , $ depth );
604
+ echo "\t\t=> severity set to 0 " .PHP_EOL ;
605
+ }
606
+ } else {
607
+ $ excludedSniffs = array_merge (
608
+ $ excludedSniffs ,
609
+ $ this ->_expandRulesetReference ($ exclude ['name ' ], $ rulesetDir , ($ depth + 1 ))
610
+ );
611
+ }
612
+ }//end foreach
613
+ }//end if
603
614
604
615
$ this ->_processRule ($ rule , $ depth );
605
616
}//end foreach
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
32
32
- PSR2 standard now ignores comments when checking indentation rules
33
33
- Generic UpperCaseConstantNameSniff no longer reports errors where constants are used (request #20090)
34
34
-- It still reports errors where constants are defined
35
+ - Individual messages can now be excluded in ruleset.xml files using the exclude tag (request #20091)
36
+ -- Setting message severity to 0 continues to be supported
35
37
- Fixed bug #20093 : Bug with ternary operator token
36
38
- Fixed bug #20097 : CLI.php throws error in php 5.2
37
39
- Fixed bug #20100 : incorrect Function mysql() has been deprecated report
You can’t perform that action at this time.
0 commit comments