-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache makes phpcbf fix unexpected sniff #3781
Comments
I can confirm this bug exists in the latest version of PHP_CodeSniffer, and also in the When running with When running with So far so good. When the "full" report is used, all is well as the cache gets all the errors and the "full" report only shows the errors/warnings for the requested sniff(s) (not the whole ruleset). PHP_CodeSniffer/src/Ruleset.php Lines 198 to 202 in c6c65ca
PHP_CodeSniffer/src/Files/LocalFile.php Lines 145 to 151 in c6c65ca
In order to generate the "diff" report, or when running When a sniff calls So far so good. Now for the bug: PHP_CodeSniffer/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php Lines 595 to 601 in c6c65ca
|
Describe the bug
I ran phpcbf with
--sniffs
option.$ vendor/bin/phpcbf --sniffs=Generic.PHP.DisallowShortOpenTag /path/to/files
I expected this command to only fix
Generic.PHP.DisallowShortOpenTag
, but some other errors are fixed too.Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs --report=diff --sniffs=Generic.PHP.DisallowShortOpenTag --cache=.phpcs-cache test.php
Expected behavior
Indentation of line 5 should not be fixed.
Removing
--cache
solves the problem.Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: