Class: Evilution::Reporter::CLI::LineFormatters::ErrorRateWarning
- Inherits:
-
Object
- Object
- Evilution::Reporter::CLI::LineFormatters::ErrorRateWarning
- Defined in:
- lib/evilution/reporter/cli/line_formatters/error_rate_warning.rb
Overview
EV-nrgw / GH #1168: Score is ‘killed / score_denominator` where `score_denominator = total - errors - neutral - equivalent - unresolved - unparseable` — errors are excluded from the denominator entirely. A run can read PASS at 100% while 16 of 19 mutations silently errored. This formatter surfaces a warning right under the metrics block when the error rate crosses the threshold so the silent failure mode becomes loud.
Constant Summary collapse
- DEFAULT_THRESHOLD =
0.25
Instance Method Summary collapse
- #format(summary) ⇒ Object
-
#initialize(threshold: DEFAULT_THRESHOLD) ⇒ ErrorRateWarning
constructor
A new instance of ErrorRateWarning.
Constructor Details
#initialize(threshold: DEFAULT_THRESHOLD) ⇒ ErrorRateWarning
Returns a new instance of ErrorRateWarning.
14 15 16 |
# File 'lib/evilution/reporter/cli/line_formatters/error_rate_warning.rb', line 14 def initialize(threshold: DEFAULT_THRESHOLD) @threshold = threshold end |
Instance Method Details
#format(summary) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/evilution/reporter/cli/line_formatters/error_rate_warning.rb', line 18 def format(summary) return nil if summary.total.zero? return nil if summary.errors.zero? rate = summary.errors.to_f / summary.total return nil if rate <= @threshold pct = (rate * 100).round(1) "! High error rate: #{summary.errors}/#{summary.total} (#{pct}%) mutations errored — " \ "score may be unreliable. See the \"Errored mutations:\" section for the underlying cause." end |