use anyhow::Result;
#[derive(Debug)]
pub struct GateResult {
pub passed: bool,
pub errors: Vec<String>,
}
pub struct Gatekeeper {}
impl Default for Gatekeeper {
fn default() -> Self {
Self::new()
}
}
impl Gatekeeper {
pub fn new() -> Self {
Self {}
}
pub fn check_code_gates(&self) -> Result<GateResult> {
let output = std::process::Command::new("cargo")
.args(["check", "--lib"])
.output()?;
Ok(GateResult {
passed: output.status.success(),
errors: if output.status.success() {
vec![]
} else {
vec![String::from_utf8_lossy(&output.stderr).to_string()]
},
})
}
}