Skip to content

Invalid formatting of match statement #9394

@MSDehghan

Description

@MSDehghan

formatting below code with ruff format file.py command leads to invalid python code:

match {}:
    case {
        "long_long_long_key": str(long_long_long_key)
    } if value := "long long long long long long long long long long long value":
        pass

after formatting with ruff the file will look like this which is not a valid python code:

match {}:
    case {"long_long_long_key": str(long_long_long_key)} if value
    := "long long long long long long long long long long long value":
        pass

ruff version: 0.1.11

Metadata

Metadata

Assignees

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