Module: PreCommit
- Defined in:
- lib/pre-commit/cli.rb,
lib/pre-commit/base.rb,
lib/pre-commit/utils.rb,
lib/pre-commit/checks.rb,
lib/pre-commit/runner.rb,
lib/pre-commit/checks/tabs.rb,
lib/pre-commit/checks/ci_check.rb,
lib/pre-commit/checks/js_check.rb,
lib/pre-commit/checks/php_check.rb,
lib/pre-commit/checks/pry_check.rb,
lib/pre-commit/checks/console_log.rb,
lib/pre-commit/checks/local_check.rb,
lib/pre-commit/checks/jshint_check.rb,
lib/pre-commit/checks/jslint_check.rb,
lib/pre-commit/checks/rubocop_check.rb,
lib/support/closure/closure_checker.rb,
lib/pre-commit/checks/debugger_check.rb,
lib/pre-commit/checks/merge_conflict.rb,
lib/pre-commit/checks/migration_check.rb,
lib/pre-commit/checks/rspec_focus_check.rb,
lib/support/whitespace/whitespace_checker.rb,
lib/pre-commit/checks/ruby_symbol_hashrockets.rb
Defined Under Namespace
Classes: CiCheck, Cli, ClosureChecker, ConsoleLog, DebuggerCheck, JsCheck, JshintCheck, JslintCheck, LocalCheck, MergeConflict, MigrationCheck, PhpCheck, PryCheck, RSpecFocusCheck, RubocopCheck, RubySymbolHashrockets, Runner, Tabs, Utils, WhiteSpaceChecker
Constant Summary collapse
- WhiteSpace =
lambda { WhiteSpaceChecker.check }
- ClosureSyntaxCheck =
lambda { if File.exists?('public/javascripts') && (args = Utils.staged_files('public/javascripts')).size > 0 ClosureChecker.check(args.split(" ")) else true end }
- Checks =
{ :white_space => WhiteSpace, :console_log => ConsoleLog, :js_lint_all => JslintCheck.new(:all), :js_lint_new => JslintCheck.new(:new), :jshint => JshintCheck.new, :debugger => DebuggerCheck, :pry => PryCheck, :local => LocalCheck, :tabs => Tabs, :closure_syntax_check => ClosureSyntaxCheck, :merge_conflict => MergeConflict, :migrations => MigrationCheck.new, :ci => CiCheck.new, :php => PhpCheck.new, :rspec_focus => RSpecFocusCheck, :ruby_symbol_hashrockets => RubySymbolHashrockets }
Class Method Summary collapse
-
.checks_to_run ⇒ Object
Actually, on the deprecation note.
- .root ⇒ Object
- .run ⇒ Object
Class Method Details
.checks_to_run ⇒ Object
Actually, on the deprecation note. This method isn’t really the problem. The problem is the default generated pre-commit hook. It shouldn’t have logic in it. The we have freedom to change the gem implementation however we want, and nobody is forced to update their pre-commit binary.
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/pre-commit/checks.rb', line 72 def self.checks_to_run checks_to_run = `git config pre-commit.checks`.chomp.split(/,\s*/).map(&:to_sym) if checks_to_run.empty? Checks.values_at(:white_space, :console_log, :debugger, :pry, :tabs, :jshint, :migrations, :merge_conflict, :local) else Checks.values_at(*checks_to_run) end.compact end |
.root ⇒ Object
3 4 5 |
# File 'lib/pre-commit/base.rb', line 3 def self.root File.('../../..', __FILE__) end |
.run ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/pre-commit/checks.rb', line 83 def self.run exit_status = self.checks_to_run.inject(true) do |acc, cmd| cmd.call && acc end exit(exit_status ? 0 : 1) end |