Trait x_lint::content::ContentLinter
source · 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§
sourcefn run<'l>(
&self,
ctx: &ContentContext<'l>,
out: &mut LintFormatter<'l, '_>
) -> Result<RunStatus<'l>>
fn run<'l>( &self, ctx: &ContentContext<'l>, out: &mut LintFormatter<'l, '_> ) -> Result<RunStatus<'l>>
Executes the lint against the given content context.
Provided Methods§
sourcefn pre_run<'l>(&self, _file_ctx: &FilePathContext<'l>) -> Result<RunStatus<'l>>
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.