-
-
Save isDipesh/eca5acae1a33b0baad33 to your computer and use it in GitHub Desktop.
Git pre-commit hook for Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import glob | |
import os | |
import sys | |
# git usurbs your bin path for hooks and will always run system python | |
site_packages = glob.glob('%s/lib/*/site-packages' % os.environ['VIRTUAL_ENV'])[0] | |
sys.path.insert(0, site_packages) | |
from flake8.run import git_hook | |
COMPLEXITY = os.getenv('FLAKE8_COMPLEXITY', 10) | |
STRICT = os.getenv('FLAKE8_STRICT', True) | |
IGNORE = os.getenv('FLAKE8_IGNORE', 'E501') | |
LAZY = os.getenv('FLAKE8_LAZY', False) | |
if __name__ == '__main__': | |
sys.exit(git_hook( | |
complexity=COMPLEXITY, | |
strict=STRICT, | |
ignore=IGNORE, | |
lazy=LAZY, | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment