Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit f57c0da

Browse files
committed
Add zero lines to coverage reports
1 parent b2888eb commit f57c0da

File tree

5 files changed

+112
-10
lines changed

5 files changed

+112
-10
lines changed

src/codacy/reporter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@ def percent(s):
141141
}
142142
for line in lines:
143143
hits = int(line.attributes['hits'].value)
144-
if hits >= 1:
145-
# The API assumes 0 if a line is missing
146-
file_report['coverage'][line.attributes['number'].value] = hits
144+
file_report['coverage'][line.attributes['number'].value] = hits
147145
report['fileReports'] += [file_report]
148146

149147
report['codeLines'] = total_lines

tests/coverage-merge/coverage-merge.json

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"coverage": {
99
"4": 1,
1010
"5": 1,
11+
"6": 0,
1112
"7": 2
1213
},
1314
"filename": "src/test/resources/TestSourceFile1.scala"
@@ -16,6 +17,7 @@
1617
"total": 66,
1718
"codeLines": 3,
1819
"coverage": {
20+
"5": 0,
1921
"9": 1,
2022
"10": 1
2123
},
@@ -25,7 +27,11 @@
2527
"total": 20,
2628
"codeLines": 5,
2729
"coverage": {
28-
"2": 1
30+
"1": 0,
31+
"2": 1,
32+
"3": 0,
33+
"4": 0,
34+
"7": 0
2935
},
3036
"filename": "src/test/resources/TestSourceFile3.scala"
3137
},
@@ -34,7 +40,8 @@
3440
"codeLines": 3,
3541
"coverage": {
3642
"1": 1,
37-
"4": 1
43+
"4": 1,
44+
"5": 0
3845
},
3946
"filename": "src/codacy/__init__.py"
4047
},
@@ -70,7 +77,37 @@
7077
"51": 1,
7178
"36": 1,
7279
"34": 1,
73-
"57": 1
80+
"57": 1,
81+
"21": 0,
82+
"23": 0,
83+
"62": 0,
84+
"63": 0,
85+
"64": 0,
86+
"69": 0,
87+
"71": 0,
88+
"73": 0,
89+
"74": 0,
90+
"76": 0,
91+
"77": 0,
92+
"81": 0,
93+
"82": 0,
94+
"83": 0,
95+
"84": 0,
96+
"86": 0,
97+
"88": 0,
98+
"89": 0,
99+
"91": 0,
100+
"92": 0,
101+
"93": 0,
102+
"95": 0,
103+
"96": 0,
104+
"98": 0,
105+
"99": 0,
106+
"100": 0,
107+
"102": 0,
108+
"103": 0,
109+
"105": 0,
110+
"106": 0
74111
},
75112
"filename": "src/codacy/reporter.py"
76113
}

tests/coverage3/coverage.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"coverage": {
99
"4": 1,
1010
"5": 1,
11+
"6": 0,
1112
"7": 2
1213
},
1314
"filename": "src/test/resources/TestSourceFile1.scala"
@@ -16,6 +17,7 @@
1617
"total": 66,
1718
"codeLines": 3,
1819
"coverage": {
20+
"5": 0,
1921
"9": 1,
2022
"10": 1
2123
},
@@ -25,7 +27,11 @@
2527
"total": 20,
2628
"codeLines": 5,
2729
"coverage": {
28-
"2": 1
30+
"1": 0,
31+
"2": 1,
32+
"3": 0,
33+
"4": 0,
34+
"7": 0
2935
},
3036
"filename": "src/test/resources/TestSourceFile3.scala"
3137
}

tests/coverage4/coverage.json

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,37 @@
4343
"51": 1,
4444
"36": 1,
4545
"34": 1,
46-
"57": 1
46+
"57": 1,
47+
"21": 0,
48+
"23": 0,
49+
"62": 0,
50+
"63": 0,
51+
"64": 0,
52+
"69": 0,
53+
"71": 0,
54+
"73": 0,
55+
"74": 0,
56+
"76": 0,
57+
"77": 0,
58+
"81": 0,
59+
"82": 0,
60+
"83": 0,
61+
"84": 0,
62+
"86": 0,
63+
"88": 0,
64+
"89": 0,
65+
"91": 0,
66+
"92": 0,
67+
"93": 0,
68+
"95": 0,
69+
"96": 0,
70+
"98": 0,
71+
"99": 0,
72+
"100": 0,
73+
"102": 0,
74+
"103": 0,
75+
"105": 0,
76+
"106": 0
4777
},
4878
"filename": "src/codacy/reporter.py"
4979
}

tests/filepath/coverage.json

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"codeLines": 3,
88
"coverage": {
99
"1": 1,
10-
"4": 1
10+
"4": 1,
11+
"5": 0
1112
},
1213
"filename": "__init__.py"
1314
},
@@ -43,7 +44,37 @@
4344
"51": 1,
4445
"36": 1,
4546
"34": 1,
46-
"57": 1
47+
"57": 1,
48+
"21": 0,
49+
"23": 0,
50+
"62": 0,
51+
"63": 0,
52+
"64": 0,
53+
"69": 0,
54+
"71": 0,
55+
"73": 0,
56+
"74": 0,
57+
"76": 0,
58+
"77": 0,
59+
"81": 0,
60+
"82": 0,
61+
"83": 0,
62+
"84": 0,
63+
"86": 0,
64+
"88": 0,
65+
"89": 0,
66+
"91": 0,
67+
"92": 0,
68+
"93": 0,
69+
"95": 0,
70+
"96": 0,
71+
"98": 0,
72+
"99": 0,
73+
"100": 0,
74+
"102": 0,
75+
"103": 0,
76+
"105": 0,
77+
"106": 0
4778
},
4879
"filename": "reporter.py"
4980
}

0 commit comments

Comments
 (0)