Skip to content

Instantly share code, notes, and snippets.

@fathergoose
Created July 6, 2017 03:28
Show Gist options
  • Save fathergoose/9096b701fc474cd7e83f7c0dba627b9e to your computer and use it in GitHub Desktop.
Save fathergoose/9096b701fc474cd7e83f7c0dba627b9e to your computer and use it in GitHub Desktop.
Check for debugger statements before commiting your code.
#!/bin/sh
#
# Check for debugger statements before commiting your code.
#
# Nodejs uses 'debugger' as a keyword statement to trigger a
# breakpoint. There's literally no reason to commit such a thing
echo "Running debugger check..."
RES=`git grep -n 'debugger'`
if [[ -n "$RES" ]]; then
echo "\nDebugging functions were found in your at"
echo "\n$RES"
echo "Changes not committed"
exit 1;
else
echo "\n No 'debugger' statements found.\n";
exit 0;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment