class SimpleCov::ExitCodes::MaximumOverallCoverageCheck
and surface unexpected increases instead of silently absorbing them.
‘SimpleCov.expected_coverage`) to pin coverage to an exact value
`SimpleCov::ExitCodes::MinimumOverallCoverageCheck` (or use
above the configured maximum. Pair with
Fails when the overall (project-wide) coverage for any criterion is
def exit_code
def exit_code SimpleCov::ExitCodes::MAXIMUM_COVERAGE end
def failing?
def failing? violations.any? end
def initialize(result, maximum_coverage)
def initialize(result, maximum_coverage) @result = result @maximum_coverage = maximum_coverage end
def report
def report violations.each { |violation| report_violation(violation) } end
def report_violation(violation)
def report_violation(violation) ExitCodes.print_error format( "%<criterion>s coverage (%<actual>s) is above the expected maximum coverage (%<expected>.2f%%). " \ "Time to bump the threshold!", criterion: violation.fetch(:criterion).capitalize, actual: SimpleCov::Color.colorize_percent(violation.fetch(:actual)), expected: violation.fetch(:expected) ) end
def violations
def violations @violations ||= SimpleCov::CoverageViolations.maximum_overall(@result, @maximum_coverage) end