Skip to content

Commit f2cea38

Browse files
committed
Fixed a problem where referencing a relative file path in a ruleset XML file could add unnecessary sniff exclusions
1 parent d03b941 commit f2cea38

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
3434
- The Squiz standard now ensures underscores are not used to indicate visibility of private members vars and methods
3535
-- Previously, this standard enforced the use of underscores
3636
- Squiz.Commenting.FunctionComment no longer errors when trying to fix indents of multi-line param comments
37+
- Fixed a problem where referencing a relative file path in a ruleset XML file could add unnecessary sniff exclusions
38+
-- This didn't actually exclude anything, but caused verbose output to list strange exclusion rules
3739
- Fixed bug #2110 : Squiz.WhiteSpace.FunctionSpacing is removing indents from the start of functions when fixing
3840
-- Thanks to Juliette Reinders Folmer for the patch
3941
- Fixed bug #2115 : Squiz.Commenting.VariableComment not checking var types when the @var line contains a comment

src/Ruleset.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,11 @@ public function processRuleset($rulesetPath, $depth=0)
390390
$includedSniffs = array_merge($includedSniffs, $expandedSniffs);
391391

392392
$parts = explode('.', $rule['ref']);
393-
if (count($parts) === 4) {
393+
if (count($parts) === 4
394+
&& $parts[0] !== ''
395+
&& $parts[1] !== ''
396+
&& $parts[2] !== ''
397+
) {
394398
$sniffCode = $parts[0].'.'.$parts[1].'.'.$parts[2];
395399
if (isset($this->ruleset[$sniffCode]['severity']) === true
396400
&& $this->ruleset[$sniffCode]['severity'] === 0

0 commit comments

Comments
 (0)