-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatter --preview add trailing comma #9029
Comments
Black seems to leave this code unmodified in preview. |
Not entirely. Black hugs the parentheses, but formats all entries on a single line self._edits.append({
"operation": "update", "id": index, "fields": list(fields), "region_fields": []
}) The fix here should be simple, similar to what we do in
|
It seems they changed this between Stable and Main. Stable gives you the formatting I shared. Main leaves it as is. I don't like the change. Makes it rather magic and doesn't save on vertical space. |
Note: The pattern where the "huggable" fully fits on its own line seems somewhat common in Airflow's codebase apache/airflow#37355 |
Related black issue psf/black#4099 There's the option to format this as: self._edits.append(
{"operation": "update", "id": index, "fields": list(fields), "region_fields": []}
) or self._edits.append({
"operation": "update", "id": index, "fields": list(fields), "region_fields": []
}) The former probably requires the use of |
I remove this from the stable formatter milestone because we decided not to ship the hugging preview style |
I have the following code:
Which I run with
ruff format --preview
and getsI would expect it to behave like this based on the new rule
hug_parens_with_braces_and_square_brackets
Playground example: https://play.ruff.rs/6d3bf559-edf0-47f9-b1fd-1fc3418d7a46
The text was updated successfully, but these errors were encountered: