twigcs
twigcs copied to clipboard
Support github actions natively
It would be great if the ConsoleReporter could add additional output lines using the github action format when running in github actions (there is an env var to detect that). This way, violations could appear as annotations in the diff UI, but we would still have the full console report in the checks tab (which is useful when you have lots of violations, as annotations are limited and so they would not all appear if you have lots of them)
@stof, they are some reporters available. Can you show me an exemple of result for github actions ? The ecma
report is not good ?
@Ciloe see https://github.com/symfony/symfony/pull/38 which implements that in Symfony for one of its lint commands
the format looks like that:
::error file=some/file.twig, line=12, col=3::some message
Property values and the message need to escape some chars. and properties can be omitted.
the emacs
(and not ecma
) reporter won't work for that, because the format is not the same.
And as I said, these special errors should be rendered in addition to a human-readable text output (visible in the checks
tab of the PR) because annotations are limited so if you have lots of violations, you will need to check the raw logs to see them all (and having to unescape the special chars of the annotations syntax won't be human-friendly).
The pattern I saw in various tools implementing this is to output the full human-readable report, and then put all github annotations at the end. this way, you can read the report without being distracted by the annotations, and you can simply stop scrolling the logs when you reach the annotations (or jump over all of them at once).
Fixed with https://github.com/friendsoftwig/twigcs/pull/186.