Skip to content

Instantly share code, notes, and snippets.

@ptone
Created November 18, 2012 01:30
Show Gist options
  • Save ptone/4102528 to your computer and use it in GitHub Desktop.
Save ptone/4102528 to your computer and use it in GitHub Desktop.
flake8 git hook for virtualenv
#!/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 = 10
STRICT = False
if __name__ == '__main__':
sys.exit(git_hook(complexity=COMPLEXITY, strict=STRICT, ignore='E501'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment