-
-
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
Incorrect relative paths for WPCS #33
Comments
What @GaryJones said. Basically PHPCS expects the As of PHPCS 3.x, PHPCS is supposed to support root-directory standards, i.e. passing a path to Based on Gary's findings that PHPCS 3 feature appears to be buggy. As this plugin has registered the (Manually) Setting the |
I've pulled a fix for the upstream bug as squizlabs/PHP_CodeSniffer#1581 |
Hi @GaryJones & @jrfnl, The issue indeed seems an error / unexpected behavior. ../Frenck |
@frenck Thanks! Much appreciated. |
For v0.3.x we've used this when finding a path that contains a $standardsPath = dirname(dirname($ruleset)) In v0.4.0 we changed this behavior to support two things.
The plugin detects if you are using PHPCS 2.x or 3.x and adjusts the behavior. If I understand @jrfnl correctly, this is an issue with PHPCS itself, and a hotfix is made squizlabs/PHP_CodeSniffer#1581. Therefore I'm wondering, how is this a problem with this plugin? The only option I see here is to revert partially to the PHPCS 2.x behavior, but this would/could/might cause problems when trying to support coding standards in the root of the repository. Nevertheless, this is again workaround-able, but it ain't pretty... So actually, the actual behavior is my expected behavior... Since this is documented by PHPCS. Any thoughts on this @jrfnl? |
@GaryJones This issue is not related to #32. #32 is actually an issue with the repository that is used. It contains a |
@frenck Thank you for investigating. I would expect the plugin to register paths using the cross-version compatible method of a "Standards" directory and only register standards as root-standard directories if:
There are two reasons for this:
|
Version 0.4.x of the DealerDirect Composer plugin registers each standard individually as if they were root-directory standards, not a collection of standards which exposes a bug in PHPCS 3.x. Refs: * squizlabs/PHP_CodeSniffer/pull/1581 * PHPCSStandards/composer-installer/issues/33
@jrfnl I have created a working solution on my laptop at this moment. I've tested it extensively, including the case mentioned by @GaryJones. I will do some documentation and some more (paranoia) testing and get back to you guys as soon as possible. |
@frenck Thank you! You're awesome! |
PR #34 should fix this issue, will do a minor release right after the merge. |
…s-behavior Fixes #33. Changes the way the installed_paths are set.
PR passed review and got merged. Thanks guys for reporting, this is really appreciated. |
I'll give it a try, thanks! |
Thx @GaryJones 👍 One of the last tests I've done is the one you've put into this issue (and even added additional standards in the root of my project). Result:
I was able to run every registered coding standard, including the one that gave you errors: If you encounter any issues, please let me know. We will try to look into it asap. |
@frenck
Thank you :-) |
@frenck Thanks for this! I'll make sure the info in both WPCS and PHPCompatibility is adjusted where necessary before release. |
Version 0.4.0 of the DealerDirect Composer plugin registers each standard individually as if they were root-directory standards, not a collection of standards which exposes a bug in PHPCS 3.x. Refs: * squizlabs/PHP_CodeSniffer/pull/1581 * PHPCSStandards/composer-installer/issues/33
FYI: a fix for the upstream part of this issue has been merged into PHPCS just now, so should be included in the PHPCS 3.1.0 release. That doesn't negate the value of the fix which was merged here, but just thought I'd let you know anyway. |
@jrfnl Thanks for letting me know 👍 |
…more flexible, take two Further iteration on earlier fix, now no longer using unbound restraints. Note: Version `0.4.0` is excluded from being installed due to a [bug](PHPCSStandards/composer-installer#33) which made it far less usable. Ref: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases
…more flexible, take two Further iteration on earlier fix, now no longer using unbound restraints. Note: Version `0.4.0` is excluded from being installed due to a [bug](PHPCSStandards/composer-installer#33) which made it far less usable. Ref: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases
…more flexible ... to prevent conflicts with projects, be it external standards or end-user projects, which require the plugin themselves as well. Note: Version `0.4.0` is excluded from being installed due to a [bug](PHPCSStandards/composer-installer#33) which made it far less usable. Ref: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases
…more flexible ... to prevent conflicts with projects, be it external standards or end-user projects, which require the plugin themselves as well. Note: Version `0.4.0` is excluded from being installed due to a [bug](PHPCSStandards/composer-installer#33) which made it far less usable. Ref: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases
Problem/Motivation
Possibly related to #32.
With the following in my composer:
the installed_paths phpcs config value is wrong.
Composer resolves this as using PHPCS 3.0.2, and the relative branches of WPCS and PHPCompatibility, both of which support PHPCS 3.*.
Expected behaviour
I expect the paths to be correct. With 0.3 of this plugin. I get:
phpcs -i
shows all of the standards correctly available, andphpcs
runs correctly against thephpcs.xml.dist
in my project.Actual behaviour
With 0.4 of the plugin, I get:
phpcs -i
still does show the right standards are available, but,phpcs
does not run correctly. Depending on the first called ruleset inphpcs.xml.dist
, I get an error the form:This also happens if
phpcs . --standard=WordPress
is called.Interestingly, calling
phpcs . --standard=WordPress-Core
does appear to run.I'm not sure where the issue lies exactly, but @jrfnl says:
The text was updated successfully, but these errors were encountered: