use camino::Utf8PathBuf;
use cordance_core::advise::{AdviseFinding, Severity};
use cordance_core::pack::CordancePack;
use super::AdviseRule;
pub struct RTrunk1;
impl AdviseRule for RTrunk1 {
fn id(&self) -> &'static str {
"R-trunk-1"
}
fn doctrine_anchor(&self) -> &'static str {
"doctrine/principles/collaboration.md"
}
fn check(&self, pack: &CordancePack) -> Vec<AdviseFinding> {
let has_ci = pack.sources.iter().any(|r| {
let p = r.path.as_str();
p.starts_with(".github/workflows/")
|| p.starts_with(".pipelines/")
|| p == "azure-pipelines.yml"
|| p == "bitbucket-pipelines.yml"
});
if has_ci {
return vec![];
}
vec![AdviseFinding {
id: self.id().into(),
severity: Severity::Warning,
summary: "No CI workflow file detected.".into(),
doctrine_anchor: Utf8PathBuf::from(self.doctrine_anchor()),
project_paths: vec![".".into()],
remediation: "Add .github/workflows/quality.yml (or equivalent) with fmt, lint, test, \
and deny checks."
.into(),
}]
}
}