class SimpleCov::ExitCodes::MaximumCoverageDropCheck

configured maximum since the last recorded run.
Fails when any coverage criterion has dropped by more than the

def exit_code

def exit_code
  SimpleCov::ExitCodes::MAXIMUM_COVERAGE_DROP
end

def failing?

def failing?
  violations.any?
end

def initialize(result, maximum_coverage_drop)

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

def message_for(violation)

so the failure is still visible at a glance.
natural green/yellow/red mapping. Callers color the whole line red
The "drop percent" is a delta, not a coverage level — it has no
def message_for(violation)
  format(
    "%<criterion>s coverage has dropped by %<drop_percent>.2f%% since the last time " \
    "(maximum allowed: %<max_drop>.2f%%).",
    criterion: violation.fetch(:criterion).capitalize,
    drop_percent: violation.fetch(:actual),
    max_drop: violation.fetch(:maximum)
  )
end

def report

def report
  violations.each { |violation| ExitCodes.print_error SimpleCov::Color.colorize(message_for(violation), :red) }
end

def violations

def violations
  @violations ||= SimpleCov::CoverageViolations.maximum_drop(@result, @maximum_coverage_drop)
end