pub fn run<P, F>(
cli: Cli,
complexity: &dyn ComplexityPort,
coverage_factory: F,
meta: &AdapterMeta,
) -> ExitCodewhere
P: ParseDiagnostic + Display + 'static,
F: FnOnce(&Path) -> Box<dyn CoveragePort<Diagnostic = P>>,Expand description
Run the CRAP CLI pipeline end-to-end.
Takes a coverage_factory closure rather than a constructed
coverage adapter so the parser receives the effective source root
after CLI / config-file / preset merging — pre-construction
canonicalized against the bare CLI value (or the default src) and
the LCOV parser silently stripped the wrong prefix from SF:
records. The factory is invoked once inside run after
merge_effective_inputs resolves the final src, receives the
canonicalized effective source root (so adapter factories stay
dumb — orchestration owns the canonicalize concern), and is
short-circuited entirely on the completions subcommand (clap’s
--help / --version exit even earlier, inside parse_args).
Generic over P: ParseDiagnostic so the same orchestrator drives
every adapter crate’s binary (per ADR D9, mixed-dispatch). The
'static bound on P is the standard trait-object well-formedness
requirement when the closure returns Box<dyn …>; concrete adapter
diagnostic types (LcovParseDiagnostic, IstanbulParseDiagnostic)
satisfy it trivially.
meta carries the adapter binary’s runtime identity (name,
version, help copy, extensions, config-file name, SARIF URIs).
The binary’s own tool_version (e.g. crap4rs’s CARGO_PKG_VERSION
resolves to 0.5.0, not crap-core’s 0.1.0) feeds the JSON
envelope’s tool_version field, the SARIF run metadata, the
markdown / HTML headers, and clap’s long-version splice. See
AdapterMeta for the per-field rationale.