Skip to content
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

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

Merged
merged 1 commit into from
Dec 9, 2023

Conversation

charliermarsh
Copy link
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
Copy link
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
Member Author

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

@BlindChickens
Copy link

Yes lets go.

@charliermarsh charliermarsh merged commit febc69a into main Dec 9, 2023
17 checks passed
@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