pub fn rust_only(crate_dir: &Path, target: &str) -> Result<QualityReport, Error>Expand description
Measure the Rust surface of a crate: documentation, examples and module coverage.
The operations half needs a registry and a command tree; a caller that has neither —
a test over a fixture crate, for instance — uses this and gets a report whose
operations section is all zeroes rather than a wrong one.
use majordomus_cli::quality::report;
let dir = tempfile::tempdir().unwrap();
let src = dir.path().join("src");
std::fs::create_dir_all(&src).unwrap();
std::fs::write(src.join("lib.rs"), "//! Thin.\npub fn go() {}\n").unwrap();
let r = report::rust_only(dir.path(), "thin").unwrap();
assert!(!r.passes(), "a thin header and an unexampled function are both findings");
assert_eq!(r.operations.canonical, 0, "nothing was measured about operations");