I have read the official flake8 docs, it has defined a 2 step process to install git pre-commit hook:
flake8 --install-hook git
git config --bool flake8.strict true
But it doesn't seem to provide any other type of hooks. Is there a way to install pre-push hook. Will just renaming pre-commit.exe
to pre-push.exe
work?
This is the pre-commit
file:
import sys
from flake8.main import git
if __name__ == '__main__':
sys.exit(
git.hook(
strict=git.config_for('strict'),
lazy=git.config_for('lazy'),
)
)
pre-commit
andpre-push
hooks are completely different.pre-commit
doesn't accept parameters — it works with the worktree;pre-push
accepts a lot of parameters. Forflake8
pre-commit
is enough.pre-commit
, i only want to usepre-push
hook.pre-push
is meaningless withflake8
becauseflake8
tests files, not commits; and of course such test is only meaningful before commit. If you insist — you have to write the hook yourself,flake8
doesn't provide it and it shouldn't.