In my project, I have the following pre-commit hook:
#!/bin/sh
task validate_lint
In addition, in my Taskfile.yml I have the following:
validate_lint:
desc: Run black, flake8 and isort _validations_
cmds:
- poetry run black --check .
- poetry run flake8 .
- poetry run isort -c --df .
When I commit something from my terminal, the hook kicks in and runs the task properly. However, when committing from VScode, I get the following error:
task: [validate_lint] poetry run black --check .
Skipping .ipynb files as Jupyter dependencies are not installed.
You can fix this by running ``pip install "black[jupyter]"``
All done! ✨ ✨
6 files would be left unchanged.
task: [validate_lint] poetry run flake8 .
task: [validate_lint] poetry run isort -c --df .
Command not found: isort
task: Failed to run task "validate_lint": exit status 1
I must be missing something in the way the hook is executed when called from VScode. But I don't know what that thing is. Any ideas?
I don't know what was the problem, but reloading VScode solved it.