From 7f5b50cd0d0e7e6930ca2756bc99cae1ffbe18ee Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Sun, 1 Nov 2015 03:45:44 +0100 Subject: [PATCH] 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. --- gitinspector/output/metricsoutput.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gitinspector/output/metricsoutput.py b/gitinspector/output/metricsoutput.py index af6b7ac..ebf31ee 100644 --- a/gitinspector/output/metricsoutput.py +++ b/gitinspector/output/metricsoutput.py @@ -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):