Skip to content
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

[flake8-pyi] Fix more complex cases (PYI019) #15821

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

InSyncWithFoo
Copy link
Contributor

@InSyncWithFoo InSyncWithFoo commented Jan 30, 2025

Summary

Resolves #15798.

PYI019 is now a binding-based rule. All references to the type variable will now be replaced correctly. As a result, the fix is now safe in most cases; when that is not possible, its applicability remains display-only. Additionally, for a safe fix, comments within the fix ranges will cause it to be marked as unsafe.

Test Plan

cargo nextest run and cargo insta test.

Copy link
Contributor

github-actions bot commented Jan 30, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dylwil3 dylwil3 added the fixes Related to suggested fixes for violations label Jan 30, 2025
@AlexWaygood AlexWaygood self-assigned this Jan 31, 2025
@AlexWaygood
Copy link
Member

AlexWaygood commented Jan 31, 2025

I'd like for us to fix existing bugs such as #15849 first before extending this rule further (edit: see #15851, and #15853)

@AlexWaygood
Copy link
Member

Previously, there was also a small bug that would cause a PEP 695 type variable not to be removed correctly were it to be placed at the very end of the type parameter list. This has been fixed as well.

Could you possibly separate this out into an isolated PR? That would make it easier to see which tests are specifically for this bugfix

@InSyncWithFoo
Copy link
Contributor Author

@AlexWaygood I submitted #15854. As it happens, this PR overlaps with #15853 as well. I'll rebase this once you give the heads-up.

@AlexWaygood
Copy link
Member

I'll rebase this once you give the heads-up.

Okay, I'm done -- rebase at your leisure! Thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: More unsafe fixes for custom-type-var-return-type/PYI019
3 participants