From 4bc8155131c50e86202dd4e990a7b8a815b25b07 Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Fri, 4 Feb 2022 05:21:09 -0800 Subject: [PATCH] Avoid printing metrics as float point numbers (#794) The metrics in the output was displaying counts as floats instead of integers. For example, 15.0 instead of 15. This is due to a divide call using '/' instead of '//' which rounds down the answer. We shouldn't have fractional number results anyway since the counts are always divisible by the rank values. Signed-off-by: Eric Brown --- bandit/core/metrics.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bandit/core/metrics.py b/bandit/core/metrics.py index 14d50d27b..b26d95d82 100644 --- a/bandit/core/metrics.py +++ b/bandit/core/metrics.py @@ -85,7 +85,8 @@ def _get_issue_counts(scores): if label not in issue_counts: issue_counts[label] = 0 count = ( - score[criteria][i] / constants.RANKING_VALUES[rank] + score[criteria][i] + // constants.RANKING_VALUES[rank] ) issue_counts[label] += count return issue_counts