lib/pre-commit/checks.rb in pre-commit-0.8.0 vs lib/pre-commit/checks.rb in pre-commit-0.8.1

- old
+ new

@@ -11,20 +11,22 @@ require 'pre-commit/checks/ci_check' require 'pre-commit/checks/php_check' require 'pre-commit/checks/pry_check' require 'pre-commit/checks/rspec_focus_check' require 'pre-commit/checks/ruby_symbol_hashrockets' +begin + require 'pre-commit/checks/rubocop_check' +rescue LoadError # no rubocop +end module PreCommit WhiteSpace = lambda { WhiteSpaceChecker.check } ClosureSyntaxCheck = lambda { - compiler = "test/javascript/lib/compiler.jar" - if File.exists?('public/javascripts') && (args = Utils.staged_files('public/javascripts')).size > 0 ClosureChecker.check(args.split(" ")) else true end @@ -46,9 +48,16 @@ :ci => CiCheck.new, :php => PhpCheck.new, :rspec_focus => RSpecFocusCheck, :ruby_symbol_hashrockets => RubySymbolHashrockets } + + if defined?(Rubocop) + Checks.merge!({ + :rubocop_new => RubocopCheck.new(:new), + :rubocop_all => RubocopCheck.new(:all) + }) + end # Can not delete this method with out a deprecation strategy. # It is refered to in the generated pre-commit hook in versions 0.0-0.1.1 # # NOTE: The deprecation strategy *may* be just delete it since, we're still