Flake8's pre-commit hook for git raises flake8: error: input not specified whenever I do git commit.
The hook file is identical to the official example :
#!/usr/bin/python
import sys
from flake8.run import git_hook
COMPLEXITY = 10
STRICT = False
if __name__ == '__main__':
sys.exit(git_hook(complexity=COMPLEXITY, strict=STRICT, ignore='E501'))
Yes, this is due to a bug in flake8 2.1.0. To work around this, create an empty setup.cfg or tox.ini file in your project directory. I just created a bug ticket for this: https://bitbucket.org/tarek/flake8/issue/133/git_hook-broken-when-setupcfg-and-toxini
There was a similar bug on a previous flake8 version (issue 68, fixed by commit 8fe9bfb)
But a very recent version of flake8 might have re-introduced that bug again (tweet, 6:02 PM - 20 Nov 13):
I'm not sure what happened to flake8 after update.
My old trusty pre-commit hook now returns, "flake8: error: input not specified".
The OP dlutxx reports in the comments:
until they fixed this bug, I'll just append the source directory to
sys.argvwithin the pre-commit file.
Ugly, but [it] works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With