-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[ruff] Skip tuples with slice expressions in incorrectly-parenthesized-tuple-in-subscript (RUF031)
#12768
Conversation
Probably should wait until #12762 is merged in and the subsequent merge conflicts have been resolved. |
Thanks @dylwil3! |
|
crates/ruff_linter/src/rules/ruff/rules/incorrectly_parenthesized_tuple_in_subscript.rs
Outdated
Show resolved
Hide resolved
…zed_tuple_in_subscript.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The fix being applied in this PR is very specific. But I think that's okay, because I think this syntax error can only occur due to the very specific details of literal slices inside subscripts. So I don't think the bug report reveals a deeper underlying issue that we need to fix. |
Summary
Adding parentheses to a tuple in a subscript with elements that include slice expressions causes a syntax error. For example,
d[(1,2,:)]
is a syntax error.So, when
lint.ruff.parenthesize-tuple-in-subscript = true
and the tuple includes a slice expression, we skip this check and fix.Closes #12766.