Last active
August 2, 2016 01:38
-
-
Save chabgood/81437e7efa3eda984dbd723ad37eeae5 to your computer and use it in GitHub Desktop.
git pre-commit hook prevent pry debug
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
#!/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