Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- FORBIDDEN = [
- /debugger/i,
- /fuck/i,
- /shit/i,
- /bitch/i,
- /wtf/i,
- /fmt.Println/i,
- /fmt.Printf/i,
- /console\.debug/i,
- /Lorem\.ipsum\.dolor\.sit\.amet/i,
- /do not commit/i,
- /donkey balls/i,
- /wtf d+/i,
- /fucking/i,
- /retarded/i,
- /blah/i
- ]
- full_diff = `git diff --cached --`
- full_diff.scan(%r{^\+\+\+ b/(.+)\n@@.*\n([\s\S]*?)(?:^diff|\z)}).each do |file, diff|
- added = diff.split("\n").select { |x| x.start_with?("+") }.join("\n")
- if FORBIDDEN.any? { |re| added.match(re) }
- puts "=============================================================================="
- puts "%{Hey dumbass, you have debug shit in your code! You cannot commit '#{$1 || $&}' to #{file}}"
- puts "YOLO? Use --no-verify"
- puts "=============================================================================="
- exit 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement