-
-
Save JustDevZero/3761912fd22489035dbce3aebf83c1e2 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 diff-index -U --color=always --cached -G '[ ;]i?pdb' HEAD) | |
if [ ${#pdb_check} -gt 0 ] | |
then | |
echo "COMMIT REJECTED: commit contains code with break points in python. Please remove before commiting." | |
echo $pdb_check | |
exit 1 | |
else | |
echo "Code contains no break points in python" | |
fi | |
debugger_check=$(git diff-index -U --color=always --cached -G '[ ;]debugger' HEAD) | |
if [ ${#debugger_check} -gt 0 ] | |
then | |
echo "COMMIT REJECTED: commit contains code with break points in js. Please remove before commiting." | |
echo $debugger_check | |
exit 1 | |
else | |
echo "Code contains no break points in js" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment