From aaa54cc401e876e4bdb957e39113a1b7150a1928 Mon Sep 17 00:00:00 2001 From: Bader Boland Date: Fri, 31 Jan 2020 12:57:26 -0500 Subject: [PATCH] Directly return 0 for divide by 0 --- pkg/validator/summary.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/validator/summary.go b/pkg/validator/summary.go index 4f0b1211..19e5198e 100644 --- a/pkg/validator/summary.go +++ b/pkg/validator/summary.go @@ -18,7 +18,7 @@ type CountSummaryByCategory map[string]CountSummary func (cs CountSummary) GetScore() uint { total := (cs.Successes * 2) + cs.Warnings + (cs.Errors * 2) if total == 0 { - total = 1 // Prevent divide by 0. + return 0 // Prevent divide by 0. } return uint((float64(cs.Successes*2) / float64(total)) * 100) }