Skip to content

Instantly share code, notes, and snippets.

View daryllxd's full-sized avatar
👨‍🔬
Do not fear failure but rather fear not trying.

Daryll Santos daryllxd

👨‍🔬
Do not fear failure but rather fear not trying.
View GitHub Profile
@daryllxd
daryllxd / pre-commit, ruby + rubocop
Last active February 28, 2017 12:47 — forked from adillera/pre-commit
Pre-commit hook. Add this to your .git/hooks to be reminded if you placed a debugger somewhere. Add file types in FILES variable and the forbidden texts in FORBIDDEN
#!/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."