Reputation: 2411
I am using pre-commit
to invoke flake8
with a plug-in flake8-requirements
.
The plug-in currently requires flake8
to be invoked in the package root, which conveniently isn't the repo root. Per this comment in a pre-commit
issue, I have accordingly modified my pre-commit config to be this:
- repo: local
hooks:
- id: flake8
name: flake8 src package
alias: flake8-src
files: ^src/
types: [python]
language: system
entry: bash -c "cd src && flake8"
This works properly. Unfortunately, the src
package is large, and flake8
takes a few seconds to run. So, now pre-commit
runs are not snappy.
How can one tweak the entry
such that the files
from pre-commit
(passed as positional args) are passed to flake8
?
Update: or am I wrong, and this works already as intended?
Upvotes: 0
Views: 784
Reputation: 70007
flake8-requirements
seems like not the greatest plugin -- it relies on needing to have access to your entire codebase at once so you can't really get beyond the "it's going to be slow" and have flake8-requirements
at the same time.
personally I would split the flake8-requirements
check out to a separate check and probably not run it as part of pre-commit
(because it is so slow)
also, I noticed you're not using the official flake8
configuration and instead ~reinventing the wheel with a repo: local
hook. as such you've unintentionally written a fork bomb :)
disclaimer: I'm the current flake8 maintainer and I created pre-commit
Upvotes: 1