Sha256: 9f2ca31e8aa6c70a743b0bae28801a970f0ca36d307a54d056c8184b7524649b
Contents?: true
Size: 729 Bytes
Versions: 14
Compression:
Stored size: 729 Bytes
Contents
class ConsoleLog attr_accessor :staged_files, :error_message def self.call(quiet=false) check = new check.staged_files = Utils.staged_files('public/javascripts') result = check.run if !quiet && !result puts check.error_message end result end def run return true if staged_files.empty? if detected_bad_code? @error_message = "pre-commit: console.log found:\n" @error_message += instances_of_console_log_violations false else true end end def detected_bad_code? system("grep -v \/\/ #{staged_files} | grep -qe \"console\\.log\"") end def instances_of_console_log_violations `grep -nHe \"console\\.log\" #{staged_files}` end end
Version data entries
14 entries across 14 versions & 1 rubygems