Created
January 6, 2015 12:34
-
-
Save chronossc/0a46e2025154b9a45bce to your computer and use it in GitHub Desktop.
Basic pre-commit hook for avoid commit code with pdb/ipdb
This file contains 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
#!/bin/bash | |
# based on http://www.snip2code.com/Snippet/165926/Check-for-ipdb-breakpoints-git-hook | |
pdb_check=$(git grep -E -n '[ ;]i?pdb') | |
if [ ${#pdb_check} -gt 0 ] | |
then | |
echo "COMMIT REJECTED: commit contains code with break points. Please remove before commiting." | |
echo $pdb_check | |
exit 1 | |
else | |
echo "Code contains no break points" | |
fi | |
exit 0 |
Thanks for tip on git grep
I adapted this solution to Python and added the --cached
flag to only check staged files.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HAHAHAHAHHAHA Super preguiça!