pub trait LintRule: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn check(&self, doc: &Document, out: &mut Vec<Diagnostic>);
// Provided methods
fn is_default(&self) -> bool { ... }
fn is_advisory(&self) -> bool { ... }
fn produces_fix(&self) -> bool { ... }
fn explain(&self) -> &str { ... }
}Expand description
A lint check. Implementors may be unit structs (stdlib rules) or carry configuration (regex patterns, allowlists, …).
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
One-line summary for mdwright list-rules.
Sourcefn check(&self, doc: &Document, out: &mut Vec<Diagnostic>)
fn check(&self, doc: &Document, out: &mut Vec<Diagnostic>)
Run the check against a parsed document. Append diagnostics
to out. The dispatcher fills in each diagnostic’s rule
and advisory fields from self.name() and
self.is_advisory() after the call returns.
Provided Methods§
Sourcefn is_default(&self) -> bool
fn is_default(&self) -> bool
Whether this rule is enabled in
RuleSet::stdlib_defaults.
Most rules are on by default; the few opinionated or
repair-focused checks return false.
Sourcefn is_advisory(&self) -> bool
fn is_advisory(&self) -> bool
Advisory rules emit informational diagnostics that do not
fail mdwright check --check. Their output still prints.
Sourcefn produces_fix(&self) -> bool
fn produces_fix(&self) -> bool
Whether this rule can emit a crate::Fix. Used by
mdwright list-rules and the generated rule docs. Defaults
to false; stdlib rules that emit fixes override.