last_run_report

Function last_run_report 

Source
pub fn last_run_report(
    dir: Option<&Path>,
    kernel: Option<&str>,
) -> Option<String>
Expand description

Read sidecar JSON files and return the gauntlet analysis report for cargo ktstr stats last-run.

Source directory, in precedence order:

  1. dir (the --dir flag) when Some — analyzed verbatim, mirroring crate::test_support::analyze_sidecars(Some(dir)).
  2. KTSTR_SIDECAR_DIR when set non-empty — the same env override analyze_sidecars(None) honors.
  3. kernel (the --kernel flag) when Some — the most recently modified run dir whose leaf name begins {kernel}- (see newest_run_dir_for_kernel).
  4. Otherwise the most recently modified run dir under the cargo target directory’s ktstr/ (crate::test_support::newest_run_dir).

cargo ktstr stats doesn’t itself run a kernel, so it can’t reconstruct the {kernel}-{project_commit} key the test process used; the mtime fallback (and the --kernel prefix match) stand in for “show me the report from my last test run.”

Returns None with a warning on stderr when no sidecars are found. This is not an error – regular test runs that skip gauntlet tests produce no sidecar files.