Skip to content

Instantly share code, notes, and snippets.

@Ashaba
Created November 8, 2017 13:49
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 Ashaba/13398347d41bd11f1e9ff1733963f42b to your computer and use it in GitHub Desktop.
Save Ashaba/13398347d41bd11f1e9ff1733963f42b to your computer and use it in GitHub Desktop.
alias pythonfiles='find . -type f -name "*.py" | xargs git diff --cached --name-only $against'
if [ -n "$(pythonfiles)" ]; then
if pythonfiles | xargs grep --color --with-filename -n "import pdb"; then
echo "Error commiting changes: Please remove pdb and its usage"
exit 1
fi
if pythonfiles | xargs grep --color --with-filename -n "pdb.set_trace()"; then
echo "Error commiting changes: Please remove pdb and its usage"
exit 1
fi
if pythonfiles | xargs grep --color --with-filename -n "print"; then
echo "Error commiting changes: Please remove all print statements!"
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment