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

FR: format (or lint with fix) getitem called with tuples litteral (e.g. a[(b, c)] -> a[b, c]) ? #11990

Open
neutrinoceros opened this issue Jun 23, 2024 · 3 comments
Labels
rule Implementing or modifying a lint rule

Comments

@neutrinoceros
Copy link

This is an idea for a formatting or linting rule (not sure where it would fit best). Basically I'd like ruff to drop unneeded parentheses from a[(b, c)] (into a[b, c]). This pattern comes up a lot in idiomatic yt, but there are currently no formatter (that we know of) for it, so our docs and code base have two widely spread, competing styles.
I couldn't find a similar open issue, apologies if there is.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jun 23, 2024
@charliermarsh
Copy link
Member

This seems reasonable to me as a lint rule...

@MichaReiser
Copy link
Member

I think I would even be open to add this to the formatter because it doesn't seem to change the AST

@neutrinoceros neutrinoceros changed the title FR: format (or lint with fix) getattr called with tuples litteral (e.g. a[(b, c)] -> a[b, c]) ? FR: format (or lint with fix) getitem called with tuples litteral (e.g. a[(b, c)] -> a[b, c]) ? Jun 23, 2024
@neutrinoceros
Copy link
Author

Up to you guys. I'm tempted to give it a try myself but that would be my first rust contribution ever. My personal inclination is that this would go to the formatter (as a known deviation from black ?), but I'm happy to wait for consensus for I dive in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

3 participants