-
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
Have a way to output deprecations warnings when running PHPCS #2061
Comments
PHPCS doesn't inject deprecation warnings into the error reports as that would cause build failures. The changelog tells you what to do with this sniff, which is to change the code you are using in your ruleset.xml file. The sniff will continue to work correctly until version 4, so you've got plenty of time. Once you change the code, your ruleset will only work with PHPCS 3.3.0+, so it's up to you to decide when you want to change it based on who is using your ruleset and what PHPCS version they are running. |
Thanks for your quick response! I would like to update the version of PHPCS naturally without confirming the changelog. For example, deprecation warnings are very useful when using PHPCS that updated automatically. Is it possible to display warning messages without failing the build?
|
I could certainly do that, but I couldn't guarantee that it wouldn't fail builds or generate loads of emails to admins via cron. It's basically a BC break and would need to wait for version 4 anyway. I'll turn this into a feature request for that and put it in the 4.0 backlog. I'm not sure I'll build it, but someone else might pick it up if not. |
Hi @gsherwood, I'm working on this like the following: After implementation is complete, can I open a pull request? |
I'm not sure if that's the best way of achieving deprecation warnings. I think different types of warnings would need to be considered, and possibly processed in different ways. Maybe sniffs should be able to add a deprecation warning if they detect a run is using them, or is using a specific setting. Or maybe a report class wants to add a deprecation warning for a setting it is using (or for using it at all). Or maybe the ruleset should actually hard-code all the checks for everything. I'm not really sure - I haven't had any time to think deeply about it. |
Actually, the ruleset can't have the job of checking deprecations now that I think about it some more. If it did, sniff developers would never be able to deprecate their sniffs or custom reports. |
Thanks for your advice. I will consider another way. |
Hi team,
I'm trying
Squiz.WhiteSpace.LanguageConstructSpacing
Sniff with phpcs v3.3.0. This Sniff is deprecated according to CHANGELOG.However, I cannot get deprecation warnings even if use this deprecated Sniff. I'd like to know in advance whether the current configuration will be impacted.
The following is the example:
Are there any good ideas?
Thanks for this great project.
The text was updated successfully, but these errors were encountered: