pub trait Rule: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn name(&self) -> &str;
fn description(&self) -> &str;
fn category(&self) -> RuleCategory;
fn default_severity(&self) -> Severity;
fn evaluate(
&self,
ctx: &RuleContext<'_>,
config: &RuleConfig,
) -> Vec<RuleViolation>;
}Expand description
A single quality rule that can be evaluated against a project.
Rules are stateless: all data comes via RuleContext.
Each rule has a unique ID (e.g. “freshness/stale-doc”),
a default severity, and a category.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Short description of what this rule checks.
Sourcefn category(&self) -> RuleCategory
fn category(&self) -> RuleCategory
Category this rule belongs to.
Sourcefn default_severity(&self) -> Severity
fn default_severity(&self) -> Severity
Default severity when the rule is violated.
Sourcefn evaluate(
&self,
ctx: &RuleContext<'_>,
config: &RuleConfig,
) -> Vec<RuleViolation>
fn evaluate( &self, ctx: &RuleContext<'_>, config: &RuleConfig, ) -> Vec<RuleViolation>
Evaluate the rule against the project context. Returns zero or more violations.