Skip to content

Checkstyle errorFormat: missing source attribute in errors #481

@hectorj

Description

@hectorj

Hi!

I'm having a small problem with the checkstyle error formatting: errors don't have a source attribute.

Example checkstyle output from phpcs:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="2.9.1">
<file name="/my/file.php">
 <error line="42" column="1" severity="error" message="The closing brace for the class must go on the next line after the body" source="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/>
</file>
</checkstyle>

Example checkstyle output from phpstan:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle>
<file name="/my/file.php">
 <error line="34" column="1" severity="error" message="Method MyNamepspace\MyClass::getId() should return int but returns string."/>
</file>
</checkstyle>

I didn't think much of it first, but it actually caused ma a problem with the "Violation Comments to GitHub" Jenkins plugin which wasn't reporting anything from phpstan.

After digging a bit, I found that the lib https://github.com/tomasbjerre/violations-lib (which this Jenkins plugin uses) considers the source attribute as mandatory.

Would it be possible to add it, even with a dummy "phpstan" value?

I am also opening an issue on the java lib to make the source attribute optional, as I am not sure which fix would be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions