Skip to content

Commit

Permalink
Fix rule type name that has no pills. (#4333)
Browse files Browse the repository at this point in the history
We recently added the possibility to display `can_remediate` and
`release_phase` pills, if available, near to rule type name. If no
pills were available, we erroneously displayed `()`.
  • Loading branch information
blkt authored Sep 2, 2024
1 parent 4c2ce8a commit e1845dc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/cli/app/ruletype/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ func appendRuleTypePropertiesToName(rt *minderv1.RuleType) string {
if rt.Def.GetRemediate() == nil {
properties = append(properties, "can_remediate: false")
}
// return the name with the properties
return fmt.Sprintf("%s (%s)", name, strings.Join(properties, ", "))

// return the name with the properties if any
if len(properties) != 0 {
return fmt.Sprintf("%s (%s)", name, strings.Join(properties, ", "))
}

// return only name otherwise
return name
}

0 comments on commit e1845dc

Please sign in to comment.