Class: SimpleCov::ExitCodes::MaximumOverallCoverageCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov/exit_codes/maximum_overall_coverage_check.rb

Overview

Fails when the overall (project-wide) coverage for any criterion is above the configured maximum. Pair with ‘SimpleCov::ExitCodes::MinimumOverallCoverageCheck` (or use `SimpleCov.expected_coverage`) to pin coverage to an exact value and surface unexpected increases instead of silently absorbing them.

Instance Method Summary collapse

Constructor Details

#initialize(result, maximum_coverage) ⇒ MaximumOverallCoverageCheck

Returns a new instance of MaximumOverallCoverageCheck.



11
12
13
14
# File 'lib/simplecov/exit_codes/maximum_overall_coverage_check.rb', line 11

def initialize(result, maximum_coverage)
  @result = result
  @maximum_coverage = maximum_coverage
end

Instance Method Details

#exit_codeObject



24
25
26
# File 'lib/simplecov/exit_codes/maximum_overall_coverage_check.rb', line 24

def exit_code
  SimpleCov::ExitCodes::MAXIMUM_COVERAGE
end

#failing?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/simplecov/exit_codes/maximum_overall_coverage_check.rb', line 16

def failing?
  violations.any?
end

#reportObject



20
21
22
# File 'lib/simplecov/exit_codes/maximum_overall_coverage_check.rb', line 20

def report
  violations.each { |violation| report_violation(violation) }
end