-
-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Is your feature request related to a problem?
PR #60 introduced a new Performance report to measure sniff performance during a scan.
This new report will never give reliable/accurate results if the scan is run with caching turned on as the caching feature will lead to unchanged files being skipped in the scan in favour of re-using the cached results.
Describe the solution you'd like
The cache feature should automatically be turned off when the Performance report is requested (or is one of the requested reports).
Additional context (optional)
I've had a quick look at turning caching off automatically when the Performance report is requested, but this is not as straight-forward as it sounds as it is not clear-cut where the change should be made/how it should be implemented.
There are a number of things to take into account:
Config::$overriddenDefaultsshould still be accurate.- CLI arguments can be passed in any order from the command-line, which means that a check would be needed both when setting the
cacheoption, as well as when setting thereportsoption inConfig::processLongArgument(). Or a separate check would need to be done at the end of the methodConfig::setCommandLineValues()to rectify. - CLI arguments can be passed from a custom ruleset, but in that case, the
Config::setConfigData()method is used. - The
Configclass uses magic methods which include some logic, which could possible be used for this change, however, those methods can be bypassed via theConfig::setSettings()method, which could lead to theConfig::$overriddenDefaultsno longer being accurate (potential issue anyway, independently of the change proposed here) - Outside of the
Configclass, it could be an option to make the change in theRunnerclass instead. This would likely make it more reliable, but would be a hard-overrule. - The change would likely be untestable as the
cachefeature is prevented from being turn on when thePHP_CODESNIFFER_IN_TESTSconstant is defined.
- I intend to create a pull request to implement this feature.