PHPCSStandards / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
856 stars 53 forks source link

Allow phpcbf to use the cache #481

Closed fredden closed 3 months ago

fredden commented 3 months ago

Description

As part of the development process, I often find myself using phpcbf followed by phpcs in order to check that the code I've written complies with the configured coding standard for the codebase in question. I have recently also started using the --cache parameter on the command-line to speed up this process. This has a significant positive impact on the time taken for phpcs, however phpcbf seemed to take the same time as usual.

This pull request enables phpcbf to use the cache, just like phpcs does. In my use-case where I run phpcbf immediately followed by phpcs (with the same flags), the phpcs run is always very fast as it can use the cache and doesn't need to re-scan every file.

Suggested changelog entry

Types of changes

PR checklist

Fixes #485

jrfnl commented 3 months ago

@fredden Thanks for suggesting this, but I'm not terribly keen on this change (quite apart from having serious doubts about the proposed change working the way you seem to expect it would).

Let's think this through:

Now what about PHPCBF ?

All in all, this change does not fill me with confidence.

As per the CONTRIBUTING guide, maybe this topic (and all potential angles and potential problems this can cause) should be discussed in an issue instead ?

fredden commented 3 months ago

I will test this more locally. The lack of test coverage means that this sort of change is risky.

jrfnl commented 3 months ago

I will test this more locally. The lack of test coverage means that this sort of change is risky.

Exactly, which means I would not accept this change without significant test coverage being added.

jrfnl commented 3 months ago

@fredden and me discussed this PR in a call. Basically, this PR is blocked until the cache feature has proper (full) test coverage, so we can be sure nothing breaks with this change.

Closing this PR until those preliminaries are fulfilled. Once they are fulfilled, I'm perfectly happy to revisit this PR and re-open it.