Skip to content

Comments

refactor(formatter): simplify the logic for grouping call arguments#17876

Merged
graphite-app[bot] merged 1 commit intomainfrom
01-11-refactor_formatter_simplify_the_logic_for_grouping_call_arguments
Jan 12, 2026
Merged

refactor(formatter): simplify the logic for grouping call arguments#17876
graphite-app[bot] merged 1 commit intomainfrom
01-11-refactor_formatter_simplify_the_logic_for_grouping_call_arguments

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Jan 11, 2026

Pure refactor, early return when possible

@github-actions github-actions bot added A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jan 11, 2026
Copy link
Member Author

Dunqing commented Jan 11, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 11, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing 01-11-refactor_formatter_simplify_the_logic_for_grouping_call_arguments (690de75) with main (9699a1b)

Summary

✅ 38 untouched benchmarks
⏩ 7 skipped benchmarks1

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Dunqing Dunqing marked this pull request as ready for review January 11, 2026 23:36
Copilot AI review requested due to automatic review settings January 11, 2026 23:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the logic for grouping call arguments in the formatter to use early returns and simplify the code structure. The goal is to avoid redundant calls to can_group_expression_argument by checking it once and branching based on the result.

Changes:

  • Refactored arguments_grouped_layout to use early returns with can_group_expression_argument check
  • Removed second_can_group parameter from should_group_first_argument
  • Removed last_can_group_fn parameter from should_group_last_argument_impl
  • Moved can_group_expression_argument check outside of should_group_last_argument_impl to the caller

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 12, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 12, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the 01-11-refactor_formatter_simplify_the_logic_for_grouping_call_arguments branch from 690de75 to 6e540bd Compare January 12, 2026 02:54
@graphite-app graphite-app bot merged commit 6e540bd into main Jan 12, 2026
20 checks passed
@graphite-app graphite-app bot deleted the 01-11-refactor_formatter_simplify_the_logic_for_grouping_call_arguments branch January 12, 2026 03:00
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant