Skip to content

Formatter: multiline conditionals wrap differently #7314

@DanCardin

Description

@DanCardin

Black wants to split boolean operators across lines, where they're being forced (at least here due to the comment) onto multiple lines:

some_example_var = ""
if not some_example_var or (
    # A comment in the middle
    some_example_var
    and some_example_var not in some_example_var
):
    pass

whereas ruff wants to combine them onto one line:

some_example_var = ""
if not some_example_var or (
    # A comment in the middle
    some_example_var and some_example_var not in some_example_var
):
    pass

I dont really have a preference, it was just one of 3 total formatting diffs over 30k LOC (one being a documented intentional diff).

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationformatterRelated to the formatter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions