ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Formatter --preview add trailing comma

Open hoxbro opened this issue 6 months ago • 7 comments

I have the following code:

self._edits.append(
    {"operation": "update", "id": index, "fields": list(fields), "region_fields": []}
)

Which I run with ruff format --preview and gets

self._edits.append({
    "operation": "update",
    "id": index,
    "fields": list(fields),
    "region_fields": [],
})

I would expect it to behave like this based on the new rule hug_parens_with_braces_and_square_brackets

self._edits.append({
    "operation": "update", "id": index, "fields": list(fields), "region_fields": []
})

Playground example: https://play.ruff.rs/6d3bf559-edf0-47f9-b1fd-1fc3418d7a46

hoxbro avatar Dec 06 '23 20:12 hoxbro