Skip to main content

LintRule

Trait LintRule 

Source
pub trait LintRule {
    // Required methods
    fn id(&self) -> &'static str;
    fn check(&self, doc: &SurfDoc, source: &str) -> Vec<Diagnostic>;
}
Expand description

A single style-layer lint rule.

Required Methods§

Source

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

Stable rule id, e.g. "L001". Must have an entry in spec/rules.toml.

Source

fn check(&self, doc: &SurfDoc, source: &str) -> Vec<Diagnostic>

Check a parsed document against this rule.

source is the CRLF-normalised source text the spans refer to (i.e. doc.source).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§