Skip to content

Avoid trailing comma for single-argument with positional separator#9076

Merged
charliermarsh merged 1 commit intomainfrom
charlie/comma
Dec 9, 2023
Merged

Avoid trailing comma for single-argument with positional separator#9076
charliermarsh merged 1 commit intomainfrom
charlie/comma

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

In #8921, we changed our parameter formatting behavior to add a trailing comma whenever a single-argument function breaks. This introduced a deviation in the case that a function contains a single argument, but also includes a positional-only or keyword-only separator.

Closes #9074.

@charliermarsh charliermarsh added bug Something isn't working formatter Related to the formatter labels Dec 9, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 9, 2023

ruff-ecosystem results

Formatter (stable)

ℹ️ ecosystem check detected format changes. (+2 -3 lines in 1 file in 41 projects)

zulip/zulip (+2 -3 lines across 1 file)

zerver/lib/message.py~L1249

 
 
 def aggregate_pms(
-    *,
-    input_dict: Dict[int, RawUnreadDirectMessageDict],
+    *, input_dict: Dict[int, RawUnreadDirectMessageDict]
 ) -> List[UnreadDirectMessageInfo]:
     lookup_dict: Dict[int, UnreadDirectMessageInfo] = {}
     for message_id, attribute_dict in input_dict.items():

Formatter (preview)

ℹ️ ecosystem check detected format changes. (+2 -3 lines in 1 file in 41 projects)

zulip/zulip (+2 -3 lines across 1 file)

ruff format --preview

zerver/lib/message.py~L1249

 
 
 def aggregate_pms(
-    *,
-    input_dict: Dict[int, RawUnreadDirectMessageDict],
+    *, input_dict: Dict[int, RawUnreadDirectMessageDict]
 ) -> List[UnreadDirectMessageInfo]:
     lookup_dict: Dict[int, UnreadDirectMessageInfo] = {}
     for message_id, attribute_dict in input_dict.items():

@charliermarsh
Copy link
Copy Markdown
Member Author

The one ecosystem change matches Black's formatting (i.e., it's more consistent than on main).

@BlindChickens
Copy link
Copy Markdown

Yes lets go.

@charliermarsh charliermarsh merged commit febc69a into main Dec 9, 2023
@charliermarsh charliermarsh deleted the charlie/comma branch December 9, 2023 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working formatter Related to the formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ruff format always splits single positional-only argument list across two lines

3 participants