Skip to content

Commit

Permalink
Avoid printing metrics as float point numbers (#794)
Browse files Browse the repository at this point in the history
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 <browne@vmware.com>
  • Loading branch information
ericwb authored Feb 4, 2022
1 parent c405e4e commit 4bc8155
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bandit/core/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4bc8155

Please sign in to comment.