Skip to content

Instantly share code, notes, and snippets.

@chabgood
Last active August 2, 2016 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chabgood/81437e7efa3eda984dbd723ad37eeae5 to your computer and use it in GitHub Desktop.
Save chabgood/81437e7efa3eda984dbd723ad37eeae5 to your computer and use it in GitHub Desktop.
git pre-commit hook prevent pry debug
#!/usr/bin/env ruby
class CheckForDebug
def self.run
@files = `git grep --all-match -e 'binding.pry' --and --not -e 'add binding' --line-number`
exit_and_notify if @files.length > 0
exit 0;
end
def self.exit_and_notify
p @files.strip
p 'Debugging functions were found in your code!'
exit 1;
end
end
CheckForDebug.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment