Last active
August 1, 2018 17:05
-
-
Save RyanMcG/5775028 to your computer and use it in GitHub Desktop.
A pre-commit hook for rails projects that scans for 'binding.pry', 'debugger' and diff artifacts and stops the commit if it finds any.
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
#!/bin/sh | |
COMMAND='git grep -n --cached' | |
ARGS='-e debugger -e "binding\.pry" -- app config db spec vendor script lib Rakefile Guardfile Capfile' | |
if eval "$COMMAND -q $ARGS" ; then | |
echo "You have a binding.pry or a debugger in a bad place.\n" | |
eval "$COMMAND $ARGS" | |
exit 1 | |
fi | |
ARGS='-e "^<<<<<<< " -e "^>>>>>>> " -e "^=======$" -- app config db spec vendor script lib Rakefile Guardfile Capfile' | |
if eval "$COMMAND -q $ARGS" ; then | |
echo "You have some left over diff artifacts.\n" | |
eval "$COMMAND $ARGS" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment