Skip to content

refactor(linter/plugins): reduce code nesting#16719

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-11-refactor_linter_plugins_reduce_code_nesting
Dec 11, 2025
Merged

refactor(linter/plugins): reduce code nesting#16719
graphite-app[bot] merged 1 commit intomainfrom
12-11-refactor_linter_plugins_reduce_code_nesting

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 11, 2025

Pure refactor. Flatten a large if block, to make the code easier to follow.

Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 11, 2025


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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Dec 11, 2025
@overlookmotel overlookmotel marked this pull request as ready for review December 11, 2025 01:11
Copilot AI review requested due to automatic review settings December 11, 2025 01:11
@overlookmotel overlookmotel self-assigned this Dec 11, 2025
Copy link
Copy Markdown
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 getParseOptions function by reducing code nesting through early returns and flattening nested conditional blocks. The refactoring makes the code more readable without changing its behavior.

Key Changes:

  • Introduced early return when languageOptions is null to eliminate the outermost nesting level
  • Flattened the error-throwing logic for custom parsers by removing unnecessary nesting

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

@overlookmotel overlookmotel force-pushed the 12-11-refactor_linter_plugins_reduce_code_nesting branch from 5fc1eb8 to f509ef4 Compare December 11, 2025 02:09
@overlookmotel overlookmotel force-pushed the 12-11-fix_linter_plugins_correct_punctuation_in_error_message branch from 849f5bd to e1eebb7 Compare December 11, 2025 02:09
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 11, 2025
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Dec 11, 2025

Merge activity

Pure refactor. Flatten a large `if` block, to make the code easier to follow.
@graphite-app graphite-app bot force-pushed the 12-11-fix_linter_plugins_correct_punctuation_in_error_message branch from e1eebb7 to 32e23f7 Compare December 11, 2025 02:18
@graphite-app graphite-app bot force-pushed the 12-11-refactor_linter_plugins_reduce_code_nesting branch from f509ef4 to 4d9e981 Compare December 11, 2025 02:18
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 11, 2025
Base automatically changed from 12-11-fix_linter_plugins_correct_punctuation_in_error_message to main December 11, 2025 02:25
@graphite-app graphite-app bot merged commit 4d9e981 into main Dec 11, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 12-11-refactor_linter_plugins_reduce_code_nesting branch December 11, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins 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.

2 participants