-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
UP028 for multiple loops does not work #13266
Comments
I think this is because of this logic here: ruff/crates/ruff_linter/src/rules/pyupgrade/rules/yield_in_for_loop.rs Lines 98 to 112 in c3bcd5c
I.e., Ruff believes that some of the variables bound by the first loop might be referenced in the second loop, so it comes to the conclusion that it won't necessarily be safe to rewrite them as It would be possible to improve Ruff's behaviour here, I think, but it might add some complexity to our implementation |
Then you need to improve ruff's behavior |
UP028 does not work when there are multiple yield loops in a function
Code example:
https://play.ruff.rs/b9748aaf-8e8c-45cd-8138-20f41013b979
The text was updated successfully, but these errors were encountered: