Skip to content

refactor: fold outline extract options into extractors#2749

Merged
HerringtonDarkholme merged 1 commit into
mainfrom
outline-cli-options-style
Jun 20, 2026
Merged

refactor: fold outline extract options into extractors#2749
HerringtonDarkholme merged 1 commit into
mainfrom
outline-cli-options-style

Conversation

@HerringtonDarkholme

@HerringtonDarkholme HerringtonDarkholme commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor
    • Simplified internal architecture of outline extraction by consolidating configuration handling and reducing parameter passing complexity for improved code maintainability.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f8e9c80-b059-4ef0-9956-efb5be1927ce

📥 Commits

Reviewing files that changed from the base of the PR and between eaa82c4 and 4b7c384.

📒 Files selected for processing (3)
  • crates/cli/src/outline.rs
  • crates/cli/src/outline/extract.rs
  • crates/cli/src/outline/options.rs

📝 Walkthrough

Walkthrough

OutlineExtractOptions is removed as a struct. Its two responsibilities are split into standalone pub(super) functions in options.rs. The show_empty_files flag is absorbed as a field on OutlineExtractors, which gains a try_from_arg constructor. stream_paths and its helpers drop the options parameter, and run_outline is simplified to a single constructor call.

Changes

Outline extraction options refactoring

Layer / File(s) Summary
Replace OutlineExtractOptions with helper functions
crates/cli/src/outline/options.rs
Removes the OutlineExtractOptions struct and its try_from_arg method; adds pub(super) fn extractor_options_from_arg and pub(super) fn show_empty_files that encapsulate the same logic separately.
Absorb show_empty_files into OutlineExtractors, simplify stream_paths
crates/cli/src/outline/extract.rs
OutlineExtractors gains a show_empty_files: bool field and a public try_from_arg constructor. stream_paths, extract_path_or_report, and extract_path drop the options: &OutlineExtractOptions parameter; the empty-file skip now reads extractors.show_empty_files.
Simplify run_outline call site
crates/cli/src/outline.rs
Removes the OutlineExtractOptions import; collapses the two-step options-then-extractors construction into OutlineExtractors::try_from_arg(rules, &arg), and passes extractors directly to stream_paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • ast-grep/ast-grep#2738: Introduced the original OutlineExtractOptions struct and stream_paths wiring that this PR refactors away.
  • ast-grep/ast-grep#2748: Also reshapes OutlineExtractOptions/empty-file behavior plumbing across the same three files.
  • ast-grep/ast-grep#2747: Refactors OutlineExtractors construction in extract.rs, changing how extractor options and filtering are passed in.

Poem

🐇 The options struct once carried weight,
Two fields bundled, passed around late.
Now show_empty_files lives inside,
And helpers split what struct did hide.
Less plumbing, cleaner is the way —
A tidy warren, hip-hooray! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main refactoring: consolidating outline extract options into the extractors structure, eliminating the separate options wrapper.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch outline-cli-options-style

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.04%. Comparing base (eaa82c4) to head (4b7c384).

Files with missing lines Patch % Lines
crates/cli/src/outline/options.rs 0.00% 24 Missing ⚠️
crates/cli/src/outline/extract.rs 0.00% 16 Missing ⚠️
crates/cli/src/outline.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2749      +/-   ##
==========================================
- Coverage   86.07%   86.04%   -0.04%     
==========================================
  Files         126      126              
  Lines       22355    22362       +7     
==========================================
- Hits        19243    19242       -1     
- Misses       3112     3120       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread crates/cli/src/outline/extract.rs
@HerringtonDarkholme
HerringtonDarkholme added this pull request to the merge queue Jun 20, 2026
Merged via the queue into main with commit 09866e5 Jun 20, 2026
4 of 6 checks passed
@HerringtonDarkholme
HerringtonDarkholme deleted the outline-cli-options-style branch June 20, 2026 20:47
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.

1 participant