Class: PreCommit::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/pre-commit/runner.rb

Instance Method Summary collapse

Instance Method Details

#runObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pre-commit/runner.rb', line 4

def run
  checks_to_run = PreCommit.checks_to_run

  all_passed = checks_to_run.inject(true) do |current_status, check|
    passed = check.call

    if !passed && check.respond_to?(:error_message)
      puts check.error_message
    end

    check && current_status
  end

  exit(all_passed ? 0 : 1)
end