Index: trunk/phase3/maintenance/syntaxChecker.php |
— | — | @@ -159,9 +159,16 @@ |
160 | 160 | /** |
161 | 161 | * Returns true if $file is of a type we can check |
162 | 162 | */ |
163 | | - private static function isSuitableFile( $file ) { |
| 163 | + private function isSuitableFile( $file ) { |
164 | 164 | $ext = pathinfo( $file, PATHINFO_EXTENSION ); |
165 | | - return $ext == 'php' || $ext == 'inc' || $ext == 'php5'; |
| 165 | + if ( $ext != 'php' && $ext != 'inc' && $ext != 'php5' ) |
| 166 | + return false; |
| 167 | + foreach( $this->mIgnorePaths as $regex ) { |
| 168 | + $m = array(); |
| 169 | + if ( preg_match( "~{$regex}~", $file, $m ) ) |
| 170 | + return false; |
| 171 | + } |
| 172 | + return true; |
166 | 173 | } |
167 | 174 | |
168 | 175 | /** |
— | — | @@ -197,7 +204,7 @@ |
198 | 205 | RecursiveIteratorIterator::SELF_FIRST |
199 | 206 | ); |
200 | 207 | foreach ( $iterator as $file ) { |
201 | | - if ( self::isSuitableFile( $file->getRealPath() ) ) { |
| 208 | + if ( $this->isSuitableFile( $file->getRealPath() ) ) { |
202 | 209 | $this->mFiles[] = $file->getRealPath(); |
203 | 210 | } |
204 | 211 | } |
— | — | @@ -255,6 +262,12 @@ |
256 | 263 | * @return boolean |
257 | 264 | */ |
258 | 265 | private function checkForMistakes( $file ) { |
| 266 | + foreach( $this->mNoStyleCheckPaths as $regex ) { |
| 267 | + $m = array(); |
| 268 | + if ( preg_match( "~{$regex}~", $file, $m ) ) |
| 269 | + return; |
| 270 | + } |
| 271 | + |
259 | 272 | $text = file_get_contents( $file ); |
260 | 273 | |
261 | 274 | $this->checkRegex( $file, $text, '/^[\s\r\n]+<\?/', 'leading whitespace' ); |