Skip to content

Commit fdc78c0

Browse files
committed
Changed failure text from json to plaintext.
1 parent 4059fac commit fdc78c0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

output/junit_xml_format.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package output
22

33
import (
4-
"encoding/json"
54
"encoding/xml"
5+
"strconv"
66

77
"github.com/GoASTScanner/gas"
88
)
@@ -51,15 +51,17 @@ func createJUnitXMLStruct(groupedData map[string][]*gas.Issue) JUnitXMLReport {
5151
Tests: len(issues),
5252
}
5353
for _, issue := range issues {
54-
stacktrace, err := json.MarshalIndent(issue, "", "\t")
55-
if err != nil {
56-
panic(err)
57-
}
54+
text := "Results:\n"
55+
text += "[" + issue.File + ":" + issue.Line + "] - " +
56+
issue.What + " (Confidence: " + strconv.Itoa(int(issue.Confidence)) +
57+
", Severity: " + strconv.Itoa(int(issue.Severity)) + ")\n"
58+
text += "> " + issue.Code
59+
5860
testcase := Testcase{
5961
Name: issue.File,
6062
Failure: Failure{
6163
Message: "Found 1 vulnerability. See stacktrace for details.",
62-
Text: string(stacktrace),
64+
Text: text,
6365
},
6466
}
6567
testsuite.Testcases = append(testsuite.Testcases, testcase)

0 commit comments

Comments
 (0)