1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

extend ATC result structure & logs (#2548)

Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com>
This commit is contained in:
Dominik Lendle 2021-01-28 13:06:13 +01:00 committed by GitHub
parent e60bdb94a6
commit 1c140e7cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -198,7 +198,7 @@ func parseATCResult(body []byte, atcResultFileName string) (err error) {
piperutils.PersistReportsAndLinks("abapEnvironmentRunATCCheck", "", reports, nil)
for _, s := range parsedXML.Files {
for _, t := range s.ATCErrors {
log.Entry().Error("Error in file " + s.Key + ": " + t.Key)
log.Entry().Infof("%s in file '%s': %s in line %s found by %s", t.Severity, s.Key, t.Message, t.Line, t.Source)
}
}
}
@ -373,6 +373,9 @@ type File struct {
//ATCError with message
type ATCError struct {
Key string `xml:"message,attr"`
Value string `xml:",chardata"`
Text string `xml:",chardata"`
Message string `xml:"message,attr"`
Source string `xml:"source,attr"`
Line string `xml:"line,attr"`
Severity string `xml:"severity,attr"`
}

View File

@ -236,13 +236,13 @@ func TestParseATCResult(t *testing.T) {
bodyString := `<?xml version="1.0" encoding="UTF-8"?>
<checkstyle>
<file name="testFile">
<error message="testMessage">
<error message="testMessage1" source="sourceTester" line="1" severity="error">
</error>
<error message="testMessage2">
<error message="testMessage2" source="sourceTester" line="2" severity="info">
</error>
</file>
<file name="testFile2">
<error message="testMessage3">
<error message="testMessage" source="sourceTester" line="1" severity="error">
</error>
</file>
</checkstyle>`