Class: Covered::BriefSummary

Inherits:
Summary
  • Object
show all
Defined in:
lib/covered/brief_summary.rb

Overview

Generates a short coverage report with the least-covered files.

Instance Method Summary collapse

Methods inherited from Summary

#each, #initialize, #print_annotations, #print_coverage, #print_error, #print_line, #print_line_header, #terminal

Constructor Details

This class inherits a constructor from Covered::Summary

Instance Method Details

#call(wrapper, output = $stdout, before: 4, after: 4) ⇒ Object

Print aggregate statistics and the files with the most missing lines.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/covered/brief_summary.rb', line 16

def call(wrapper, output = $stdout, before: 4, after: 4)
	terminal = self.terminal(output)
	
	ordered = []
	
	statistics = self.each(wrapper) do |coverage|
		ordered << coverage unless coverage.complete?
	end
	
	terminal.puts
	statistics.print(output)
	
	if ordered.any?
		terminal.puts "", "Least Coverage:"
		ordered.sort_by!(&:missing_count).reverse!
		
		ordered.first(5).each do |coverage|
			path = wrapper.relative_path(coverage.path)
			
			terminal.write path, style: :brief_path
			terminal.puts ": #{coverage.missing_count} lines not executed!"
		end
	end
end