Merge pull request #163 from wongherlung/fix-junit-failure-text

Escape html string for JUnit output
This commit is contained in:
Grant Murphy 2018-02-02 16:07:21 +10:00 committed by GitHub
commit 8b87505d97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package output
import ( import (
"encoding/xml" "encoding/xml"
htmlLib "html"
"strconv" "strconv"
"github.com/GoASTScanner/gas" "github.com/GoASTScanner/gas"
@ -35,7 +36,7 @@ func generatePlaintext(issue *gas.Issue) string {
return "Results:\n" + return "Results:\n" +
"[" + issue.File + ":" + issue.Line + "] - " + "[" + issue.File + ":" + issue.Line + "] - " +
issue.What + " (Confidence: " + strconv.Itoa(int(issue.Confidence)) + issue.What + " (Confidence: " + strconv.Itoa(int(issue.Confidence)) +
", Severity: " + strconv.Itoa(int(issue.Severity)) + ")\n" + "> " + issue.Code ", Severity: " + strconv.Itoa(int(issue.Severity)) + ")\n" + "> " + htmlLib.EscapeString(issue.Code)
} }
func groupDataByRules(data *reportInfo) map[string][]*gas.Issue { func groupDataByRules(data *reportInfo) map[string][]*gas.Issue {