| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Both languages' if/else-if/else use Pattern C (alternative field, no else_clause wrapper) confirmed by parsing against tree-sitter-r's node-types.json and tree-sitter-groovy's Java-derived grammar. R's `repeat` loop and lack of a switch statement, and Groovy's ambiguous `closure` body-wrapper node (excluded from functionNodes to avoid fabricating spurious function entries for if/for/while/switch bodies), are both mirrored identically in the native Rust engine. Julia (operators wrap in a single generic `operator` node, indistinguishable by type) and Solidity (every statement/expression wraps in a generic `statement`/`expression` node, breaking else-if field detection) need an engine-level enhancement rather than a rules port — left for a follow-up. docs check acknowledged: no language-support table, feature list, or architecture description in README/CLAUDE.md/ROADMAP names a per-language complexity-support boundary to update.
Greptile SummaryAdds R and Groovy complexity, Halstead, and comment-line analysis in both the TypeScript fallback and native Rust engines.
Confidence Score: 5/5The PR appears safe to merge with no concrete actionable defects identified. The TypeScript and native Rust rule registrations are mirrored, representative control-flow behavior is covered in both implementations, and the documented grammar limitations do not establish incorrect behavior beyond the explicitly accepted precision tradeoffs. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
Source["R or Groovy source"] --> Parse["Tree-sitter parse"]
Parse --> Native["Native Rust analysis"]
Parse --> Wasm["TypeScript/WASM fallback"]
Native --> RulesN["R_RULES / GROOVY_RULES<br/>R_HALSTEAD / GROOVY_HALSTEAD"]
Wasm --> RulesT["COMPLEXITY_RULES<br/>HALSTEAD_RULES"]
RulesN --> Metrics["Complexity and Halstead metrics"]
RulesT --> Metrics
Reviews (1): Last reviewed commit: "feat(complexity): add R and Groovy compl..." | Re-trigger Greptile |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Adds COMPLEXITY_RULES/HALSTEAD_RULES (TS) and lang_rules()/halstead_rules() (native) entries for R and Groovy, part of the broader #1923 tracking issue (complexity metrics missing for 24/34 languages — this PR closes the gap for 2 more, following prior batches for tier-1 (c/cpp/kotlin/swift/scala/bash) and ObjC).
Both languages confirmed via direct grammar investigation (tree-sitter-r 1.2.0's node-types.json, tree-sitter-groovy parsing) rather than assumption:
Both engines verified byte-identical on the existing tests/benchmarks/resolution/fixtures/{r,groovy} fixtures via codegraph complexity --health -T --json (WASM build vs. rebuilt native addon).
While investigating, two other candidate languages (Julia, Solidity) turned out to need an actual engine enhancement rather than a rules port — filed as a follow-up (#2312) rather than expanding this PR's scope: Julia wraps every operator in one generic operator node type (indistinguishable by node type, only by text), and Solidity wraps every statement/expression in a generic statement/expression node that breaks both existing else-if detection patterns.
Verification
Scope note
This does not close #1923 — that issue tracks all 24 remaining languages and is intentionally left open across multiple /fixer passes (see its comment history). This PR is one more increment (R, Groovy); #2312 tracks the Julia/Solidity engine gap plus the still-unaddressed functional/pattern-matching languages, Verilog, and dart (blocked on #2182).
Progress on #1923.