Skip to content

Commit

Permalink
Directly return 0 for divide by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bader Boland committed Jan 31, 2020
1 parent 51d639e commit aaa54cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/validator/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit aaa54cc

Please sign in to comment.