[flake8-pyi] Rename PYI019 and improve its diagnostic message#15885
Merged
AlexWaygood merged 1 commit intomainfrom Feb 3, 2025
Merged
[flake8-pyi] Rename PYI019 and improve its diagnostic message#15885AlexWaygood merged 1 commit intomainfrom
flake8-pyi] Rename PYI019 and improve its diagnostic message#15885AlexWaygood merged 1 commit intomainfrom
Conversation
Contributor
|
Member
Author
|
Strange, I would have expected some ecosystem hits here... |
9f000d7 to
1206408
Compare
This was referenced Feb 2, 2025
MichaReiser
approved these changes
Feb 3, 2025
Member
|
I assume you meant that we have to set up the redirect with the next release, whether it is a patch or minor release. |
Member
Author
Correct, thank you! I'll update the PR description (edit: now updated) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently the name of
PYI019iscustom-type-var-return-typeand its diagnostic message is:There are two issues that this PR addresses:
Selfrather than a customTypeVar, you'll need to change other annotations in the method's non-self parameters, not just theselfannotation and the return annotation. Indeed, our preview-mode autofix for stub files will change some of these annotations. But the message and name imply that the rule is just about the return annotation.I think the changes here should all be backwards-compatible, but we'll need to remember to add a redirect for the documentation after the next release (whether it is a minor release or patch release). In my opinion, the diagnostic's range should also cover the whole of the function's header, but this would be backwards-incompatible, so I'll propose it separately (it will either need to be preview-only or wait until the next minor release).
Test Plan
cargo test -p ruff_linter --lib