Skip to main content

run_checks

Function run_checks 

Source
pub fn run_checks(
    root: &Path,
    catalogue: &AdvisorCatalogue,
    refs: &References,
    loaded: &Loaded,
    checks: &[&str],
) -> Vec<ReasoningFinding>
Expand description

Run the named checks over the repository at root, in the order of CHECKS; a name that is not one of them is ignored. run is this with every check, and applicable says which a repository is held to.

use majordomus_cli::reasoning::catalogue::{AdvisorCatalogue, References};
use majordomus_cli::reasoning::check::run_checks;
use majordomus_cli::reasoning::store::Store;

let root = tempfile::tempdir().unwrap();
std::fs::write(root.path().join("README.md"), "Consensus guarantees correctness.\n").unwrap();
let catalogue = AdvisorCatalogue {
    forbidden_claims: vec!["consensus guarantees correctness".into()],
    ..Default::default()
};
let loaded = Store::at(root.path()).load();
let refs = References::default();
assert_eq!(run_checks(root.path(), &catalogue, &refs, &loaded, &["claims"]).len(), 1);
assert!(run_checks(root.path(), &catalogue, &refs, &loaded, &["catalogue", "records"]).is_empty());