pub trait ContentLinter: Linter {
    // Required method
    fn run<'l>(
        &self,
        ctx: &ContentContext<'l>,
        out: &mut LintFormatter<'l, '_>
    ) -> Result<RunStatus<'l>>;

    // Provided method
    fn pre_run<'l>(
        &self,
        _file_ctx: &FilePathContext<'l>
    ) -> Result<RunStatus<'l>> { ... }
}
Expand description

Represents a linter that checks file contents.

Required Methods§

source

fn run<'l>( &self, ctx: &ContentContext<'l>, out: &mut LintFormatter<'l, '_> ) -> Result<RunStatus<'l>>

Executes the lint against the given content context.

Provided Methods§

source

fn pre_run<'l>(&self, _file_ctx: &FilePathContext<'l>) -> Result<RunStatus<'l>>

Pre-run step – avoids loading the contents if possible.

The default implementation returns Ok(RunStatus::Executed); individual lints may configure a more restricted set.

Implementors§