mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
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:
parent
3004932005
commit
be8bd6e40b
1 changed files with 6 additions and 3 deletions
|
@ -80,20 +80,23 @@ func NewTool(driver *ToolComponent) *Tool {
|
||||||
|
|
||||||
// NewResult instantiate a Result
|
// NewResult instantiate a Result
|
||||||
func NewResult(ruleID string, ruleIndex int, level Level, message string, suppressions []*Suppression, autofix string) *Result {
|
func NewResult(ruleID string, ruleIndex int, level Level, message string, suppressions []*Suppression, autofix string) *Result {
|
||||||
return &Result{
|
result := &Result{
|
||||||
RuleID: ruleID,
|
RuleID: ruleID,
|
||||||
RuleIndex: ruleIndex,
|
RuleIndex: ruleIndex,
|
||||||
Level: level,
|
Level: level,
|
||||||
Message: NewMessage(message),
|
Message: NewMessage(message),
|
||||||
Suppressions: suppressions,
|
Suppressions: suppressions,
|
||||||
Fixes: []*Fix{
|
}
|
||||||
|
if len(autofix) > 0 {
|
||||||
|
result.Fixes = []*Fix{
|
||||||
{
|
{
|
||||||
Description: &Message{
|
Description: &Message{
|
||||||
Markdown: autofix,
|
Markdown: autofix,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMessage instantiate a Message
|
// NewMessage instantiate a Message
|
||||||
|
|
Loading…
Reference in a new issue