Skip to main content

Crate cha_core

Crate cha_core 

Source

Re-exports§

pub use config::Config;
pub use config::DebtWeights;
pub use config::LanguageConfig;
pub use config::LayersConfig;
pub use config::Strictness;
pub use config::TierConfig;
pub use config::builtin_language_profile;
pub use reporter::JsonReporter;
pub use reporter::LlmContextReporter;
pub use reporter::Reporter;
pub use reporter::SarifReporter;
pub use reporter::TerminalReporter;

Modules§

config
graph
html_reporter
plugins
reporter
wasm

Structs§

AnalysisContext
Analysis context passed to plugins.
Baseline
A baseline is a set of finding fingerprints representing known/accepted issues.
ClassInfo
Extracted class/struct info from AST.
ClassSymbol
Symbol-level view of a class — everything deps/LSP/hotspot need to reason about a class without parsing method bodies. Fields intentionally track the subset of ClassInfo that survives cross-file consumption.
CommentInfo
A comment extracted from source code by the language parser.
Finding
A single analysis finding.
FunctionInfo
Extracted function info from AST.
FunctionSymbol
Symbol-level view of a function — name + signature + call-graph input. Omits body_hash, complexity, cognitive, external_refs, chain_depth, parameter_types (TypeRef), return_type — those live in FunctionInfo for analyze plugins.
HealthScore
Per-file health score.
ImportInfo
Extracted import info.
Location
Source location of a finding.
PluginRegistry
Manages plugin registration and lifecycle.
ProjectCache
Unified project cache: parse results + findings + symbol summaries. Facade over three cache layers (models, symbols, findings) plus the meta bookkeeping they share. Method count ≥ 10 is structural, not a smell — each layer exposes get/put atop the layered read/write helpers.
SourceFile
Raw source file content.
SourceModel
Unified source model produced by parsing.
SymbolIndex
Compact structural summary of a file — symbol-level view without the per-function-body detail that analyze plugins need. Serves cha deps, future LSP workspace-symbols, and anywhere a reader needs “what classes/functions live here and how are they related” without caring about complexity metrics or TypeRef origin resolution.
TypeRef
A function parameter’s (or return value’s) type, with resolved origin. Produced by parsers after combining AST type text with the file’s imports.

Enums§

ArmValue
A single arm value of a switch/match construct. Recorded so signature-based analyses can notice “switch on string constants” or “switch on integer magic numbers” dispatch patterns. Non-literal patterns (Rust enum variants, Python capture patterns, default) collapse to Other.
FileStatus
Result of checking a file against cache.
Grade
Health grade A–F for a file, based on issue density.
Severity
Severity level for a finding.
SmellCategory
Smell category from refactoring literature.
TypeOrigin
Where a referenced type is defined, from the perspective of the file that uses it. Used by abstraction-boundary analyses to distinguish “own domain” types from “pulled in from a library” types.

Traits§

Plugin
Core trait that all analyzers implement.
ProjectQuery
Project-level queries available to all plugins (built-in + WASM).
ProjectQueryBulk
Bulk access for in-process plugins. WASM plugins cannot reach this trait — they’re stuck with point queries from ProjectQuery.

Functions§

class_location
Build a Location pointing at a class/struct’s name identifier.
env_hash
Compute environment hash from config + plugins + cha binary fingerprint.
filter_ignored
Filter out findings suppressed by cha:ignore comments in source code, and re-evaluate findings against cha:set threshold overrides.
findings_json_schema
Generate JSON Schema for the analysis output (list of findings).
func_location
Build a Location pointing at a function’s name identifier.
hash_content
Compute a content hash.
is_test_path
True if path is under a test directory or named like a test file.
is_zero_f64
Helper for serde skip_serializing_if on f64 fields.
is_zero_usize
Helper for serde skip_serializing_if on usize fields.
prioritize_findings
Sort findings by priority descending (most important first). Writes the computed score back to Finding::risk_score so reporters can show why a finding ranks where it does. priority = severity_weight × overshoot × compound_factor
score_files
Compute health scores grouped by file.