Skip to content

Formatter: Parenthesized expression with comment on right hand side in assignment produces invalid syntax #19350

Open
@MichaReiser

Description

@MichaReiser
variable = (
    (something)  # a comment
    .fist_method("some string")
)

gets reformatted to

variable = (something)  # a comment
.fist_method("some string")

which is a syntax error, so there's a bug in ruff here.

Originally posted by @olofahlen in #8598

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingformatterRelated to the formatter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions