@@ -20,10 +20,14 @@ BEGIN {
2020 file = " "
2121}
2222$1 !~ /mode: / {
23- if (match ($1 ," ^" package" ([^:]+):([0-9]+).[0-9]+,([0-9]+).[0-9]+ " ,f)) {
23+ if (match ($1 ," ^" package" (.+)$ " ,f)) {
2424 if (file != " " && file != f[ 1 ] ) {
25+ # write file entry with coverage and uncovered lines
2526 fileCoverage = fileCovered/ fileStatements* 100
2627 if (lineStart != " " && lineEnd != " " ) {
28+ if (uncoveredLines != " " ) {
29+ uncoveredLines = uncoveredLines" , "
30+ }
2731 uncoveredLines = sprintf (" %s[%s-%s](%s%s#L%s-L%s)" , uncoveredLines, lineStart, lineEnd, baseUrl, file, lineStart, lineEnd)
2832 }
2933 details = sprintf (" %s|%s %.1f%|%s|%s|\n " , details, bar(fileCoverage), fileCoverage, file, uncoveredLines)
@@ -32,27 +36,32 @@ $1 !~ /mode:/ {
3236 uncoveredLines = " "
3337 lineStart = " "
3438 lineEnd = " "
35- }
39+ }
40+ # start new file coverage measuring
3641 file = f[ 1 ]
37- statements += $2
38- fileStatements += $2
39- if ($3 != " 0" ) {
40- covered += $2
41- fileCovered += $2
42+ statements += $4
43+ fileStatements += $4
44+ if ($5 != " 0" ) {
45+ # covered lines
46+ covered += $4
47+ fileCovered += $4
48+
49+ if (lineStart != " " && lineEnd != " " ) {
50+ if (uncoveredLines != " " ) {
51+ uncoveredLines = uncoveredLines" , "
52+ }
53+ uncoveredLines = sprintf (" %s[%s-%s](%s%s#L%s-L%s)" , uncoveredLines, lineStart, lineEnd, baseUrl, file, lineStart, lineEnd)
54+ lineStart = " "
55+ lineEnd = " "
56+ }
57+
4258 next
4359 }
44- if (lineStart == " " && lineEnd == " " ) {
45- lineStart = f[ 2 ]
46- lineEnd = f[ 3 ]
47- next
60+ # not covered lines
61+ if (lineStart == " " ) {
62+ lineStart = $2
4863 }
49- if (lineEnd+ 0 == f[ 2 ] + 0 || lineEnd+ 1 == f[ 2 ] + 0 ) {
50- lineEnd = f[ 3 ]
51- next
52- }
53- uncoveredLines = sprintf (" %s[%s-%s](%s%s#L%s-L%s), " , uncoveredLines, lineStart, lineEnd, baseUrl, file, lineStart, lineEnd)
54- lineStart = f[ 2 ]
55- lineEnd = f[ 3 ]
64+ lineEnd = $3
5665 }
5766}
5867END {
0 commit comments