Class: Evilution::Reporter::CLI::LineFormatters::UnresolvedRateWarning
- Inherits:
-
Object
- Object
- Evilution::Reporter::CLI::LineFormatters::UnresolvedRateWarning
- Defined in:
- lib/evilution/reporter/cli/line_formatters/unresolved_rate_warning.rb
Overview
EV-z7f5 / GH #1325: unresolved mutations are excluded from ‘score_denominator`, so a run whose specs could not be auto-resolved collapses to a bare “Score: 0.00% (0/0)” that reads like a genuine mutation-quality failure. This formatter surfaces a loud, actionable warning when the unresolved rate is high — and a distinct message when the denominator hit zero (nothing was measured at all) — so the user knows to pass –spec instead of trusting the 0.0.
Sibling of ErrorRateWarning (EV-nrgw / GH #1168).
Constant Summary collapse
- DEFAULT_THRESHOLD =
0.25- HINT =
"Pass --spec to point evilution at the test file(s)."
Instance Method Summary collapse
- #format(summary) ⇒ Object
-
#initialize(threshold: DEFAULT_THRESHOLD) ⇒ UnresolvedRateWarning
constructor
A new instance of UnresolvedRateWarning.
Constructor Details
#initialize(threshold: DEFAULT_THRESHOLD) ⇒ UnresolvedRateWarning
Returns a new instance of UnresolvedRateWarning.
18 19 20 |
# File 'lib/evilution/reporter/cli/line_formatters/unresolved_rate_warning.rb', line 18 def initialize(threshold: DEFAULT_THRESHOLD) @threshold = threshold end |
Instance Method Details
#format(summary) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/evilution/reporter/cli/line_formatters/unresolved_rate_warning.rb', line 22 def format(summary) return nil if summary.total.zero? return nil if summary.unresolved.zero? rate = summary.unresolved.to_f / summary.total return nil if rate <= @threshold fraction = "#{summary.unresolved}/#{summary.total}" pct = (rate * 100).round(1) warning(summary, fraction, pct) end |