Skip to content

Commit

Permalink
Populate the fixes only when autofix is not empty (#1226)
Browse files Browse the repository at this point in the history
Change-Id: If4de66d1ea0fd5a179808d023fdac677437c6d5a

Signed-off-by: Cosmin Cojocar <ccojocar@google.com>
  • Loading branch information
ccojocar authored Sep 18, 2024
1 parent 3004932 commit be8bd6e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions report/sarif/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit be8bd6e

Please sign in to comment.