-
-
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
Fix for issue #103 #104
Fix for issue #103 #104
Conversation
If the phpcodesniffer-composer-installer plugin is installed as a dev requirement and it is then uninstalled as part of a "--no-dev" install, a bug occurs. The bug that occurs is that the plugin complains that the package "squizlabs/php_codesniffer" is not installed without checking if the package should be present. This commit adds a check to verify that this plugin is actually installed before complaining about the missing package. If this plugin itself is removed, then it should not complain about the missing package.
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.
@Potherca Thanks for setting up this fix.
I think it needs to be expanded to cover both dev
as well as non-dev
requirements.
While installing the plugin as a dev
requirement will be the more common case, IMO a fix like this should also cover the less likely case where the plugin is installed via require
.
I've ran some tests with both master
as well as this branch and it looks like the issue also occurs in the below situation which is not fixed by this PR:
- Blank folder.
composer require wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer
(note: not--dev
)composer remove wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer -v
Whether this is run on master
or using this branch, in both cases, the result is still:
Running PHPCodeSniffer Composer Installer
PHPCodeSniffer is not installed
Exitcode: 1
P.S.: just wondering why you pushed this to your own fork instead of this repo ?
Previously the check would only run if the plugin was require-dev. That behaviour is incorrect, as the check should always be done. If the plugin is not installed, it doesn't make sense to return an error under any circumstances. This commit fixes that oversight.
You are correct... The "Is this plugin installed?" check should always run. It doesn't matter if it is I guess I was a bit monofocussed on the reported scenario. 🤷 Anyway, good catch! 👍 Regarding the "P.S."... I tend to always work from my own fork, for various reasons.
|
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.
Tested & found working as expected 👍
Thanks @Potherca for sorting this out. I think I will still open an issue in the Composer repo to ask about the principle of plugins running after they've been uninstalled. Depending on the answer there, we can iterate on this further. Re: the "P.S.": Thanks for the extensive answer. I was mostly wondering about it as it makes (manual) testing by other committers or even by casual watchers of the repo more awkward. To be able to test this PR, as you will no doubt be aware, I had to add a new remote + add a As PR branches should "normally" be short-lived, I'm not too concerned about branches being added to a repo, especially as it is now possible for them to be auto-deleted on merge (setting in the repo settings). I'm not trying to persuade you to change your workflow. Just wanted to give you my perspective. |
If the phpcodesniffer-composer-installer plugin is installed as a dev
requirement and it is then uninstalled as part of a "--no-dev" install, a bug
occurs. The bug that occurs is that the plugin complains that the package
"squizlabs/php_codesniffer" is not installed without checking if the package
should be present.
Proposed Changes
This commit adds a check to verify that this plugin is actually installed before
complaining about the missing package. If this plugin itself is removed, then
it should not complain about the missing package.
Related Issues
#103