Skip to content

Instantly share code, notes, and snippets.

@atmin
Created Feb 20, 2014
Embed
What would you like to do?
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