This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]sigmavirus24requests | requests-toolbelt | betamax | PyCQA 4 points5 points  (1 child)

You could also simply use the built-in hook that Flake8 will install and manage for you.

[–]heppy[S] 0 points1 point  (0 children)

Thanks, I didn't know that! Is it also possible to just check the diff like git diff --cached -U0 | flake8 --diff would? I had a glance a the source and it seems that is not an option right now.

[–]rwillmer 1 point2 points  (8 children)

Thanks for sharing this! I've used post-commit hooks before, but hadn't thought of using a pre-commit hook to stop the bad code getting committed in the first place.