Created
November 29, 2018 12:32
-
-
Save rj76/f93e83f2f3f23a7c401f3dcabc8fe511 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 | |
FILES_PATTERN='\.py$' | |
FORBIDDEN='import ipdb' | |
MSG="COMMIT REJECTED. Found \"${FORBIDDEN}\" references. Please remove them before commiting." | |
# check for debug stuff | |
git diff --name-only | \ | |
grep -E $FILES_PATTERN | \ | |
GREP_COLOR='4;5;37;41' xargs grep --color --with-filename -n "$FORBIDDEN" && echo $MSG && exit 1 | |
# run tests | |
`which python` `which pytest` -x | |
RESULT=$? | |
[ $RESULT -ne 0 ] && exit 1 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment