| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
handle_trait_item called compute_all_metrics/build_function_cfg unconditionally for every trait member, including function_signature_item (a required trait method with no default implementation, no body). This fabricated a trivial-but-meaningless complexity entry (cyclomatic: 1, cognitive: 0) that the WASM engine never produces, since COMPLEXITY_RULES for Rust excludes function_signature_item from functionNodes. Gate complexity/cfg on the same bodyless check already used for the Definition.bodyless flag (added in #1922) — function_signature_item gets None for both, function_item (default impl, has a body) is unaffected. Mirrors csharp.rs's handle_interface_decl, which already does this for C# interface methods. Verified native and WASM now produce identical codegraph complexity output on the issue's own repro (Repo.save/Repo.find trait). docs check acknowledged — bug fix restoring engine parity, no new language, feature, or architecture surface to document.
Greptile SummaryThis PR aligns native Rust extraction with the WASM engine by omitting complexity and CFG metadata for bodyless trait method declarations.
Confidence Score: 5/5The PR appears safe to merge, with the targeted native/WASM parity fix covered by a regression test. Bodyless Rust trait methods now retain symbol extraction while omitting inapplicable complexity and CFG data, and default implementations continue through the existing metric-generation path. Important Files Changed
Reviews (1): Last reviewed commit: "fix: skip complexity/CFG for bodyless Ru..." | Re-trigger Greptile |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
handle_trait_item in crates/codegraph-core/src/extractors/rust_lang.rs called compute_all_metrics/build_function_cfg unconditionally for every trait member, including function_signature_item (a required trait method with no default implementation, no body). This fabricated a trivial-but-meaningless complexity entry (cyclomatic: 1, cognitive: 0) that the WASM engine never produces, since COMPLEXITY_RULES for Rust (src/ast-analysis/rules/rust.ts) excludes function_signature_item from functionNodes.
Fix: gate complexity/cfg on the same bodyless check already used for the Definition.bodyless flag (added in #1922) — function_signature_item gets None for both, function_item (default impl, has a body) is unaffected. Mirrors csharp.rs's handle_interface_decl, which already does this for C# interface methods.
Verification
Test plan
Closes #2053