-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
gitstaged filter not working when called through npm husky precommit hook #3412
Comments
@dingo-d While Windows is case-insensitive, Linux is not. I think your issue will be fixed if you use |
Thanks for the tip, I'll give it a go 👍🏼 |
Ok, so setting it to I'll try to investigate what happens when I run one vs the other command with some additional flags. EDIT: Ok, so something is odd with the realpath utility. Because when I check the PHP_CodeSniffer/src/Filters/GitStaged.php Line 50 in b245bb3
I get the path to be Could this be because of WSL? I think my colleagues on mac are getting the same thing, so it could be due to Linux as well (since I am running Ubuntu 20.04 in WSL, and they are using MacOS unix based terminal). |
I'll poke this around since I have a Mac available and a Win PC that I can use, so I'll try to see what is happening, and report back 👍🏼 |
Hmm... darn... Looking at the code in the Might be something we could debug together ? |
Sure, just say when 😄 |
Describe the bug
In my project, I'm using husky to run my pre-commit hooks. In
package.json
I haveSo it triggers any time I do a commit. In my
composer.json
I have these scriptsWhen I run my commit, all the npm hooks run ok, but the phpcs script fails with
When I remove the filter, the script runs fine, but over the entire codebase, not just the committed files.
Custom ruleset
Expected behavior
PHP_CS should run with the gitstaged filter.
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: