specfold_core/check/rule.rs
1//! The rule interface. Each rule carries its own explanation, which is the rule's documentation.
2
3use super::context::Ctx;
4use super::finding::Finding;
5
6pub struct RuleInfo {
7 pub id: &'static str,
8 pub title: &'static str,
9 /// Why the rule exists and how to fix a finding.
10 pub explain: &'static str,
11 /// Runs in the pre-commit (staged) scope.
12 pub on_commit: bool,
13}
14
15pub trait Rule: Sync {
16 fn info(&self) -> &RuleInfo;
17 fn run(&self, ctx: &Ctx, out: &mut Vec<Finding>);
18}