-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHANGE: Local projects uses relative paths to their coding standards #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing weird found. Fix comments at your leisure. (Or not).
src/Plugin.php
Outdated
@@ -242,7 +244,12 @@ private function cleanInstalledPaths() | |||
{ | |||
$changes = false; | |||
foreach ($this->installedPaths as $key => $path) { | |||
if (file_exists($path) === false || is_dir($path) === false || is_readable($path) === false) { | |||
// This might be an relative path as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
a relative path
@@ -270,14 +278,21 @@ private function updateInstalledPaths() | |||
|
|||
$finder = new Finder(); | |||
$finder->files() | |||
->ignoreUnreadableDirs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
|
||
/** | ||
* Test if composer is running "global" | ||
* This check kinda dirty, but it is the "Composer Way" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Plugin.php
Outdated
|
||
// Some compatibility fixes for Windows paths | ||
$from = is_dir($from) ? rtrim($from, '\/') . '/' : $from; | ||
$to = is_dir($to) ? rtrim($to, '\/') . '/' : $to; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much whitespace between ) ?
.
* | ||
* @return string Relative path | ||
*/ | ||
private function getRelativePath($to) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is going to be a bastard to test 😿
c9b7c6b
to
d39ee79
Compare
Proposed Changes
Changed they way paths are put into PHP_CodeSniffer based on Composer being executes globally or not. Local repositories (project folder) installations will use relative paths from the PHP_CodeSniffer installation directory to the directory containing the coding standard.
The behaviour for globally installed instances will keep using absolute paths; unchanged.
Related Issues
#20 Install sniffs with relative paths in CodeSniffer.conf