pub struct AnalyzeOptions {
pub src: PathBuf,
pub coverage: PathBuf,
pub threshold_config: ThresholdConfig,
pub metric: ComplexityMetric,
pub coverage_metric: CoverageMetric,
pub exclude: Vec<String>,
pub respect_gitignore: bool,
pub diff_ref: Option<String>,
pub extensions: Vec<String>,
pub compute_diagnostics: bool,
}Expand description
Options for running a CRAP analysis.
Fields§
§src: PathBufRoot directory of source files to analyze.
coverage: PathBufPath to the coverage file (adapter-specific format: LCOV for crap4rs, Istanbul JSON for crap4ts, etc.).
threshold_config: ThresholdConfigThreshold configuration with optional per-path overrides.
metric: ComplexityMetricWhich complexity metric to use.
coverage_metric: CoverageMetricWhich coverage metric to use for analysis.
exclude: Vec<String>Glob patterns to exclude from file discovery.
respect_gitignore: boolWhether to respect .gitignore files during file discovery.
diff_ref: Option<String>Git ref to diff against. When set, only changed functions are analyzed.
extensions: Vec<String>File extensions the walker should pick up. Adapter-specific
(["rs"] for crap4rs; ["ts","tsx","js","jsx","mjs","cjs"]
for crap4ts). Default::default() is Vec::new() since #161 —
the adapter-language coupling lives in each binary’s
AdapterMeta::extensions, threaded into AnalyzeOptions at
the CLI boundary. Library tests that construct AnalyzeOptions
directly must set this explicitly;
core::ensure_source_files_found surfaces a parser-neutral
diagnostic when no files match.
compute_diagnostics: boolWhen true, populate FunctionVerdict.diagnostic for every
over-threshold verdict via domain::diagnostic::compute_diagnostic.
CLI sets this for --format advice and --format sarif. The
computation is pure-domain and bounded — runs only on exceeding
verdicts, so the cost scales with violations, not total functions.