pub trait Rule: Send + Sync {
// Required methods
fn id(&self) -> RuleId;
fn default_severity(&self) -> Severity;
fn run(&self, doc: &ParsedDocument, ctx: &RuleContext<'_>) -> Vec<Violation>;
// Provided method
fn applies_to(&self, file_type: FileType) -> bool { ... }
}Expand description
Trait implemented by every per-document lint rule.
Required Methods§
Sourcefn default_severity(&self) -> Severity
fn default_severity(&self) -> Severity
Severity when no config override applies.
Sourcefn run(&self, doc: &ParsedDocument, ctx: &RuleContext<'_>) -> Vec<Violation>
fn run(&self, doc: &ParsedDocument, ctx: &RuleContext<'_>) -> Vec<Violation>
Inspect one document and return any findings.
Provided Methods§
Sourcefn applies_to(&self, file_type: FileType) -> bool
fn applies_to(&self, file_type: FileType) -> bool
Whether this rule should run against files of the given type. Defaults to “AI guidance files only” — rules that also apply to generic Markdown / YAML must override this.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".