Module: SimpleCov::ExitCodes::ExitCodeHandling

Defined in:
lib/simplecov/exit_codes/exit_code_handling.rb

Class Method Summary collapse

Class Method Details

.call(result, coverage_limits:) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simplecov/exit_codes/exit_code_handling.rb', line 8

def call(result, coverage_limits:)
  checks = coverage_checks(result, coverage_limits)

  failing_check = checks.find(&:failing?)
  if failing_check
    failing_check.report
    failing_check.exit_code
  else
    SimpleCov::ExitCodes::SUCCESS
  end
end

.coverage_checks(result, coverage_limits) ⇒ Object


20
21
22
23
24
25
26
# File 'lib/simplecov/exit_codes/exit_code_handling.rb', line 20

def coverage_checks(result, coverage_limits)
  [
    MinimumOverallCoverageCheck.new(result, coverage_limits.minimum_coverage),
    MinimumCoverageByFileCheck.new(result, coverage_limits.minimum_coverage_by_file),
    MaximumCoverageDropCheck.new(result, coverage_limits.maximum_coverage_drop)
  ]
end