Skip to content

JUnit XML should contain more information in the failure text #2452

Closed
@philmtd

Description

@philmtd

Your feature request related to a problem? Please describe.

The JUnit XML Format specifies that the failure text should contain more context than just the wrong expression. golangci-lint only shows the wrong code expression with no context.

I'm using GitLab CI and the GitLab Build UI only shows the text of a failure, ignoring the "message" attribute. Running into linting errors results in a message like this:

Name: gosimple
Execution time: 0.00ms
System output:
	r, err := regexp.Compile("\\d+$")

The corresponding XML entry is:

<failure message="S1007: should use raw string (`...`) with regexp.Compile to avoid having to escape twice"><![CDATA[	r, err := regexp.Compile("\\d+$")]]></failure>

Without the additional information the output in the CI system is not useful on its own. As a developer I have to check the build output or run the linter locally on my machine to see the error message or suggested fix.

Describe the solution you'd like.

I'd be happy if the JUnit XML reports could be more verbose to also include the message in the text of the <failure> element. As far as I can see this is also intended in the JUnit XML specification: https://www.ibm.com/docs/en/developer-for-zos/14.1.0?topic=formats-junit-xml-format (see the example at the end)

Describe alternatives you've considered.

Scrolling through build outputs or running golangci-lint locally.

Additional context.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions