Skip to content

Instantly share code, notes, and snippets.

@lorefnon
Created June 17, 2014 14:47
Show Gist options
  • Save lorefnon/429d86160129c9e6ca32 to your computer and use it in GitHub Desktop.
Save lorefnon/429d86160129c9e6ca32 to your computer and use it in GitHub Desktop.
pre-commit hook to check for debugger invocations in ruby source.
echo "\n--"
echo "Checking for debugger calls"
echo "--\n"
for name in `git diff --name-only --cached`
do
echo "Analysing: $name"
cat $name | egrep -n "\b(byebug|binding.pry|debugger)\b" | while read line
do
echo " -> $line"
echo "\n--"
echo "Commit Aborted"
echo "--\n"
exit 1
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment