1pub mod custom;
2pub mod directed_cycle;
3pub mod fragmentation;
4pub mod orphan_node;
5pub mod schema_violation;
6pub mod stale;
7pub mod symlink_edge;
8pub mod unresolved_edge;
9
10use crate::analyses::EnrichedGraph;
11use crate::diagnostic::Diagnostic;
12
13pub struct RuleContext<'a> {
18 pub graph: &'a EnrichedGraph,
19 pub options: Option<&'a toml::Value>,
21}
22
23pub trait Rule {
24 fn name(&self) -> &str;
25 fn evaluate(&self, ctx: &RuleContext) -> Vec<Diagnostic>;
26}
27
28pub fn all_rules() -> Vec<Box<dyn Rule>> {
29 vec![
30 Box::new(directed_cycle::DirectedCycleRule),
31 Box::new(fragmentation::FragmentationRule),
32 Box::new(orphan_node::OrphanNodeRule),
33 Box::new(schema_violation::SchemaViolationRule),
34 Box::new(stale::StaleRule),
35 Box::new(symlink_edge::SymlinkEdgeRule),
36 Box::new(unresolved_edge::UnresolvedEdgeRule),
37 ]
38}