Created
June 21, 2019 13:51
-
-
Save soszilla/5b9d69eabd2c31149ff8775b6f86d5d1 to your computer and use it in GitHub Desktop.
stupidity check
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/sh | |
FILES_PATTERN='\.(js|py)(\..+)?$' | |
FORBIDDEN='TODO|console.log|print' | |
git diff --cached --name-only | \ | |
grep -E $FILES_PATTERN | \ | |
GREP_COLOR='4;5;37;41' xargs egrep --color --with-filename -n $FORBIDDEN && echo "Found $FORBIDDEN references, commit canceled." && exit 1 | |
echo "pre-commit scan succeeded" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment