Skip to content

Commit 62fe2c9

Browse files
byrnedoldez
authored andcommitted
Added to junit failureXml, print content according to 'https://www.ibm.com/docs/en/developer-for-zos/14.1.0?topic=formats-junit-xml-format'
1 parent 9eef164 commit 62fe2c9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/printers/junitxml.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package printers
33
import (
44
"context"
55
"encoding/xml"
6+
"fmt"
67
"io"
78
"strings"
89

@@ -31,6 +32,7 @@ type testCaseXML struct {
3132

3233
type failureXML struct {
3334
Message string `xml:"message,attr"`
35+
Type string `xml:"type,attr"`
3436
Content string `xml:",cdata"`
3537
}
3638

@@ -57,8 +59,10 @@ func (p JunitXML) Print(ctx context.Context, issues []result.Issue) error {
5759
Name: i.FromLinter,
5860
ClassName: i.Pos.String(),
5961
Failure: failureXML{
62+
Type: i.Severity,
6063
Message: i.Pos.String() + ": " + i.Text,
61-
Content: i.Pos.String() + ": " + i.Text + "\n" + strings.Join(i.SourceLines, "\n"),
64+
Content: fmt.Sprintf("%s: %s\nCategory: %s\nFile: %s\nLine: %d\nDetails: %s",
65+
i.Severity, i.Text, i.FromLinter, i.Pos.Filename, i.Pos.Line, strings.Join(i.SourceLines, "\n")),
6266
},
6367
}
6468

0 commit comments

Comments
 (0)