Class: SimpleCov::ExitCodes::MinimumCoverageByFileCheck
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb |
Overview
Fails when any individual file falls below the configured minimum coverage for any criterion.
Class Method Summary
Instance Attribute Summary
- #failing? ⇒ Boolean readonly
Instance Method Summary
- #exit_code
- #report
- #violations private
Constructor Details
.new(result, minimum_coverage_by_file, overrides = {}) ⇒ MinimumCoverageByFileCheck
Instance Attribute Details
#failing? ⇒ Boolean (readonly)
[ GitHub ]
# File 'lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb', line 14
def failing? violations.any? end
Instance Method Details
#exit_code
[ GitHub ]# File 'lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb', line 31
def exit_code SimpleCov::ExitCodes::MINIMUM_COVERAGE end
#report
[ GitHub ]# File 'lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb', line 18
def report violations.each do |violation| warn format( "%<criterion>s coverage by file (%<actual>s) is below the expected minimum coverage " \ "(%<expected>.2f%%) in %<filename>s.", criterion: violation.fetch(:criterion).capitalize, actual: SimpleCov::Color.colorize_percent(violation.fetch(:actual)), expected: violation.fetch(:expected), filename: violation.fetch(:project_filename) ) end end
#violations (private)
[ GitHub ]# File 'lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb', line 37
def violations @violations ||= SimpleCov::CoverageViolations.minimum_by_file( @result, @minimum_coverage_by_file, @overrides ) end