Skip to content

Collapse empty call expressions#1308

Merged
vladmos merged 4 commits intobazelbuild:mainfrom
snady:collapse_empty
Jan 21, 2025
Merged

Collapse empty call expressions#1308
vladmos merged 4 commits intobazelbuild:mainfrom
snady:collapse_empty

Conversation

@snady
Copy link
Contributor

@snady snady commented Nov 18, 2024

Use compact mode for call expressions if there are no parameters or line comments.

Running buildifier on

func(
)

doesn't format it because of ForceMultiline, but one could reasonably expect it to collapse into

func()

This comes up sometimes when removing attrs with buildozer -- if ForceMultiline=true but the rule/macro no longer has any attrs, the result will look like the first example e.g

some_macro(
  attr_to_remove=[
    ...
  ]
)
some_macro(
)

@snady snady force-pushed the collapse_empty branch 2 times, most recently from 73bc760 to b1e7215 Compare November 19, 2024 01:18
@snady snady marked this pull request as ready for review November 19, 2024 01:23
Copy link
Member

@vladmos vladmos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@vladmos
Copy link
Member

vladmos commented Jan 14, 2025

Hi, please resolve the conflicts, I'll merge the PR

Copy link
Member

@vladmos vladmos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@vladmos vladmos merged commit 50e9b3f into bazelbuild:main Jan 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants