Skip to content

Instantly share code, notes, and snippets.

@atmin
Created February 20, 2014 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atmin/9118764 to your computer and use it in GitHub Desktop.
Save atmin/9118764 to your computer and use it in GitHub Desktop.
Git precommit hook: lint Python files, check for debugger statements
py_files=`git diff --name-only HEAD|grep '.py$'`
grep -n 'pdb.set_trace()' $py_files && echo -e "\033[1;31m Debugger statements!!!\033[0m" && exit 1
pyflakes $py_files && exit || echo -e "\033[1;31m Lint error!\033[0m"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment