sirbrillig / phpcs-changed

🐘 Run phpcs on files and only report new warnings/errors compared to the previous version.
MIT License
31 stars 11 forks source link

Add severity settings for being passed to phpcs #56

Closed david-binda closed 2 years ago

david-binda commented 2 years ago

Tangentially related to #26 , but now targeted at severity options.

In case a project is not really interested in addressing all warnings, but only cares about errors (or warnings / errors at certain severity only), then the optimisations added in #51 and #54 might not operate at highest possible level, as phpcs would report all messages no matter what severity is actually being used by the project.

The same, however goes the other way round, some project might want to hear about issues with lower severity, than the default value of 5.

I'd like to propose adding at least --warning-severity and --error-severity flags to phpcs-changed, which would be passed, unchanged, to phpcs.

While phpcs also have -n as shorthand to --warning-severity=0 and --severity= for setting both, --warning-severity and --error-severity, we introducing the only two mentioned would still allow proper configuration to match phpcs settings, yet w/o shorthands.