Repository navigation
Releases
Releases · StrangeDaysTech/arborist-metrics
Arborist v0.1.3
Added
- New Built with AI · Powered by StrayMark section in README acknowledging
the project's AI-assisted development process and its use of
StrayMark — a CLI for cognitive discipline in
AI-assisted engineering — for decision tracking and governance. - New Copyright section in README identifying Strange Days Tech S.A.S. de
C.V. (strangedays.tech) as the original author
and intellectual-property holder. SPDX-License-Identifier: MIT OR Apache-2.0header with copyright
attribution on every Rust source file in the library, in line with Rust
ecosystem conventions.
Arborist v0.1.2
Arborist v0.1.1
Changed
- Restructure Feature Flags section in README: move before Installation, expand with
per-language table showing feature flag, tier, and tree-sitter crate mapping. - Add
Defaultcolumn to Supported Languages table (Yes / Opt-in). - Add
[package.metadata.docs.rs]withall-features = trueso docs.rs renders
documentation for all 12 languages. - Add actionable doc comment on
LanguageNotEnablederror with Cargo.toml fix examples. - Add module-level documentation to
src/languages/mod.rsexplaining the feature gate
system and tier structure.
Arborist v0.1.0
Arborist v0.1.0
Multi-language code complexity metrics powered by tree-sitter.
Computes cognitive complexity (SonarSource), cyclomatic complexity (McCabe), and source lines of code (SLOC) for functions and methods — all from a single, embeddable Rust library.
Supported Languages (12)
| Tier | Languages | Feature flags |
|---|---|---|
| Tier 1 (default: ★) | Rust★, Python★, JavaScript★, TypeScript★, Java★, Go★, C#, C++, C, PHP | default = 6 most popular |
| Tier 2 | Kotlin, Swift | kotlin, swift |
features = ["all"] enables all 12 languages.
Highlights
- SonarSource-compliant cognitive complexity: nesting penalties, boolean operator sequences, flat else-if, lambda nesting, recursive call detection
- McCabe cyclomatic complexity: per-arm counting for match/switch constructs
- Feature-gated compilation: only compile the grammars you need
- JSON serialization:
FileReportandFunctionMetricsimplementSerialize/Deserialize - Configurable thresholds: flag functions exceeding a cognitive complexity limit
- 177 tests across all languages, clippy clean
Installation
[dependencies]
arborist = "0.1" # default: Rust, Python, JS, TS, Java, Go
arborist = { version = "0.1", features = ["all"] } # all 12 languagesQuick Example
use arborist::{analyze_file, FileReport};
let report: FileReport = analyze_file("src/main.rs")?;
for func in &report.functions {
println!("{}: cognitive={}, cyclomatic={}, sloc={}",
func.name, func.cognitive, func.cyclomatic, func.sloc);
}Known Limitations
- Recursion detection is not supported for Kotlin and Swift (their tree-sitter grammars lack a named field on call expression nodes)
- Halstead metrics are planned for v0.2.0