6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/simplecov-summary.rb', line 6
def format(result)
puts "SimpleCov stats:"
name_length = (result.groups.keys + ["Total"]).map{|x| x.length}.max
result.groups.each do |name, files|
percentage = files.covered_percent.round(2)
color = case percentage
when 90..100
:green
when 80..90
:yellow
else
:red
end
puts " #{name.rjust(name_length)}: #{percentage}%".colorize(color)
end
puts " #{'Total'.rjust(name_length)}: #{result.covered_percent.round(2)}%"
end
|