Last active
August 26, 2018 12:01
-
-
Save dinhhuydh/b4b2ac75b4dd2807c39127e254f25e31 to your computer and use it in GitHub Desktop.
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
# added to .git-hooks/pre_commit/debugger.rb | |
module Overcommit::Hook::PreCommit | |
# Check for Debugger | |
class Debugger < Base | |
def run | |
keywords = config['keywords'] | |
result = execute(command, args: [keywords.join('|')] + applicable_files) | |
unless result.stdout.empty? | |
extract_messages( | |
result.stdout.split("\n"), | |
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+)/, | |
lambda { |_type| :warning } | |
) | |
return :fail, "Debugger detected:\n#{result.stdout}" | |
end | |
:pass | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment