jumanjihouse / pre-commit-hooks

git pre-commit hooks that work with http://pre-commit.com/
MIT License
114 stars 52 forks source link

pre-commit hook shfmt does not work when commit from phpstorm #103

Closed fchastanet closed 2 years ago

fchastanet commented 2 years ago

Hello, If I commit from shell, everything is working correctly But when I commit from phpstorm I have the following error This check needs shfmt from https://github.com/mvdan/sh/releases

Full output

[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/wsl/.cache/pre-commit/patch1647693104-25398.
mixed line ending........................................................Passed
fix end of files.........................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check xml............................................(no files to check)Skipped
check yaml...........................................(no files to check)Skipped
forbid new submodules................................(no files to check)Skipped
mixed line ending........................................................Passed
check json...........................................(no files to check)Skipped
Test shell scripts with shellcheck.......................................Passed
Check shell style with shfmt.............................................Failed
- hook id: shfmt
- exit code: 1
This check needs shfmt from https://github.com/mvdan/sh/releases
pyupgrade............................................(no files to check)Skipped
[INFO] Restored changes from /home/wsl/.cache/pre-commit/patch1647693104-25398.

Note that I'm using Phpstorm from windows with a mounted project in wsl only shfmt seems to fail, other plugins seems to work

fchastanet commented 2 years ago

I found a fix, there was an issue with my installtion environment Not sure what has fixed the issue(probably PIP_REQUIRE_VIRTUALENV):

Hope it could help someone else