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 | |
require 'english' | |
require 'rubocop' | |
cached_changes = `git diff --cached` | |
forbidden_words = ['binding.pry', 'console.log', 'debugger', 'byebug', '!important'] | |
if forbidden_words.any? { |word| cached_changes.include?(word) } | |
puts "Looks like you are trying to commit something (any one of `#{forbidden_words.join(', ')}`) you shouldn't. Please fix your diff, or run 'git commit --no-verify' to skip this check, if you must." |