Class: Evilution::Reporter::CLI::LineFormatters::ErrorRateWarning Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/reporter/cli/line_formatters/error_rate_warning.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

0.25

Instance Method Summary collapse

Constructor Details

#initialize(threshold: DEFAULT_THRESHOLD) ⇒ ErrorRateWarning

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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