Created
September 15, 2017 11:36
-
-
Save conformist-mw/ae08a39db1cb76cbf762ce35b0d02087 to your computer and use it in GitHub Desktop.
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 | |
# How to use this script: | |
# $ git config --global init.templatedir '~/.git-templates' | |
# $ mkdir -p ~/.git-templates/hooks | |
# save this file as pre-commit | |
# $ chmod +x ~/.git-templates/hooks/pre-commit | |
RED=`tput setaf 1` | |
GREEN=`tput setaf 2` | |
RESET=`tput sgr0` | |
FILES=`find . -iname '*.py'` | |
for file in $FILES; do | |
if egrep -A1 -i '#\s*todo|debug|dbg' $file | grep -q 'print'; then | |
printf "remove ${RED}debug print${RESET} or run ${GREEN}git commit --no-verify${RESET}\n" | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment