Last active
August 29, 2015 14:13
-
-
Save atzkey/5350d87db9381f0ec1e6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
if git rev-parse --verify HEAD >/dev/null 2>&1; then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
fi | |
# Add extensions to check here | |
extensions='(\.js|\.coffee$)' | |
files=$(git diff-index --cached --name-only $against --) | |
for file in $files; do | |
if [[ $file =~ $extensions ]]; then | |
errors=$(egrep -n 'debugger|console\.log|(describe|it)\.only|[dw]describe|[dw]it' $file) | |
if [ "$errors" != "" ]; then | |
errors="Bad things found in $file:\n$errors" | |
echo -e "$errors" | |
exit 1 | |
fi | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment