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

Parenthesize breaking named expressions in match guards #9396

Merged
merged 3 commits into from
Jan 8, 2024

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Jan 5, 2024

Summary

This is an attempt to solve #9394 by avoiding breaks in named expressions when invalid.

@charliermarsh charliermarsh added bug Something isn't working formatter Related to the formatter labels Jan 5, 2024
Copy link
Contributor

github-actions bot commented Jan 5, 2024

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the same as you. Maybe parenthesze is mainly intended to use for top level expressions, not for nested sub expressions.

I haven't looked at the issue (on my phone) but this is probably something that needs solving in the case formatting or we should use in_parentheses_only_softline_break in the if expression formatting

@charliermarsh
Copy link
Member Author

Let me try in_parentheses_only_softline_break, that's interesting.

@charliermarsh
Copy link
Member Author

Ok this now looks right...

@zanieb
Copy link
Member

zanieb commented Jan 5, 2024

Nice!

@MichaReiser
Copy link
Member

Thank you

Co-authored-by: Micha Reiser <micha@reiser.io>
@charliermarsh charliermarsh enabled auto-merge (squash) January 8, 2024 14:41
@charliermarsh charliermarsh merged commit ba71772 into main Jan 8, 2024
16 checks passed
@charliermarsh charliermarsh deleted the charlie/parens branch January 8, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants