Skip to content

Instantly share code, notes, and snippets.

@lucivaldo
Created December 16, 2016 14:25
Show Gist options
  • Save lucivaldo/1caacfd0e516ec7e96ec3a3d6765e0f7 to your computer and use it in GitHub Desktop.
Save lucivaldo/1caacfd0e516ec7e96ec3a3d6765e0f7 to your computer and use it in GitHub Desktop.
Script Ruby executado antes de efetuar o commit para interromper caso houver código de debug
#!/usr/bin/env ruby
require 'colorize'
files_with_debug = `git diff --name-only --cached | xargs grep -EH '^[^#]*binding.pry' | cut -d':' -f 1`
unless files_with_debug&.strip&.empty?
puts 'Tem código de debug nos seguintes arquivos:'
puts files_with_debug
exit(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment