refactor(parser): split relations.rs (2783 lines) into 9-module per-concern tree#16
Conversation
src/parser/relations.rs (2783 lines) → src/parser/relations/{mod,helpers,
imports,inherits,exports,routes,rust,dart,tests}.rs. mod.rs (722 lines)
keeps the giant walk_for_relations dispatch — its match arms share
current_scope/current_class propagation, so splitting per-language would
either duplicate the recursion or lose scope context.
Per-concern submodules:
helpers.rs (75) — extract_callee_name, extract_string_from_subtree
imports.rs (229) — generic JS/TS/Java + Python imports
inherits.rs (231) — extract_superclasses + extract_implements (multi-lang)
exports.rs (61) — TS/JS export statements
routes.rs (182) — Express + Go + Python HTTP route extraction
rust.rs (108) — Rust use-imports + impl Trait for Type
dart.rs (136) — Dart imports + call expressions
tests.rs (1138) — all #[cfg(test)] tests
Public surface unchanged (extract_relations / extract_relations_from_tree
/ ParsedRelation), so pipeline.rs and tests/parser_deep_test.rs need no
edits. Submodule items are pub(super); mod.rs re-imports what walker arms
need.
Verification:
- cargo check: clean
- cargo +1.95.0 clippy --no-default-features -- -D warnings: clean
- cargo +1.95.0 clippy --all-targets -- -D warnings: clean
- cargo test --release: 292 lib + 44 + 19 + 6 + 54 = 415 tests, 0 failed
(1 pre-existing #[ignore])
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…/ pipeline) Pure refactor release — three biggest source files (8049 lines as monoliths) decomposed into 26 per-concern submodules. Zero behavior change, public surface preserved across all three splits. - src/storage/queries.rs (2892 lines) → src/storage/queries/ (10 files, #15) - src/parser/relations.rs (2783 lines) → src/parser/relations/ (9 files, #16) - src/indexer/pipeline.rs (2374 lines) → src/indexer/pipeline/ (7 files, #17) External callers in cli.rs / mcp/server / tests / benches / claude-plugin keep their imports unchanged. Two orchestrator-style functions kept whole deliberately (walk_for_relations ~650 lines, index_files ~770 lines) — their arms/phases share local state that splitting would either duplicate or thread back via large arg lists. Verification: cargo check + cargo +1.95.0 clippy (no-default-features + all-targets, -D warnings) + cargo test --release (292 lib + 129 integration = 421 tests, 0 failed). Pre-merge CI green on all three PRs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
src/parser/relations.rs(2783 lines) intosrc/parser/relations/{mod,helpers,imports,inherits,exports,routes,rust,dart,tests}.rs. Mirrors the per-domain split landed forqueries.rsin refactor(storage): split queries.rs into 10-module per-domain tree #15.mod.rs(722 lines) keeps the giantwalk_for_relationsdispatch as one match — its arms sharecurrent_scope/current_classpropagation, so splitting per-language would either duplicate recursion or lose scope context.extract_relations,extract_relations_from_tree,ParsedRelation.pipeline.rsandtests/parser_deep_test.rsneed no edits.mod.rshelpers.rsextract_callee_name+ string-literal subtree lookupimports.rsinherits.rsextract_superclasses+extract_implementsacross class-style langsexports.rsroutes.rsrust.rsusedeclarations +impl Trait for Typedart.rstests.rs#[cfg(test)]testsSubmodule items use
pub(super);mod.rsre-imports what each walker arm needs.Test plan
cargo check— cleancargo +1.95.0 clippy --no-default-features -- -D warnings— cleancargo +1.95.0 clippy --all-targets -- -D warnings— cleancargo test --release— 415 tests, 0 failed (1 pre-existing#[ignore])🤖 Generated with Claude Code