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

Do not generate diff in case new version of the file include no lint issues #53

Closed david-binda closed 2 years ago

david-binda commented 2 years ago

Another micro optimisation which I noticed while working on tests.

Currently we lint old file, new file, generate diff, and finally calculate what messages are new. With #51 we'll skip the old file linting saving some time consuming command in case new file contains no lint.

But, when we know that there are no lint issues in the new version of a file, we even don't need to generate diff, since it's not really needed.

Not that git diff would consume that much time, but can save some precious seconds when running over a huge number of files.