1pub mod boundary_violation;
2pub mod custom;
3pub mod dangling_edge;
4pub mod directed_cycle;
5pub mod encapsulation_violation;
6pub mod fragility;
7pub mod fragmentation;
8pub mod layer_violation;
9pub mod orphan_node;
10pub mod redundant_edge;
11pub mod schema_violation;
12pub mod stale;
13pub mod symlink_edge;
14pub mod untrackable_target;
15
16use crate::analyses::EnrichedGraph;
17use crate::diagnostic::Diagnostic;
18
19pub struct RuleContext<'a> {
24 pub graph: &'a EnrichedGraph,
25 pub options: Option<&'a toml::Value>,
27}
28
29pub trait Rule {
30 fn name(&self) -> &str;
31 fn evaluate(&self, ctx: &RuleContext) -> Vec<Diagnostic>;
32}
33
34pub fn all_rules() -> Vec<Box<dyn Rule>> {
35 vec![
36 Box::new(boundary_violation::BoundaryViolationRule),
37 Box::new(dangling_edge::DanglingEdgeRule),
38 Box::new(directed_cycle::DirectedCycleRule),
39 Box::new(encapsulation_violation::EncapsulationViolationRule),
40 Box::new(fragility::FragilityRule),
41 Box::new(fragmentation::FragmentationRule),
42 Box::new(layer_violation::LayerViolationRule),
43 Box::new(orphan_node::OrphanNodeRule),
44 Box::new(redundant_edge::RedundantEdgeRule),
45 Box::new(schema_violation::SchemaViolationRule),
46 Box::new(stale::StaleRule),
47 Box::new(symlink_edge::SymlinkEdgeRule),
48 Box::new(untrackable_target::UntrackableTargetRule),
49 ]
50}