14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/slather/coverage_service/simple_output.rb', line 14
def post
total_project_lines = 0
total_project_lines_tested = 0
coverage_files.each do |coverage_file|
lines_tested = coverage_file.num_lines_tested
total_lines = coverage_file.num_lines_testable
percentage = decimal_f([coverage_file.percentage_lines_tested])
total_project_lines_tested += lines_tested
total_project_lines += total_lines
puts "#{coverage_file.source_file_pathname_relative_to_repo_root}: #{lines_tested} of #{total_lines} lines (#{percentage}%)"
end
if ci_service == :teamcity
puts "##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='%i']" % total_project_lines_tested
puts "##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='%i']" % total_project_lines
end
total_percentage = decimal_f([(total_project_lines_tested / total_project_lines.to_f) * 100.0])
puts "Tested #{total_project_lines_tested}/#{total_project_lines} statements"
puts "Test Coverage: #{total_percentage}%"
end
|