pub struct AdapterMeta {Show 14 fields
pub tool_name: &'static str,
pub tool_version: &'static str,
pub long_version: &'static str,
pub about: &'static str,
pub long_about: &'static str,
pub after_help: &'static str,
pub coverage_hint: &'static str,
pub extensions: &'static [&'static str],
pub tool_info_uri: &'static str,
pub rule_help_uri: &'static str,
pub config_file_name: &'static str,
pub default_excludes: &'static [&'static str],
pub forced_excludes: &'static [&'static str],
pub default_metric: ComplexityMetric,
}Expand description
Adapter-supplied runtime metadata that crap-core threads through
parse_args, run, and the reporter call sites.
All fields are &'static because every production caller supplies
env!(...) / build.rs-stamped literals or const &[&str] slices.
Tests construct from &'static str literals too. The lifetime
parameter was dropped in #161 — no caller ever needed non-static
metadata, and the <'a> ripple polluted 15 function signatures for
no payoff. The struct stays Copy so threading is trivial.
Reporters keep a flat (tool_name, tool_version) call boundary —
the struct only travels through orchestration code.
Fields§
§tool_name: &'static strAdapter binary name (e.g., "crap4rs", "crap4ts"). Drives
clap’s --version output, the name field in SARIF, and the
header line in table/markdown/html reporters.
tool_version: &'static strShort version string (e.g., "0.5.0"). Threaded to every
reporter alongside tool_name.
long_version: &'static strLong version string for --version --long (e.g.,
"0.5.0 (abc1234 2026-05-09)").
about: &'static strShort adapter-flavored help text (one-line, shown by --help).
long_about: &'static strLong adapter-flavored help text (multi-paragraph, shown by
--help in full mode).
after_help: &'static strafter_help block with adapter-specific examples
(crap4rs --coverage lcov.info ... etc.). May be empty.
coverage_hint: &'static strCoverage-tool hint shown when --coverage points at a file
with no SF: / DA: records. Adapter-specific because the
remediation depends on the coverage toolchain (Rust: cargo llvm-cov --lcov; TS: c8 --reporter=lcov).
extensions: &'static [&'static str]File extensions the walker should pick up (e.g.,
&["rs"] for crap4rs; &["ts","tsx","js","jsx","mjs","cjs"]
for crap4ts). Adapter binaries supply a const &[&str]; copied
into AnalyzeOptions.extensions at the orchestration boundary.
tool_info_uri: &'static strAdapter repo URL spliced into SARIF’s
runs[0].tool.driver.informationUri. Adapter-specific so
crap4ts SARIF output links to crap4ts’s repo, not crap4rs’s.
rule_help_uri: &'static strAdapter rule-help URL spliced into SARIF’s
runs[0].tool.driver.rules[0].helpUri. Adapter-specific for
the same reason as tool_info_uri.
config_file_name: &'static strConventional config file name the adapter binary auto-discovers
in the working directory (e.g., "crap4rs.toml" for the Rust
adapter; "crap4ts.toml" for the TS adapter). Threaded through
to discover_config and surfaced in --view <preset>
error hints so users see the right file name to create.
default_excludes: &'static [&'static str]Commented-out exclude patterns emitted by init into the
generated config (e.g., &["tests/**", "benches/**", "examples/**"]
for Rust; &["node_modules/**", "dist/**", "coverage/**"] for
TS). Adapter-specific because the convention for “where tests
and ignorable artifacts live” differs per ecosystem. May be
empty — init then emits the # exclude = [ … ] block without
per-language entries.
This field is init-template only — it does NOT affect the
analyzer’s effective exclude list at runtime. The runtime
exclude list is built from cli.filter.exclude plus the user’s
crap4ts.toml/crap4rs.toml exclude entries, with adapter-
mandated patterns prepended via forced_excludes (below).
forced_excludes: &'static [&'static str]Adapter-mandated exclude patterns prepended to every analysis
run, regardless of CLI flags or user config. Use for files that
are structurally never source for the adapter’s language —
e.g. crap4ts sets &["**/*.d.ts"] because TypeScript
declaration files contain only ambient types, never executable
code. crap4rs has no such suffix today and sets &[].
Distinct from default_excludes (above): forced excludes are
load-bearing at analysis time and cannot be turned off by the
operator, whereas default_excludes is init-template
scaffolding. If an operator genuinely needs .d.ts files in
their report, the path is forking the adapter or filing a
follow-up to add an opt-out — not a config knob (crap-rs#253).
default_metric: ComplexityMetricThe default complexity metric the adapter binary uses when
neither CLI nor config file specifies one. crap4rs sets
Cognitive; crap4ts sets Cyclomatic (the only metric crap4ts
currently supports per CrapError::MetricNotSupported).
Threaded through merge_effective_inputs so the binary’s
default flips per adapter without re-litigating the shared CLI
fallthrough. See ADR (d) adr-adapter-meta-default-metric.md
for the design rationale (per-adapter defaults surface through
AdapterMeta, not crap-core configuration).
Implementations§
Source§impl AdapterMeta
impl AdapterMeta
Sourcepub fn extensions_owned(&self) -> Vec<String>
pub fn extensions_owned(&self) -> Vec<String>
Allocate an owned Vec<String> from extensions for inclusion
in AnalyzeOptions (which owns its config rather than borrowing
from the meta, decoupling analysis lifetime from CLI lifetime).
Trait Implementations§
Source§impl Clone for AdapterMeta
impl Clone for AdapterMeta
Source§fn clone(&self) -> AdapterMeta
fn clone(&self) -> AdapterMeta
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more