From 10cdf59ac9168b0be4ae4b052f7e2d9fc0ece8d8 Mon Sep 17 00:00:00 2001 From: Trishank Karthik Kuppusamy Date: Fri, 23 Feb 2024 18:24:58 -0500 Subject: [PATCH] Update rules.go Reorder common case first --- verifier/rules.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/verifier/rules.go b/verifier/rules.go index 1d1f053..364159d 100644 --- a/verifier/rules.go +++ b/verifier/rules.go @@ -143,10 +143,11 @@ func applyAttributeRules(env *cel.Env, input interpreter.Activation, rules []Con case bool: if !result { var message string - if r.Debug != "" { - message = fmt.Sprintf("%s\nin rule '%s'", r.Debug, r.Rule) - } else { + if r.Debug == "" { message = fmt.Sprintf("verification failed for rule '%s'", r.Rule) + + } else { + message = fmt.Sprintf("%s\nin rule '%s'", r.Debug, r.Rule) } if !r.Warn {