Class: SimpleCov::ExitCodes::Check
- Inherits:
-
Object
- Object
- SimpleCov::ExitCodes::Check
- Defined in:
- lib/simplecov/exit_codes/check.rb
Overview
Shared skeleton for the threshold checks. Subclasses supply exit_code,
compute_violations (memoized here, since failing? and report_lines
both consult it), and violation_lines.
Direct Known Subclasses
BaselineCheck, MaximumCoverageDropCheck, MaximumMissedCheck, MaximumMissedPerFileCheck, MaximumOverallCoverageCheck, MinimumCoverageByFileCheck, MinimumCoverageByGroupCheck, MinimumOverallCoverageCheck
Instance Method Summary collapse
- #failing? ⇒ Boolean
-
#initialize(result, thresholds) ⇒ Check
constructor
A new instance of Check.
- #report ⇒ Object
-
#report_lines ⇒ Object
Concatenated rather than flat-mapped: a check answering a bare string instead of its list of lines is an error this raises, not a spelling the flattening would forgive.
- #violations ⇒ Object
Constructor Details
#initialize(result, thresholds) ⇒ Check
Returns a new instance of Check.
9 10 11 12 |
# File 'lib/simplecov/exit_codes/check.rb', line 9 def initialize(result, thresholds) @result = result @thresholds = thresholds end |
Instance Method Details
#failing? ⇒ Boolean
14 15 16 |
# File 'lib/simplecov/exit_codes/check.rb', line 14 def failing? violations.any? end |
#report ⇒ Object
30 31 32 |
# File 'lib/simplecov/exit_codes/check.rb', line 30 def report report_lines.each { |line| ExitCodes.print_error(line) } end |
#report_lines ⇒ Object
Concatenated rather than flat-mapped: a check answering a bare string instead of its list of lines is an error this raises, not a spelling the flattening would forgive.
25 26 27 28 |
# File 'lib/simplecov/exit_codes/check.rb', line 25 def report_lines lines = [] #: Array[String] violations.each_with_object(lines) { |violation, into| into.concat(violation_lines(violation)) } end |
#violations ⇒ Object
18 19 20 |
# File 'lib/simplecov/exit_codes/check.rb', line 18 def violations @violations ||= compute_violations end |