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

First pass at passing in error and warning severity to phpcs #57

Closed david-binda closed 2 years ago

david-binda commented 2 years ago

Passing in the --warning-severity and --error-severity flags to phpcs is rather straightforward, however we need to take into consideration the caching layer.

It currently uses the standard as a cache key, and it definitelly should take into consideration different severity settings. To make sure the existing cache is backward compatible with the one created by previous version of phpcs-changed, we can map the default severity ('5') to a standard run w/o severity settings.

I think that simply appending the warning and error severity value to the standard used in the key can make it work.

fixes #56

sirbrillig commented 2 years ago

I like the approach. I don't mind the overloading of the 'standard' key. Anyway, if I'm thinking about this correctly the worst case scenario is that the cache is invalidated too often, which is not a terrible problem.