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

Formatter: boolean operator should have equal level #6068

Closed
Tracked by #6069 ...
konstin opened this issue Jul 25, 2023 · 0 comments · Fixed by #6394
Closed
Tracked by #6069 ...

Formatter: boolean operator should have equal level #6068

konstin opened this issue Jul 25, 2023 · 0 comments · Fixed by #6394
Assignees
Labels
formatter Related to the formatter

Comments

@konstin
Copy link
Member

konstin commented Jul 25, 2023

We format and in one line and break the or, even though like black we should break both

black:

if not (
    isinstance(aaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb)
    or numpy
    and isinstance(ccccccccccc, dddddd)
):
    pass

if not (
    isinstance(aaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb)
    and numpy
    or isinstance(ccccccccccc, dddddd)
):
    pass

ours:

if not (
    isinstance(aaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb)
    or numpy and isinstance(ccccccccccc, dddddd)
):
    pass

if not (
    isinstance(aaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb) and numpy
    or isinstance(ccccccccccc, dddddd)
):
    pass
@konstin konstin added the formatter Related to the formatter label Jul 25, 2023
@MichaReiser MichaReiser added this to the Formatter: Alpha milestone Jul 31, 2023
@zanieb zanieb self-assigned this Aug 2, 2023
zanieb added a commit that referenced this issue Aug 7, 2023
Closes #6068

These commits are kind of a mess as I did some stumbling around here. 

Unrolls formatting of chained boolean operations to prevent nested
grouping which gives us Black-compatible formatting where each boolean
operation is on a new line.
durumu pushed a commit to durumu/ruff that referenced this issue Aug 12, 2023
Closes astral-sh#6068

These commits are kind of a mess as I did some stumbling around here. 

Unrolls formatting of chained boolean operations to prevent nested
grouping which gives us Black-compatible formatting where each boolean
operation is on a new line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants