Skip to content

Commit 8c5b1e5

Browse files
authored
Merge pull request #1579 from dgageot/fix-metric
Fix cagent eval metric
2 parents cdd5b3b + f48ac28 commit 8c5b1e5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/evaluation/scoring.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ func printMetric(out io.Writer, label string, passed, total int) {
128128
}
129129

130130
func printMetricFloat(out io.Writer, label string, passed, total float64) {
131-
ratio := 0.0
132-
if total > 0 {
133-
ratio = passed / total
131+
if total == 0 {
132+
return // Skip metrics with no data
134133
}
134+
ratio := passed / total
135135
fmt.Fprintf(out, "%s %14s: %.0f/%.0f passed (%.1f%%)\n", statusIcon(ratio), label, passed, total, ratio*100)
136136
}
137137

0 commit comments

Comments
 (0)