PHP-CS-Fixer icon indicating copy to clipboard operation
PHP-CS-Fixer copied to clipboard

Add new report format for GitHub

Open 7ochem opened this issue 4 years ago • 9 comments

Feature request

There are multiple report formats, defined here.

We shall introduce new "github" report format (for GitHub Actions "workflow commands"). GitHub Actions can pickup output lines in a specific format to process them into instructions. One of these "commands" is ::error which will result in a message on the pull request file diff somewhat te same as when a real human leaves a comment on a specific line in a specific file of your PR.

Details are here: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message

Example:

Pull-Request-GH-Actions-error-pane

7ochem avatar Jan 29 '21 10:01 7ochem

I could try to make a PR for this. I was thinking of adding a new output format --format=github. Is that a good approach?

7ochem avatar Jan 29 '21 12:01 7ochem

That sounds nice ! Can we have a schema file for it, like we do for other formats?

keradus avatar Jan 31 '21 21:01 keradus

Apparently there's a new "GithubActionReporter to render annotations in a Github Action" introduced in the upcoming Symfony Console 5.3 version, which would be ideal to use, but would cause this feature only usable up from Symfony (Console) 5.3.

https://github.com/symfony/symfony/blob/5.x/src/Symfony/Component/Console/CHANGELOG.md

7ochem avatar Feb 01 '21 11:02 7ochem

Can we have a schema file for it, like we do for other formats?

I doubt there can be a schema as the format is textual and can be in between other output.

7ochem avatar Feb 01 '21 11:02 7ochem

for this to be really useful, line numbers would need to be reported, but, alas, #3601

pilif avatar Feb 01 '21 11:02 pilif

Adding a reference to https://github.com/nextcloud/server/pull/21813 where this has been achieved through checkstyle format + cs2pr tool.

for this to be really useful, line numbers would need to be reported, but, alas, #3601

Have been reading the whole discussion there 😄 Indeed, for this to be (really) useful, line numbers should be available. GitHub however also accepts line number null and will report the warnings/errors on "file level".

7ochem avatar Feb 01 '21 13:02 7ochem

feel free to propose (maybe as separated PR) a good way how to bring line-numbers in place ;)

keradus avatar Feb 02 '21 20:02 keradus

Since this issue has not had any activity within the last 90 days, I have marked it as stale.

I will close it if no further activity occurs within the next 30 days.

github-actions[bot] avatar Aug 14 '23 12:08 github-actions[bot]

FYI: Some ideas can be taken from #7089, also see #7171 (especially this comment and this conclusion).

Wirone avatar Aug 14 '23 14:08 Wirone