Skip to content

Commit be8bd6e

Browse files
authored
Populate the fixes only when autofix is not empty (#1226)
Change-Id: If4de66d1ea0fd5a179808d023fdac677437c6d5a Signed-off-by: Cosmin Cojocar <ccojocar@google.com>
1 parent 3004932 commit be8bd6e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

report/sarif/builder.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,23 @@ func NewTool(driver *ToolComponent) *Tool {
8080

8181
// NewResult instantiate a Result
8282
func NewResult(ruleID string, ruleIndex int, level Level, message string, suppressions []*Suppression, autofix string) *Result {
83-
return &Result{
83+
result := &Result{
8484
RuleID: ruleID,
8585
RuleIndex: ruleIndex,
8686
Level: level,
8787
Message: NewMessage(message),
8888
Suppressions: suppressions,
89-
Fixes: []*Fix{
89+
}
90+
if len(autofix) > 0 {
91+
result.Fixes = []*Fix{
9092
{
9193
Description: &Message{
9294
Markdown: autofix,
9395
},
9496
},
95-
},
97+
}
9698
}
99+
return result
97100
}
98101

99102
// NewMessage instantiate a Message

0 commit comments

Comments
 (0)