Skip to main content

Module adapters

Module adapters 

Source
Expand description

Language-agnostic adapters — IO and presentation layers that make no assumptions about the source language being analyzed.

Four families live here:

  • baseline: loads a previously-emitted JSON envelope from disk so delta reporting can compare the current run against a prior one.
  • config: parses the adapter’s TOML configuration (threshold overrides, view presets, exclude patterns).
  • diff: shells out to git to compute changed line ranges per file for --diff <ref> filtering.
  • reporters: render the analyzer output as JSON, Markdown, SARIF, HTML, CSV, terminal table, scorecard rows, or advice summary.

Per-language adapters (e.g. crap4rs::adapters::complexity, crap4rs::adapters::coverage) live in their parent crate and pull crap-core’s ports / domain types as dependencies. The crap4rs v0.4 public surface stays buildable through shim pub use re-exports in crap4rs::adapters (see crap4rs/src/lib.rs).

Modules§

baseline
Baseline-envelope loader — reads a previously-emitted analyzer JSON envelope from disk and extracts the result block, plus the envelope metadata (tool_version, timestamp) needed for delta reporting.
config
Config file adapter — loads the adapter’s TOML config (file name supplied by the binary via AdapterMeta::config_file_name) and converts to domain types.
diff
Git diff adapter — shells out to git diff and parses unified diff output.
reporters
Output reporters — terminal table and JSON.