You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add Halstead, LOC, and MI metrics to Rust native engine (#159)
The native engine previously computed only cognitive, cyclomatic, and
maxNesting complexity. Halstead metrics, LOC, and Maintainability Index
were only available via the WASM fallback path, leaving native users
with incomplete (all-zero) data for those columns.
This adds full-fidelity computation of all metrics in the Rust engine:
- Add HalsteadMetrics and LocMetrics NAPI structs to types.rs
- Extend ComplexityMetrics with optional halstead, loc, and MI fields
- Add HalsteadRules struct with per-language classification tables for
all 8 supported languages (JS/TS, Python, Go, Rust, Java, C#, Ruby,
PHP), mirroring the JS HALSTEAD_RULES
- Add compute_all_metrics() single-pass DFS that computes complexity +
Halstead + LOC + MI in one tree walk
- Update all 8 extractors to call compute_all_metrics
- Update normalizeNativeSymbols in parser.js to pass through new fields
- Update buildComplexityMetrics precomputed branch to use actual native
values instead of hardcoded zeros
Impact: 21 functions changed, 56 affected
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
0 commit comments