Skip to content

fix: simplify outline extractor code#2744

Merged
HerringtonDarkholme merged 1 commit into
mainfrom
outline-simplify-code
Jun 19, 2026
Merged

fix: simplify outline extractor code#2744
HerringtonDarkholme merged 1 commit into
mainfrom
outline-simplify-code

Conversation

@HerringtonDarkholme

@HerringtonDarkholme HerringtonDarkholme commented Jun 19, 2026

Copy link
Copy Markdown
Member

Split from the outline options work.\n\nThis PR contains only commit 2ad897b: simplify outline extractor code.

Summary by CodeRabbit

  • Refactor
    • Internal improvements to predicate compilation logic with enhanced code organization and documentation clarity.

@coderabbitai

coderabbitai Bot commented Jun 19, 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: eebc2601-b6e7-474d-80e4-c05a48735a58

📥 Commits

Reviewing files that changed from the base of the PR and between a1a08bf and 2ad897b.

📒 Files selected for processing (1)
  • crates/outline/src/extractor.rs

📝 Walkthrough

Walkthrough

ExtractorCommon gains a private compile_predicate method that converts Option<SerializablePredicate> to OutlinePredicate, using the extractor's own compiled rule config for SerializablePredicate::Rule deserialization. The previous standalone free function is deleted, and ItemExtractor::try_from and MemberExtractor::try_from are updated to call the new method.

Changes

Predicate Compilation Refactor

Layer / File(s) Summary
ExtractorCommon::compile_predicate and call-site updates
crates/outline/src/extractor.rs
Adds ExtractorCommon::compile_predicate method that uses the extractor's rule matcher env, removes the standalone compile_predicate free function, updates ItemExtractor::try_from (is_import/is_exported) and MemberExtractor::try_from (is_public) to call common.compile_predicate(...), and adds an inline comment on OutlinePredicate::evaluate clarifying match environment reuse.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • ast-grep/ast-grep#2729: Modifies the same predicate compilation and ExtractorCommon-based wiring in crates/outline/src/extractor.rs, overlapping directly with the changed code paths.

Poem

🐇 A lone helper once roamed, compile_predicate free,
Now tucked in ExtractorCommon where it ought to be.
The matchers align, the environments share,
Each is_import and is_public handled with care.
Hop hop, refactor done — tidy code for the tree! 🌿

🚥 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 'fix: simplify outline extractor code' accurately describes the main change - refactoring the outline extractor for improved code simplicity by consolidating predicate compilation logic.
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-simplify-code

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 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.95%. Comparing base (b6716ff) to head (2ad897b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2744      +/-   ##
==========================================
- Coverage   85.95%   85.95%   -0.01%     
==========================================
  Files         125      125              
  Lines       22051    22051              
==========================================
- Hits        18954    18953       -1     
- Misses       3097     3098       +1     

☔ 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.

@HerringtonDarkholme
HerringtonDarkholme added this pull request to the merge queue Jun 19, 2026
Merged via the queue into main with commit cba471d Jun 19, 2026
6 checks passed
@HerringtonDarkholme
HerringtonDarkholme deleted the outline-simplify-code branch June 19, 2026 21:07
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