-
-
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
Plugin not working correctly when sniffs install depth is equal to "1" #13
Comments
@bastianschwarz Thank you for this bug report. There are no migrations needed, so nothing wrong on your end. I will run test against the latest version asap and report back. |
I was not successful in reproducing. I've created an empty directory and place the following composer.json: {
"name": "frenck/test",
"require": {
"squizlabs/php_codesniffer": "^2",
"dealerdirect/phpcodesniffer-composer-installer": "0.2.1",
"frenck/php-compatibility": "^7.1"
}
} Ran
I've also tried a version with a fresh install using the latest version directly, this also worked fine. Some extra questions:
|
No, the PHP_CodeSniffer version was not updated and it's a local install, not a global one. I'm at home now and have to wait for my food, so I'll see if I can repoduce the issue with any of my own projects which use the same setup. |
Just reproduced it with one of my projects: https://github.com/codenamephp/platform.di There is an ant build.xml in the project root that executes the compatiblity check, basically the same call I did in the issue description.
Seems like there is something wrong when the components are already installed and the versions are switched? |
I will check your project locally. Note: You're talking about exceptions. It would be really useful if you'd include them in this issue report. |
Sure, it's just the default "Sniff not found"
|
@bastianschwarz I was able to reproduce the issue with this repository, thank you. I've actually pinpointed the situation where it goes wrong, let me explain. Running a
I tried from scratch again, this time upgrading the 3 packages above in the order listed, running After upgrading After upgrading Lastly (while still being broken) I upgraded Updated issue description: The plugin is unable to handle upgrades on the Since Workaround:
|
Sadly, the workaround did not work for me, neither for the update nor a clean install so I had a look at the plugin. What I found: After a clean install, the installedPaths are empty. The "frenck/php-compatibility" package is found by getPHPCodingStandardPackages() but since the Finder in updateInstalledPaths() sets the depth to >1 (which is depth 2), but the ruleset.xml in the frenck/php-compatibility is in level 1 within the install path, the path is never added to the config. Since I'm already kinda tired and I don't know if this is really just a "greater than vs greater than equals" issue or if I'm missing something in the big picture, I was kinda too lazy to fork, write a test and create a pull request. ;) If I change the depth to >0, it worked for a clean install and for the update. Maybe @christopher-hopper sees instantly if the >1 is acutally needed or if >0 is sufficent enough? |
@bastianschwarz same here, needed to change minimal depth in order to properly install |
@bastianschwarz Thanks for the details, it is evening here, I will take a look at this issue in the morning. I've you can all spare us a day or so, this issue will most likely be resolved. |
I'm taking a look at the Finder depth method docs and testing some scenarios. 👍 for some unit tests. I'll see if I can suggest a couple for this particular issue to prevent it ever reoccurring. I'll push that separately probably as it's part of the larger CI/Unit Testing push in #9 Apologise for not seeing this during development. Not sure how it fell through the cracks. Again, +1 for CI and tests. |
We've been debugging this issue and the Finder Depth does indeed seem to be the root of the issue.
Unless PHP Codesniffer is updated, custom sniffs will not be installed as they If PHP Codesniffer is updated, the custom sniffs will be removed. With the v0.2.1 The suggested solution is to change the The (for us) unexpected behaviour surrounding updates and global installs can then be documented and released as v0.3.2. There might possibly also be an issue with the logic that validates whether or |
…ch-depth Fixed #13: Incorrect coding standards search depth
I've just released version v0.3.1, which includes a hotfix for the search depth issue. Please note, as @Potherca wrote already, composer will use the previous installed plugin version while upgrading. If you still wind up with a broken setup after upgrading the plugin, please run @bastianschwarz Thank you for reporting this issue! |
@frenck Just tested it in one of our projects, works! Thanks for the fix! |
We also upgraded to 0.3.1 and it's working. Thanks! |
Problem/Motivation
Since I use the "*" constraint in our projects, the package updated to 0.3.0 today. Right now, the default PHPCompatiblity sniff can not be found. I have not yet looked into it myself in the hope that you might know right away what the issue is.
Expected behaviour
PHPComptability sniff should still be installed
Actual behaviour
Sniff is not installed:
Steps to reproduce
composer.json:
Delete vendor folder (if 0.2.1 which still works was installed, the sniff is still there)
Proposed changes
Is there a migration I missed or needs frenck/PHPCompatibility a new version too?
Thanks in advance for any help.
The text was updated successfully, but these errors were encountered: