-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[flake8-type-checking
] Stabilize quoted-type-alias
(TC008
)
#16639
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
Conversation
Summary -- Stabilizes TC008. The test was already in the right place. Test Plan -- No open issues or PRs.
CodSpeed Performance ReportMerging #16639 will degrade performances by 12.88%Comparing Summary
Benchmarks breakdown
|
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
TC008 | 9 | 9 | 0 | 0 | 0 |
Linter (preview)
✅ ecosystem check detected no linter changes.
These all look like false positives except the latchbio cases. The Zulip cases require an import that is conditional on some And the ibis case is a recursive type alias, which I think must be quoted? Possibly the rule doesn't descend into the |
Summary -- Stabilizes RUF041. The tests are already in the right place, and the docs look good. Test Plan -- 0 issues, 1 [PR] fixing nested literals and unions the day after the rule was added. No changes since then I wonder if the fix in that PR could be relevant for #16639, where I noticed a potential issue with `Union`. It could be unrelated, though. [PR]: #14641
Indeed, it would be a problem, although in order to detect this type of stuff we would need to start tracking all conditional bindings separately, not just
It's because the if branch before it also defines the same symbol, so our naïve approach to bindings assumes the So this is a similar problem to the other one, although it seems slightly easier to fix, e.g. by walking the parent statements of the the binding and reference in order to determine whether or not they are part of the same if statement, and if they are, whether or not they're part of the same branch. We would also need to do the same thing for match statements. Red knot might be better suited for detecting these types of things though, since control flow analysis could tell us which bindings are unreachable starting from our reference. |
Let's keep this rule in preview then and create a follow up issue. @dylwil3 has also done some work on control flow analysis in Ruff that might become useful here, once it's ready for prime time. |
Summary -- Stabilizes RUF041. The tests are already in the right place, and the docs look good. Test Plan -- 0 issues, 1 [PR] fixing nested literals and unions the day after the rule was added. No changes since then I wonder if the fix in that PR could be relevant for #16639, where I noticed a potential issue with `Union`. It could be unrelated, though. [PR]: #14641
Sounds good, I'll close this for now. @Daverball thank you for the additional context here and on some of these other PRs. I really appreciate it! |
Summary -- Stabilizes RUF041. The tests are already in the right place, and the docs look good. Test Plan -- 0 issues, 1 [PR] fixing nested literals and unions the day after the rule was added. No changes since then I wonder if the fix in that PR could be relevant for #16639, where I noticed a potential issue with `Union`. It could be unrelated, though. [PR]: #14641
Summary -- Stabilizes RUF041. The tests are already in the right place, and the docs look good. Test Plan -- 0 issues, 1 [PR] fixing nested literals and unions the day after the rule was added. No changes since then I wonder if the fix in that PR could be relevant for #16639, where I noticed a potential issue with `Union`. It could be unrelated, though. [PR]: #14641
Summary
Stabilizes TC008. The test was already in the right place.
Test Plan
No open issues or PRs.