Skip to content

Instantly share code, notes, and snippets.

@jlindley
Forked from jhsu/pre-commit
Created November 11, 2010 22:50
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jlindley/673376 to your computer and use it in GitHub Desktop.
Save jlindley/673376 to your computer and use it in GitHub Desktop.
pre-commit hook for git, prevents console.log() statements
#!/bin/sh
# Don't allow console.log() statements to be committed.
#
# Add to .git/hooks/pre-commit
#
# Note: jquery.js seems to always include 1 reference
# in a debugging section, that one can be safely
# ignored. 1 reference to console.log is cool
count=`grep -iR 'console\.log' public/javascripts/* | wc -l | awk '{print $1}'`
if [[ "$count" -ge 2 ]]; then
echo " remove any config.log() statements in javascript sources"
exit 1
fi
@lucaswhitman
Copy link

Did you mean console.log()? ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment