Permalink
Browse files

Fixed bug #19114 : CodeSniffer checks extension even for single file

  • Loading branch information...
gsherwood committed Dec 12, 2011
1 parent 70ed164 commit 38c4e5f900bc03deecc077cfbe5caf1f6886cfee
Showing with 25 additions and 26 deletions.
  1. +22 −4 CodeSniffer.php
  2. +3 −22 package.xml
View
@@ -1019,7 +1019,7 @@ public function getFilesToProcess($paths, $local=false)
$files[] = $file->getPathname();
}//end foreach
} else {
- if ($this->shouldProcessFile($path) === false) {
+ if ($this->shouldIgnoreFile($path) === true) {
continue;
}
@@ -1067,6 +1067,24 @@ public function shouldProcessFile($path)
}
// If the file's path matches one of our ignore patterns, skip it.
+ if ($this->shouldIgnoreFile($path) === true) {
+ return false;
+ }
+
+ return true;
+
+ }//end shouldProcessFile()
+
+
+ /**
+ * Checks filtering rules to see if a file should be ignored.
+ *
+ * @param string $path The path to the file being checked.
+ *
+ * @return bool
+ */
+ public function shouldIgnoreFile($path)
+ {
foreach ($this->ignorePatterns as $pattern) {
if (is_array($pattern) === true) {
// A sniff specific ignore pattern.
@@ -1080,13 +1098,13 @@ public function shouldProcessFile($path)
$pattern = strtr($pattern, $replacements);
if (preg_match("|{$pattern}|i", $path) === 1) {
- return false;
+ return true;
}
}//end foreach
- return true;
+ return false;
- }//end shouldProcessFile()
+ }//end shouldIgnoreFile()
/**
View
@@ -17,35 +17,16 @@ http://pear.php.net/dtd/package-2.0.xsd">
<date>2011-12-01</date>
<time>15:17:00</time>
<version>
- <release>1.3.2</release>
- <api>1.3.2</api>
+ <release>1.3.3</release>
+ <api>1.3.3</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://matrix.squiz.net/developer/tools/php_cs/licence">BSD License</license>
<notes>
- - Added Generic JSHintSniff to run jshint.js over a JS file and report warnings
- -- Set jshint path using phpcs --config-set jshint_path /path/to/jshint-rhino.js
- -- Set rhino path using phpcs --config-set rhino_path /path/to/rhino
- -- Thanks to Alexander Weiß for the contribution
- - Nowdocs are now tokenized using PHP_CodeSniffer specific T_NOWDOC tokens for easier identification
- - Generic UpperCaseConstantNameSniff no longer throws errors for namespaces
- -- Thanks to Jaroslav Hanslík for the patch
- - Squiz NonExecutableCodeSniff now detects code after thrown exceptions
- -- Thanks to Jaroslav Hanslík for the patch
- - Squiz OperatorSpacingSniff now ignores references
- -- Thanks to Jaroslav Hanslík for the patch
- - Squiz FunctionCommentSniff now reports a missing function comment if it finds a standard code comment instead
- - Squiz FunctionCommentThrownTagSniff no longer reports errors if it can't find a function comment
- - Fixed unit tests not running under Windows
- -- Thanks to Jaroslav Hanslík for the patch
- - Fixed bug #18964 : "$stackPtr must be of type T_VARIABLE" on heredocs and nowdocs
- - Fixed bug #18973 : phpcs is looking for variables in a nowdoc
- - Fixed bug #18974 : Blank line causes "Multi-line function call not indented correctly"
- -- Adds new error message to ban empty lines in multi-line function calls
- - Fixed bug #18975 : "Closing parenthesis must be on a line by itself" also causes indentation error
+ - Fixed bug #19114 : CodeSniffer checks extension even for single file
</notes>
<contents>
<dir name="/">

0 comments on commit 38c4e5f

Please sign in to comment.