Skip to main content

rigsql_rules/
lib.rs

1pub mod rule;
2pub mod utils;
3mod violation;
4
5#[cfg(test)]
6pub(crate) mod test_utils;
7
8pub mod aliasing;
9pub mod ambiguous;
10pub mod capitalisation;
11pub mod convention;
12pub mod layout;
13pub mod references;
14pub mod rigsql;
15pub mod structure;
16pub mod tsql;
17
18pub use rule::{apply_fixes, CrawlType, Rule, RuleContext, RuleGroup};
19pub use violation::{LintViolation, Severity, SourceEdit};
20
21/// Returns all default rules.
22pub fn default_rules() -> Vec<Box<dyn Rule>> {
23    vec![
24        // Capitalisation
25        Box::new(capitalisation::cp01::RuleCP01::default()),
26        Box::new(capitalisation::cp02::RuleCP02::default()),
27        Box::new(capitalisation::cp03::RuleCP03),
28        Box::new(capitalisation::cp04::RuleCP04),
29        Box::new(capitalisation::cp05::RuleCP05::default()),
30        // Layout
31        Box::new(layout::lt01::RuleLT01),
32        Box::new(layout::lt02::RuleLT02::default()),
33        Box::new(layout::lt03::RuleLT03),
34        Box::new(layout::lt04::RuleLT04::default()),
35        Box::new(layout::lt05::RuleLT05::default()),
36        Box::new(layout::lt06::RuleLT06),
37        Box::new(layout::lt07::RuleLT07),
38        Box::new(layout::lt08::RuleLT08),
39        Box::new(layout::lt09::RuleLT09),
40        Box::new(layout::lt10::RuleLT10),
41        Box::new(layout::lt11::RuleLT11),
42        Box::new(layout::lt12::RuleLT12),
43        Box::new(layout::lt13::RuleLT13),
44        Box::new(layout::lt14::RuleLT14),
45        Box::new(layout::lt15::RuleLT15::default()),
46        // Convention
47        Box::new(convention::cv01::RuleCV01::default()),
48        Box::new(convention::cv02::RuleCV02),
49        Box::new(convention::cv03::RuleCV03),
50        Box::new(convention::cv04::RuleCV04),
51        Box::new(convention::cv05::RuleCV05),
52        Box::new(convention::cv06::RuleCV06),
53        Box::new(convention::cv07::RuleCV07),
54        Box::new(convention::cv08::RuleCV08),
55        Box::new(convention::cv09::RuleCV09::default()),
56        Box::new(convention::cv10::RuleCV10::default()),
57        Box::new(convention::cv11::RuleCV11::default()),
58        Box::new(convention::cv12::RuleCV12),
59        // Aliasing
60        Box::new(aliasing::al01::RuleAL01),
61        Box::new(aliasing::al02::RuleAL02),
62        Box::new(aliasing::al03::RuleAL03),
63        Box::new(aliasing::al04::RuleAL04),
64        Box::new(aliasing::al05::RuleAL05),
65        Box::new(aliasing::al06::RuleAL06::default()),
66        Box::new(aliasing::al07::RuleAL07::default()),
67        Box::new(aliasing::al08::RuleAL08),
68        Box::new(aliasing::al09::RuleAL09),
69        // Ambiguous
70        Box::new(ambiguous::am01::RuleAM01),
71        Box::new(ambiguous::am02::RuleAM02),
72        Box::new(ambiguous::am03::RuleAM03),
73        Box::new(ambiguous::am04::RuleAM04),
74        Box::new(ambiguous::am05::RuleAM05),
75        Box::new(ambiguous::am06::RuleAM06),
76        Box::new(ambiguous::am07::RuleAM07),
77        Box::new(ambiguous::am08::RuleAM08),
78        Box::new(ambiguous::am09::RuleAM09),
79        // References
80        Box::new(references::rf01::RuleRF01),
81        Box::new(references::rf02::RuleRF02),
82        Box::new(references::rf03::RuleRF03),
83        Box::new(references::rf04::RuleRF04),
84        Box::new(references::rf05::RuleRF05),
85        Box::new(references::rf06::RuleRF06),
86        // Structure
87        Box::new(structure::st01::RuleST01),
88        Box::new(structure::st02::RuleST02),
89        Box::new(structure::st03::RuleST03),
90        Box::new(structure::st04::RuleST04),
91        Box::new(structure::st05::RuleST05),
92        Box::new(structure::st06::RuleST06),
93        Box::new(structure::st07::RuleST07),
94        Box::new(structure::st08::RuleST08),
95        Box::new(structure::st09::RuleST09),
96        Box::new(structure::st10::RuleST10),
97        Box::new(structure::st11::RuleST11),
98        Box::new(structure::st12::RuleST12),
99        // TSQL
100        Box::new(tsql::tq01::RuleTQ01),
101        Box::new(tsql::tq02::RuleTQ02),
102        Box::new(tsql::tq03::RuleTQ03),
103        // rigsql-specific
104        Box::new(rigsql::rg02::RuleRG02),
105        Box::new(rigsql::rg03::RuleRG03),
106        Box::new(rigsql::rg04::RuleRG04),
107        Box::new(rigsql::rg05::RuleRG05),
108    ]
109}