Refactor common code

This commit is contained in:
skatika
2020-12-16 15:52:48 -05:00
parent 6b7ccdadc4
commit 3a2fb3584b

View File

@@ -18,18 +18,16 @@ func (conf Configuration) IsActionable(ruleID, namespace, controllerName string)
continue
}
checkIfActionable := false
for _, rule := range example.Rules {
if rule != ruleID {
continue
}
for _, controller := range example.ControllerNames {
if strings.HasPrefix(controllerName, controller) {
return false
}
}
checkIfActionable = true
break
}
if len(example.Rules) == 0 {
if len(example.Rules) == 0 || checkIfActionable {
for _, controller := range example.ControllerNames {
if strings.HasPrefix(controllerName, controller) {
return false