Skip to content

Commit

Permalink
Rule references for standards, directories and specific sniffs can no…
Browse files Browse the repository at this point in the history
…w be relative in ruleset.xml files
  • Loading branch information
gsherwood committed Apr 27, 2012
1 parent 2a63cf7 commit e329880
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CodeSniffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,17 @@ private function _expandRulesetReference($sniff)
return $referencedSniffs;
}

// As sniffs can't begin with a full stop, assume sniffs in
// this format are relative paths and attempt to convert them
// to absolute paths. If this fails, let the sniff path run through
// the normal checks and have it fail as normal.
if (substr($sniff, 0, 1) === '.') {
$realpath = realpath(dirname(self::$standardDir).'/'.$sniff);
if ($realpath !== false) {
$sniff = $realpath;
}
}

$isDir = false;
$path = $sniff;
if (is_dir($sniff) === true) {
Expand Down
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Standards designed to be installed in the PHPCS Standards dir will now work outside this dir as well
-- In particular, allows the Drupal CS to work without needing to symlink it into the PHPCS install
-- Thanks to Peter Philipp for the patch
- Rule references for standards, directories and specific sniffs can now be relative in ruleset.xml files
-- For example: ref="../MyStandard/Sniffs/Commenting/DisallowHashCommentsSniff.php"
- Squiz ObjectInstantiationSniff now allows objects to be returned without assinging them to a variable
- Debug option -vv now shows tokenizer status for CSS files
- Added support for new gjslint error formats
Expand Down

0 comments on commit e329880

Please sign in to comment.