From 144303dab6c15fd653dceb9ec0afadcb8bdadc9a Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Wed, 26 Feb 2014 11:57:43 +0100 Subject: [PATCH] The metrics module cyclomatic complexity density now limited to 3 decimals. --- gitinspector/metrics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitinspector/metrics.py b/gitinspector/metrics.py index 8e7b007..dfb1c54 100644 --- a/gitinspector/metrics.py +++ b/gitinspector/metrics.py @@ -138,7 +138,7 @@ class Metrics(Outputable): if metrics_logic.cyclomatic_complexity_density: print("\n" + _(CYCLOMATIC_COMPLEXITY_DENSITY_TEXT) + ":") for i in sorted(set([(j, i) for (i, j) in metrics_logic.cyclomatic_complexity_density.items()]), reverse = True): - print(_("{0} ({1} in cyclomatic complexity density)").format(i[1], str(i[0]))) + print(_("{0} ({1:.3f} in cyclomatic complexity density)").format(i[1], i[0])) def output_html(self): metrics_logic = MetricsLogic() @@ -165,7 +165,7 @@ class Metrics(Outputable): metrics_xml += "

" + _(CYCLOMATIC_COMPLEXITY_DENSITY_TEXT) + "

" for n, i in enumerate(sorted(set([(j, i) for (i, j) in metrics_logic.cyclomatic_complexity_density.items()]), reverse = True)): metrics_xml += "" if n % 2 == 1 else ">") + \ - _("{0} ({1} in cyclomatic complexity density)").format(i[1], i[0]) + "
" + _("{0} ({1:.3f} in cyclomatic complexity density)").format(i[1], i[0]) + "" metrics_xml += "" metrics_xml += "" @@ -197,7 +197,7 @@ class Metrics(Outputable): for i in sorted(set([(j, i) for (i, j) in metrics_logic.cyclomatic_complexity_density.items()]), reverse = True): eloc_xml += "\t\t\t\n" eloc_xml += "\t\t\t\t" + i[1] + "\n" - eloc_xml += "\t\t\t\t{0}\n".format(i[0]) + eloc_xml += "\t\t\t\t{0:.3f}\n".format(i[0]) eloc_xml += "\t\t\t\n" print("\t\n\t\t\n" + eloc_xml + "\t\t\n\t")