From 3a2fb3584b291b7a67f38b57da17b50d07d9e1d9 Mon Sep 17 00:00:00 2001 From: skatika Date: Wed, 16 Dec 2020 15:52:48 -0500 Subject: [PATCH] Refactor common code --- pkg/config/exemptions.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/config/exemptions.go b/pkg/config/exemptions.go index 2f4135257..01829bf9e 100644 --- a/pkg/config/exemptions.go +++ b/pkg/config/exemptions.go @@ -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