Populate the fixes only when autofix is not empty (#1226)

Change-Id: If4de66d1ea0fd5a179808d023fdac677437c6d5a

Signed-off-by: Cosmin Cojocar <ccojocar@google.com>
This commit is contained in:
Cosmin Cojocar 2024-09-18 13:43:01 +02:00 committed by GitHub
parent 3004932005
commit be8bd6e40b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,20 +80,23 @@ func NewTool(driver *ToolComponent) *Tool {
// NewResult instantiate a Result
func NewResult(ruleID string, ruleIndex int, level Level, message string, suppressions []*Suppression, autofix string) *Result {
return &Result{
result := &Result{
RuleID: ruleID,
RuleIndex: ruleIndex,
Level: level,
Message: NewMessage(message),
Suppressions: suppressions,
Fixes: []*Fix{
}
if len(autofix) > 0 {
result.Fixes = []*Fix{
{
Description: &Message{
Markdown: autofix,
},
},
},
}
}
return result
}
// NewMessage instantiate a Message