Skip to main content

BatchRule

Trait BatchRule 

Source
pub trait BatchRule: Send + Sync {
    // Required methods
    fn id(&self) -> RuleId;
    fn default_severity(&self) -> Severity;
    fn description(&self) -> &'static str;
    fn fix_hint(&self) -> &'static str;
    fn run_batch(
        &self,
        docs: &[ParsedDocument],
        ctx: &RuleContext<'_>,
    ) -> Vec<Violation>;

    // Provided method
    fn applies_to(&self, file_type: FileType) -> bool { ... }
}
Expand description

Trait implemented by rules that need the full corpus at once (cross-file consistency checks).

Required Methods§

Source

fn id(&self) -> RuleId

This rule’s stable identifier.

Source

fn default_severity(&self) -> Severity

Severity when no config override applies.

Source

fn description(&self) -> &'static str

One-line human description of what the rule enforces.

Source

fn fix_hint(&self) -> &'static str

One-line suggested remediation.

Source

fn run_batch( &self, docs: &[ParsedDocument], ctx: &RuleContext<'_>, ) -> Vec<Violation>

Inspect the whole corpus at once and return any findings.

Provided Methods§

Source

fn applies_to(&self, file_type: FileType) -> bool

Filter applied to each document before the batch rule sees it. Defaults to “AI guidance files only”.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§