Module: SimpleCovMcp::CoverageReporter
- Defined in:
- lib/simplecov_mcp/coverage_reporter.rb
Overview
Reports files with coverage below a specified threshold. Useful for displaying low coverage files after test runs.
Class Method Summary collapse
Class Method Details
.report(threshold: 80, count: 5, model: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/simplecov_mcp/coverage_reporter.rb', line 15 module_function def report(threshold: 80, count: 5, model: nil) model ||= CoverageModel.new file_list = model.all_files(sort_order: :ascending) .select { |f| f['percentage'] < threshold } .first(count) file_list = model.relativize(file_list) return nil if file_list.empty? lines = ["\nLowest coverage files (< #{threshold}%):"] file_list.each do |f| lines << format(' %5.1f%% %s', f['percentage'], f['file']) end lines.join("\n") end |