mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 12:05:52 +00:00
Changed failure text from json to plaintext.
This commit is contained in:
parent
4059facfb9
commit
fdc78c0c47
1 changed files with 8 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
|||
package output
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"strconv"
|
||||
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
@ -51,15 +51,17 @@ func createJUnitXMLStruct(groupedData map[string][]*gas.Issue) JUnitXMLReport {
|
|||
Tests: len(issues),
|
||||
}
|
||||
for _, issue := range issues {
|
||||
stacktrace, err := json.MarshalIndent(issue, "", "\t")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
text := "Results:\n"
|
||||
text += "[" + issue.File + ":" + issue.Line + "] - " +
|
||||
issue.What + " (Confidence: " + strconv.Itoa(int(issue.Confidence)) +
|
||||
", Severity: " + strconv.Itoa(int(issue.Severity)) + ")\n"
|
||||
text += "> " + issue.Code
|
||||
|
||||
testcase := Testcase{
|
||||
Name: issue.File,
|
||||
Failure: Failure{
|
||||
Message: "Found 1 vulnerability. See stacktrace for details.",
|
||||
Text: string(stacktrace),
|
||||
Text: text,
|
||||
},
|
||||
}
|
||||
testsuite.Testcases = append(testsuite.Testcases, testcase)
|
||||
|
|
Loading…
Reference in a new issue