Search code examples
pythongitgithooksflake8

git hook flake8: error: input not specified


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'))

Solution

  • 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