diff --git a/engine/engine.go b/engine/engine.go index 2bbec311..c2a28a01 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -492,6 +492,8 @@ func (r *ruleEngine) createViolation(conditionResponse ConditionResponse, rule R } } + rule.Labels = deduplicateLabels(rule.Labels) + return konveyor.Violation{ Description: rule.Description, Labels: rule.Labels, @@ -558,3 +560,18 @@ func matchesAllSelectors(m RuleMeta, selectors ...RuleSelector) bool { } return true } + +func deduplicateLabels(labels []string) []string { + present := map[string]bool{} + uniquelabels := []string{} + + for _, label := range labels { + if !present[label] { + present[label] = true + uniquelabels = append(uniquelabels, label) + } + } + + return uniquelabels + +}