From d5c8d7170499244b77a33d353fd5caef774bf6ce Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 17 May 2024 17:01:22 +0200 Subject: [PATCH] remove unused methods; drop else branch --- pkg/models/helpers.go | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/pkg/models/helpers.go b/pkg/models/helpers.go index aedd330fda7..bd7ac62926d 100644 --- a/pkg/models/helpers.go +++ b/pkg/models/helpers.go @@ -15,22 +15,12 @@ const ( CscliImportOrigin = "cscli-import" ) -func (a *Alert) HasRemediation() bool { - return true -} - func (a *Alert) GetScope() string { - if a.Source.Scope == nil { - return "" - } - return *a.Source.Scope + return a.Source.GetScope() } func (a *Alert) GetValue() string { - if a.Source.Value == nil { - return "" - } - return *a.Source.Value + return a.Source.GetValue() } func (a *Alert) GetScenario() string { @@ -154,17 +144,15 @@ func (a *Alert) FormatAsStrings(machineID string, logger *log.Logger) []string { reason = fmt.Sprintf("%s for %d/%d decisions", msg, i+1, len(a.Decisions)) } - var machineIDOrigin string - if machineID == "" { - machineIDOrigin = *decisionItem.Origin - } else { - machineIDOrigin = fmt.Sprintf("%s/%s", machineID, *decisionItem.Origin) + origin := *decisionItem.Origin + if machineID != "" { + origin = machineID + "/" + origin } decision += fmt.Sprintf("%s %s on %s %s", *decisionItem.Duration, *decisionItem.Type, *decisionItem.Scope, *decisionItem.Value) retStr = append(retStr, - fmt.Sprintf("(%s) %s : %s", machineIDOrigin, reason, decision)) + fmt.Sprintf("(%s) %s : %s", origin, reason, decision)) } return retStr