Skip to content

Instantly share code, notes, and snippets.

@laurynas
Last active August 29, 2015 14:03
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 laurynas/59f46f473bbacea251b9 to your computer and use it in GitHub Desktop.
Save laurynas/59f46f473bbacea251b9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# vim: set syntax=ruby
flag = false
files = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
files.each do |file|
results = `git diff --cached #{file} | grep "^\+[^+]" | grep -e "binding.pry" -e "focus: true" -e ":focus => true" -e "console.log" -e "debugger"`.split("\n").map { |r| r.sub(/^\+[\s\t]*/, '') }
if $? == 0
puts file
puts results.map { |r|
`grep -n "#{r}" #{file}`
}.join("")
puts "Please remove development stuff before commiting or commit with --no-verify"
flag = true
end
end
exit 1 if flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment