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
|
package output
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/GoASTScanner/gas"
|
"github.com/GoASTScanner/gas"
|
||||||
)
|
)
|
||||||
|
@ -51,15 +51,17 @@ func createJUnitXMLStruct(groupedData map[string][]*gas.Issue) JUnitXMLReport {
|
||||||
Tests: len(issues),
|
Tests: len(issues),
|
||||||
}
|
}
|
||||||
for _, issue := range issues {
|
for _, issue := range issues {
|
||||||
stacktrace, err := json.MarshalIndent(issue, "", "\t")
|
text := "Results:\n"
|
||||||
if err != nil {
|
text += "[" + issue.File + ":" + issue.Line + "] - " +
|
||||||
panic(err)
|
issue.What + " (Confidence: " + strconv.Itoa(int(issue.Confidence)) +
|
||||||
}
|
", Severity: " + strconv.Itoa(int(issue.Severity)) + ")\n"
|
||||||
|
text += "> " + issue.Code
|
||||||
|
|
||||||
testcase := Testcase{
|
testcase := Testcase{
|
||||||
Name: issue.File,
|
Name: issue.File,
|
||||||
Failure: Failure{
|
Failure: Failure{
|
||||||
Message: "Found 1 vulnerability. See stacktrace for details.",
|
Message: "Found 1 vulnerability. See stacktrace for details.",
|
||||||
Text: string(stacktrace),
|
Text: text,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
testsuite.Testcases = append(testsuite.Testcases, testcase)
|
testsuite.Testcases = append(testsuite.Testcases, testcase)
|
||||||
|
|
Loading…
Reference in a new issue