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

Commit 151e51a

Browse files
committed
Merge pull request #13 from codacy/fix-coverage-int
Fix coverage totals to int
2 parents a6fc38f + 53917e0 commit 151e51a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/codacy/reporter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
from xml.dom import minidom
88
import requests
9+
from math import floor
910

1011
logging.basicConfig(level=logging.INFO,
1112
format='%(asctime)s - %(levelname)s - %(message)s')
@@ -61,7 +62,7 @@ def parse_report_file(report_file):
6162

6263
# Convert decimal string to floored int percent value
6364
def percent(s):
64-
return float(s) * 100
65+
return int(floor(float(s) * 100))
6566

6667
# Parse the XML into the format expected by the API
6768
report_xml = minidom.parse(report_file)

tests/coverage4/coverage.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"total": 50.0,
2+
"total": 50,
33
"fileReports": [
44
{
5-
"total": 66.67,
5+
"total": 66,
66
"coverage": {
77
"1": 1,
88
"4": 1
99
},
1010
"filename": "src/codacy/__init__.py"
1111
},
1212
{
13-
"total": 49.15,
13+
"total": 49,
1414
"coverage": {
1515
"50": 1,
1616
"60": 1,

tests/filepath/coverage.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"total": 50.0,
2+
"total": 50,
33
"fileReports": [
44
{
5-
"total": 66.67,
5+
"total": 66,
66
"coverage": {
77
"1": 1,
88
"4": 1
99
},
1010
"filename": "src/codacy/__init__.py"
1111
},
1212
{
13-
"total": 49.15,
13+
"total": 49,
1414
"coverage": {
1515
"50": 1,
1616
"60": 1,

0 commit comments

Comments
 (0)