[ruff-0.10] [flake8-pyi] Stabilize preview-mode behaviours for custom-type-var-for-self(PYI019)#16607
Conversation
…tom-type-var-for-self` (`PYI019`)
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PYI019 | 19 | 19 | 0 | 0 | 0 |
Linter (preview)
✅ ecosystem check detected no linter changes.
|
The ecosystem hits all LGTM |
| /// | ||
| /// [PEP 673]: https://peps.python.org/pep-0673/#motivation | ||
| /// [PEP 695]: https://peps.python.org/pep-0695/ | ||
| /// [PEP-695]: https://peps.python.org/pep-0695/ |
There was a problem hiding this comment.
Should we update both PEP names. It feels somewhat inconsistent to use a - here but not for PEP 673 (I don't think we have a standard for this but I suspect that no dash is more commonly used?)
There was a problem hiding this comment.
It looks like this PEP-695 is only used in a hyphenated expression ([PEP-695]-style), which probably explains the extra dash in this one.
There was a problem hiding this comment.
yes, Brent has it exactly right. The unhyphenated form is usually preferred, so that's why "PEP 673" should remain unhyphenated in the docs above this. But PEP-695-style is a hyphenated expression, so it makes sense for the hyphen to remain there between "PEP" and "695"
…tom-type-var-for-self`(`PYI019`) (#16607) ## Summary This PR stabilizes several preview-only behaviours for `custom-typevar-for-self` (`PYI019`). Namely: - A new, more accurate technique is now employed for detecting custom TypeVars that are replaceable with `Self`. See #15888 for details. - The range of the diagnostic is now the full function header rather than just the return annotation. (Previously, the rule only applied to methods with return annotations, but this is no longer true due to the changes in the first bullet point.) - The fix is now available even when preview mode is not enabled. ## Test Plan - Existing snapshots that do not have preview mode enabled are updated - Preview-specific snapshots are removed - I'll check the ecosystem report on this PR to verify everything's as expected
…tom-type-var-for-self`(`PYI019`) (#16607) ## Summary This PR stabilizes several preview-only behaviours for `custom-typevar-for-self` (`PYI019`). Namely: - A new, more accurate technique is now employed for detecting custom TypeVars that are replaceable with `Self`. See #15888 for details. - The range of the diagnostic is now the full function header rather than just the return annotation. (Previously, the rule only applied to methods with return annotations, but this is no longer true due to the changes in the first bullet point.) - The fix is now available even when preview mode is not enabled. ## Test Plan - Existing snapshots that do not have preview mode enabled are updated - Preview-specific snapshots are removed - I'll check the ecosystem report on this PR to verify everything's as expected
Summary
This PR stabilizes several preview-only behaviours for
custom-typevar-for-self(PYI019). Namely:Self. See [flake8-pyi] Significantly improve accuracy ofPYI019if preview mode is enabled #15888 for details.Test Plan