lib/pre-commit/checks.rb in pre-commit-0.1.11 vs lib/pre-commit/checks.rb in pre-commit-0.1.12

- old
+ new

@@ -8,11 +8,11 @@ require 'pre-commit/checks/jshint_check' require 'pre-commit/checks/migration_check' class PreCommit - WhiteSpace = lambda { + WhiteSpace = lambda { WhiteSpaceChecker.check } ClosureSyntaxCheck = lambda { compiler = "test/javascript/lib/compiler.jar" @@ -22,41 +22,9 @@ else true end } - JSLintCheck = lambda { |files| - errors = [] - files.each do |file| - errors << JSLint.lint_file(file) - end - - # JSLint.lint_file returns an array. - # Therefore no errors looks like this: [[]] - # And errors.empty? returns false - errors.flatten! - - if errors.empty? - true - else - $stderr.puts errors.join("\n") - $stderr.puts - $stderr.puts 'pre-commit: You can bypass this check using `git commit -n`' - $stderr.puts - false - end - } - - JSLintNew = lambda { - new_js_files = Utils.new_files('.').split(" ").reject {|f| f !~ /\.js$/} - JSLintCheck[new_js_files] - } - - JSLintAll = lambda { - staged_js_files = Utils.staged_files('.').split(" ").reject {|f| f !~ /\.js$/} - JSLintCheck[staged_js_files] - } - Checks = { :white_space => WhiteSpace, :console_log => ConsoleLog, :js_lint_all => JslintCheck.new(:all), :js_lint_new => JslintCheck.new(:new),