pub fn check(root: &Path) -> EconomicsCheckReportExpand description
Run every check over the repository at root: the prose scan of scan_prose, and the
claims of check_claims against a summary computed afresh by
crate::economics::summarize, never a cached one. It never fails as a call: what
cannot be read is a finding, and the report is ok exactly when no check found anything.
use majordomus_cli::economics::claims::check;
let dir = tempfile::tempdir().unwrap();
let git = std::process::Command::new("git")
.env_remove("GIT_DIR").env_remove("GIT_WORK_TREE").env_remove("GIT_INDEX_FILE")
.arg("-C").arg(dir.path()).args(["init", "-q"]).status().unwrap();
assert!(git.success());
std::fs::create_dir(dir.path().join("docs")).unwrap();
let claims = "claims:\n - id: savings\n claim: Majordomus saves 40% of tokens.\n";
std::fs::write(dir.path().join("docs/CLAIMS.yaml"), claims).unwrap();
let report = check(dir.path());
assert!(!report.ok);
assert_eq!(report.findings[0].kind, "unsupported_quantity");
assert_eq!(report.findings[0].line, Some(3));