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 arc-lint option and improve some git performance #49

Closed david-binda closed 2 years ago

david-binda commented 2 years ago

A collection of performance improvements:

  1. introduce --arc-lint flag to allow the phpcs-changed command to not check on whether a file is under git revision control, since it's being done by arcanist beforehand, so the extra check is not really needed then
  2. introduce a new function for checking on whether the command was run from the git's root, allowing us to not use the extra git ls-files command for obtaining a file path relative to git root, when it's not needed
  3. use --porcelain flag instead of --short for git status check, as it's more future proof option
  4. only calculate the object hash in case the cache is actually being used, since it otherwise adds some overhead
david-binda commented 2 years ago

Thanks for thorough review and feedback. All great suggestions, and I have, hopefully, addressed it all.