-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
4.0 | Formally stop support for sniffs not complying with the PHPCS naming conventions #689
Comments
Does PHPCS have a deprecation mechanism that could be leveraged to make people aware of this in 3.x, and to migrate ahead of time? Maybe that could reduce the number of reports filed. |
A deprecation notice would be great and would definitely urge the external standards maintainers to fix this ahead of time. |
Good point. PHPCS doesn't have a deprecation mechanism for this, but I think this can probably be detected when loading the ruleset, which would mean we could throw a deprecation notice without impacting CS runs. I'm going to look into this. |
Yes to the plan, but I'd also like to see a code change which detects sniffs which do not confirm and refuses to load these into a ruleset, with a user-visible notice ideally. |
Just FYI: I am working on adding an "error handling" mechanism to the Principles I'm working from:
In practice this will come down to all errors being collected while the ruleset(s) are being processed and then at the end of the processing:
Non-blocking errors will not affect the exit code and not be displayed in The above will also be applied to the pre-existing errors being thrown from the The "problem" I'm running into is that the In other words, I'm currently writing a sh*tload of tests to improve the code coverage of the After that I can introduce the new error handling in v 3.12.0 and possibly combine it straight away with a deprecation notice for the type of setups being discussed in this issue. How does that sound ? |
Sounds like a great improvement! |
We have been struggling to adjust our custom sniff to the naming conventions, as we use no full featured coding standard with an XML, but directly include the class in the main configuration. Our struggle was due to these points:
I suggest the following changes to these places, now or when the naming conventions are enforced:
should become
I suggest adding a heading
Such a summarized specification of the naming convention would be enough, I think. Edit: Added hints on autoloading. |
@mk-mxp Oh, thank you, that's a nice actionlist for me to apply! I'm going to wait with updating the Wiki until I've finished the branch for this change locally (to see if I find anything else which should be included or is subtly different), but this will definitely come in very handy! |
While PHPCS currently has partial/limited support for sniff file includes of sniffs which do not comply with the PHPCS naming conventions (as outlined in the Coding Standard Tutorial), AFAICS this is more by accident than by design and I propose to formally drop support for this in PHPCS 4.0.
What does "formally drop support" mean ?
Common::getSniffCode()
method)Note: this task does not have to be completed for the 4.0 release and code covered by this task can be removed at any point in time after the 4.0 release, as long as the 4.0 task 1 (explicit mention in release notes and upgrade guide) has been executed.
Note: including sniffs by file name will still be supported, but the sniffs included MUST be in a directory structure and with a namespace and class name which comply with the PHPCS naming conventions.
Related #675, #680, #683
Opinions ?
/cc @asispts @dingo-d @fredden @GaryJones @greg0ire @kukulich @michalbundyra @Ocramius @sirbrillig @stronk7 @weierophinney @wimg
The text was updated successfully, but these errors were encountered: