Skip to main content

ailint_core/rules/structural/
mod.rs

1//! Structural rules: schema / frontmatter / required-section validation.
2//! Range: **AIL001 – AIL099**.
3
4pub mod broken_local_link;
5pub mod empty_file;
6pub mod frontmatter_schema;
7pub mod malformed_yaml;
8pub mod required_section;
9
10pub use broken_local_link::BrokenLocalLinkRule;
11pub use empty_file::EmptyFileRule;
12pub use frontmatter_schema::FrontmatterSchemaRule;
13pub use malformed_yaml::MalformedYamlRule;
14pub use required_section::MissingRequiredSectionRule;
15
16use crate::rules::{Rule, RuleId};
17
18/// AIL001: frontmatter fails the schema expected for its file type.
19pub const AIL001: RuleId = RuleId::new(1, "no-frontmatter-schema-error");
20/// AIL002: guidance file is empty or whitespace-only.
21pub const AIL002: RuleId = RuleId::new(2, "instructions-file-empty");
22/// AIL003: a section required for this file type is missing.
23pub const AIL003: RuleId = RuleId::new(3, "missing-required-section");
24/// AIL040: relative link points at a file that does not exist.
25pub const AIL040: RuleId = RuleId::new(40, "broken-local-link");
26/// AIL041: YAML file (or frontmatter) fails to parse.
27pub const AIL041: RuleId = RuleId::new(41, "malformed-yaml");
28
29/// All structural rules, in registration order.
30pub fn all_rules() -> Vec<Box<dyn Rule>> {
31    vec![
32        Box::new(EmptyFileRule),
33        Box::new(FrontmatterSchemaRule),
34        Box::new(MissingRequiredSectionRule),
35        Box::new(BrokenLocalLinkRule),
36        Box::new(MalformedYamlRule),
37    ]
38}