Skip to content

Formatter poorly(?) documented deviation: Call in right side of equality when call chain is on the left  #8180

@henribru

Description

@henribru

Black formatting:

def foo():
    for _ in range(2):
        assert AAAAAAAAAAAAAAAAAAAAAA.bbbbbb.fooo(
            aaaaaaaaaaaa=aaaaaaaaaaaa
        ).ccccc() == (len(aaaaaaaaaa) + 1) * fooooooooooo * (
            foooooo + 1
        ) * foooooo * len(
            list(foo(bar(4, foo), foo))
        )

Ruff formatting:

def foo():
    for _ in range(2):
        assert AAAAAAAAAAAAAAAAAAAAAA.bbbbbb.fooo(
            aaaaaaaaaaaa=aaaaaaaaaaaa
        ).ccccc() == (len(aaaaaaaaaa) + 1) * fooooooooooo * (
            foooooo + 1
        ) * foooooo * len(list(foo(bar(4, foo), foo)))

This seems pretty similar to https://github.com/astral-sh/ruff/blob/main/docs/formatter/black.md#call-chain-calls-break-differently, so I'm guessing it might be intentional? But the call that's being changed isn't actually part of the call chain, so if it's intentional the documentation should perhaps be rewritten slightly.

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