php-actions / phpcs

Run PHP Code Sniffer tests in Github Actions.
9 stars 1 forks source link

Specify `--runtime-set` to complete with warnings #2

Open LennyN95 opened 3 weeks ago

LennyN95 commented 3 weeks ago

First of all, thank you for providing this extension. Assuming it is still maintained, I'd like to motivate to integrate a way to set configurations for phpcs.

As discussed in https://github.com/squizlabs/PHP_CodeSniffer/issues/262, phpcs fails with a non-zero error code even if there are only warnings. As many others, for our CI, we want errors to be displayed (so setting the severity is not an option) but the pipeline to succeed as long as there are no errors.

This has been implemented to phpcs (see https://github.com/squizlabs/PHP_CodeSniffer/issues/262#issuecomment-420099507) and can be specified with an cli argument:

phpcs --runtime-set ignore_warnings_on_exit 1
phpcs --runtime-set ignore_errors_on_exit 1

phpcs --config-set ignore_warnings_on_exit 1
phpcs --config-set ignore_errors_on_exit 1

It would be helpful to either have distinct boolean parameters, e.g. fail_on_warnings: true and fail_on_error: true or a more general config: [] prameter to specify --config-set from this action.

LennyN95 commented 3 weeks ago

Now I see that there is an option args that I overlooked before. Although args: --runtime-set ignore_warnings_on_exit 1 is sufficient, a separate option might make it easier to use, because I think that aborting on warnings is not the generally desired behavior in CI pipelines.

g105b commented 4 days ago

Hi! Yes it's still maintained, and I use it every day for my development, but currently my free time is very limited on open source contributions. I'd love to do more open source work, but I've yet to find a way to get it to pay the bills!

That being said, I will certainly look at adding a specific option for this, as I'd like to keep this Github Action the best it can possibly be.

Thanks for your input raising this issue. I'll address it when I get some time aside.

g105b commented 4 days ago

Oh! It looks like you're already ahead of me! I should have checked the other issues and PRs before answering :)