Skip to content

Brace spacing when formatting f-strings is not idempotent #15535

@dscorbett

Description

@dscorbett

Formatting an f-string is not idempotent in Ruff 0.9.2 for an unparenthesized tuple whose first and only element starts with a brace.

$ printf 'f"{ {}, }"\n' | ruff format --isolated -
f"{ ({},) }"

$ printf 'f"{ {}, }"\n' | ruff format --isolated - | ruff format --isolated -
f"{({},)}"

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