Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow aliased standards via symlinks. #29

Merged
merged 1 commit into from

2 participants

@ktomk

I wanted to replace a standard that I had installed with/in pear with a development version from github that was in another directory. So I symlinked the standard directory to the development directory:

.../Standards/Symfony2  ->  ~/Developing/Symfony2-coding-standard

This needed the requested changes.

@ktomk

X-Ref: https://pear.php.net/bugs/bug.php?id=19417 - Configuration via symlinks is useful where you have a shared configuration and/or IDE integrations that do not allow to specify standard-paths (e.g. Phpstorm).

@gsherwood gsherwood merged commit 5de1faa into from
@gsherwood
Owner

Thanks for another great patch.

@ktomk ktomk referenced this pull request
Merged

Tests for symlinked standards #32

@gsherwood gsherwood referenced this pull request from a commit
@gsherwood gsherwood Fixed bug #19448 : Problem with detecting remote standards. Note that…
… this reverts the changes from pull request #29, although the symlink issue that code was fixing appears to have now been fixed by other changes to CodeSniffer.php anyway.
fbab82e
@yuzuemon yuzuemon referenced this pull request from a commit
@gsherwood gsherwood Fixed bug #19448 : Problem with detecting remote standards. Note that…
… this reverts the changes from pull request #29, although the symlink issue that code was fixing appears to have now been fixed by other changes to CodeSniffer.php anyway.
e4c9eac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 12, 2012
  1. @ktomk
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 CodeSniffer.php
View
6 CodeSniffer.php
@@ -612,7 +612,7 @@ public function setTokenListeners($standard, array $sniffs=array())
$standard = (string) $ruleset['name'];
} else {
- self::$standardDir = realpath(dirname(__FILE__).'/CodeSniffer/Standards/'.$standard);
+ self::$standardDir = realpath(dirname(__FILE__).'/CodeSniffer/Standards').DIRECTORY_SEPARATOR.$standard;
if (is_dir(self::$standardDir) === false) {
// This isn't looking good. Let's see if this
// is a relative path to a custom standard.
@@ -819,7 +819,7 @@ private function _expandRulesetReference($sniff)
$sniff = basename($path);
} else if (is_file($sniff) === false) {
// See if this is a whole standard being referenced.
- $path = realpath(dirname(__FILE__).'/CodeSniffer/Standards/'.$sniff);
+ $path = realpath(dirname(__FILE__).'/CodeSniffer/Standards').DIRECTORY_SEPARATOR.$sniff;
if (is_dir($path) === true) {
$isDir = true;
} else {
@@ -831,7 +831,7 @@ private function _expandRulesetReference($sniff)
}
$path = $parts[0].'/Sniffs/'.$parts[1].'/'.$parts[2].'Sniff.php';
- $path = realpath(dirname(__FILE__).'/CodeSniffer/Standards/'.$path);
+ $path = realpath(dirname(__FILE__).'/CodeSniffer/Standards').DIRECTORY_SEPARATOR.$path;
if ($path === false && self::$standardDir !== '') {
// The sniff is not locally installed, so check if it is being
// referenced as a remote sniff outside the install. We do this by
Something went wrong with that request. Please try again.