Skip to content

Commit 4887d6d

Browse files
Simplify declaration of categoryScore
1 parent 875c973 commit 4887d6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

engine/score/score.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ func getValidityScore(baseRiskScore float64, validationStatus secrets.Validation
105105
}
106106

107107
func GetBaseRiskScore(category ruledefine.RuleCategory, ruleType uint8) float64 {
108-
var categoryScore uint8
109-
var ok bool
108+
categoryScore, ok := CategoryScoreMap[category]
110109
// default to the lowest score if category not found, should only happen on custom rules with undefined category
111-
if categoryScore, ok = CategoryScoreMap[category]; !ok {
110+
if !ok {
112111
categoryScore = 1
113112
}
114113
return float64(categoryScore)*0.6 + float64(ruleType)*0.4

0 commit comments

Comments
 (0)