Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cs2pr support #161

Closed
staabm opened this issue Jan 24, 2020 · 10 comments · Fixed by #173
Closed

Add cs2pr support #161

staabm opened this issue Jan 24, 2020 · 10 comments · Fixed by #173
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@staabm
Copy link

staabm commented Jan 24, 2020

I recently published a tiny little script which allows to add github pull request annotations based on checkstyle formatted error reports.

see e.g.

image

this is usefull in combination with phpstan, psalm, php-cs-fixer or any other tool which supports the checkstyle format.

my tool is only usefull in github actions context and I guess will mostly be used in the php world.

what do you think about bunling the script with this great setup-php github action?
that way people could use the script very easily.

what do you think?

https://github.com/staabm/annotate-pull-request-from-checkstyle

@shivammathur
Copy link
Owner

shivammathur commented Jan 24, 2020

@staabm
I will add this, what do you think about packaging it as phar archive and adding that to releases.

Also how does cs2pr work with already existing support for problem matchers for PHPUnit.
https://github.com/shivammathur/setup-php#problem-matchers
Does this create duplicate annotations when used together.

@staabm
Copy link
Author

staabm commented Jan 24, 2020

thx for your fast feedback.

I will add this, what do you think about packaging it as phar archive and adding that to releases.

not sure if this has a benefit. the script actual is a single file:
https://github.com/staabm/annotate-pull-request-from-checkstyle/blob/master/cs2pr

do you see any advantages of having it as a phar?

Also how does cs2pr work with already existing support for problem matchers for PHPUnit.

phpunit is not supported, because it does not support the checkstyle format.

I have already discussed it with sebastian, but he does not like the idea of having checkstyle-reports in phpunit:
sebastianbergmann/phpunit#3162 (comment)

there is a small tool though, which brings the same functionality with phpunit
https://github.com/mheap/phpunit-github-actions-printer

shivammathur/setup-php#problem-matchers
Does this create duplicate annotations when used together.

never heared of this feature.. this sounds interessting.. maybe phpunit-github-actions-printer is not required then.

how does this problem-matcher work? what content is expected in phpunit.json ? how to produce this file?

@shivammathur
Copy link
Owner

shivammathur commented Jan 24, 2020

@staabm
ok. I checked the script, I agree it does not need to be packaged as phar. But please add it as an asset to the releases. Then it will be easy for me to add support for this in tools input.

Creating annotations in GitHub Actions requires a json file which has regex matching the output.
It can be added using run: echo "::add-matcher::path/to/json"

Here is the json file for creating annotations for PHPUnit.
This file is copied to ${{ runner.tool_cache }} directory by the action and can be used as described here

This comment explains each regex in the json file - #84 (comment)

@shivammathur shivammathur self-assigned this Jan 25, 2020
@shivammathur shivammathur added the enhancement New feature or request label Jan 25, 2020
@shivammathur shivammathur added this to the 2.0.0 milestone Jan 25, 2020
@tristanbes
Copy link

It would be a HUGE improvement; ❤️

@staabm
Copy link
Author

staabm commented Jan 28, 2020

Creating annotations in GitHub Actions requires a json file which has regex matching the output.
It can be added using run: echo "::add-matcher::path/to/json"

Here is the json file

thx for the additional info. wasnt aware that problem matches are a thing.

ok. I checked the script, I agree it does not need to be packaged as phar. But please add it as an asset to the releases. Then it will be easy for me to add support for this in tools input.

just added the cs2pr file to the 1.0 release. can you work with that or do you need more?

https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/tag/1.0

@shivammathur shivammathur modified the milestones: 2.0.0, 1.8.2 Jan 28, 2020
@shivammathur
Copy link
Owner

@staabm Thanks. will add support in next release.

@tristanbes
Copy link

If possible, provide some example @shivammathur in the documentation;

Thank you guys about this.

@shivammathur shivammathur added this to In progress in setup-php-tasks Jan 30, 2020
@shivammathur shivammathur mentioned this issue Feb 2, 2020
setup-php-tasks automation moved this from In progress to Done Feb 2, 2020
@shivammathur
Copy link
Owner

@staabm Now you can specify cs2pr in tools input. See here for an example.

@staabm
Copy link
Author

staabm commented Feb 3, 2020

Thank you

@staabm
Copy link
Author

staabm commented Feb 6, 2020

works like a charm <2. thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants