Fixed formatting bug in the JSON output of the metrics module.

Sections in the metrics output were not being separated with a comma,
leading to invalid JSON.
This commit is contained in:
Adam Waldenberg 2015-11-01 03:45:44 +01:00
parent 802f18e7e5
commit 7f5b50cd0d

View file

@ -107,7 +107,8 @@ class MetricsOutput(Outputable):
eloc_xml += "\t\t\t\t\"value\": " + str(i[0]) + "\n"
eloc_xml += "\t\t\t},"
else:
eloc_xml = eloc_xml[:-1]
if not self.metrics.cyclomatic_complexity:
eloc_xml = eloc_xml[:-1]
if self.metrics.cyclomatic_complexity:
for i in sorted(set([(j, i) for (i, j) in self.metrics.cyclomatic_complexity.items()]), reverse=True):
@ -116,7 +117,8 @@ class MetricsOutput(Outputable):
eloc_xml += "\t\t\t\t\"value\": " + str(i[0]) + "\n"
eloc_xml += "\t\t\t},"
else:
eloc_xml = eloc_xml[:-1]
if not self.metrics.cyclomatic_complexity_density:
eloc_xml = eloc_xml[:-1]
if self.metrics.cyclomatic_complexity_density:
for i in sorted(set([(j, i) for (i, j) in self.metrics.cyclomatic_complexity_density.items()]), reverse=True):