pub trait Check {
// Required methods
fn id(&self) -> &'static str;
fn evaluate(&self, ctx: &CheckCtx<'_>) -> CheckOutput;
// Provided methods
fn enabled_by_default(&self) -> bool { ... }
fn applicability(&self, _ctx: &CheckCtx<'_>) -> Applicability { ... }
}Expand description
A lint check that can inspect a document and emit typed evaluation coverage plus structured content findings.
Custom embedders may implement this trait and pass their checks to
crate::evaluate_checks alongside, or instead of, all_checks.
Implementors should keep both methods panic-free for loader-valid
documents. Applicability describes whether declared work exists;
unavailable prerequisites or measurements belong in typed coverage gaps
returned from Check::evaluate. Custom checks should use namespaced
scope and gap codes. Built-in code values are reserved to the checks named
by animsmith’s evidence-code authority, and the evaluation boundary rejects
a built-in value emitted by any other check id.
Required Methods§
Sourcefn id(&self) -> &'static str
fn id(&self) -> &'static str
Stable identifier, e.g. "loop-seam". Used in config, JSON
output, and --select.
Sourcefn evaluate(&self, ctx: &CheckCtx<'_>) -> CheckOutput
fn evaluate(&self, ctx: &CheckCtx<'_>) -> CheckOutput
Evaluate every modelled work unit, returning content findings and explicit coverage. Missing prerequisites are gaps, never findings.
Provided Methods§
Sourcefn enabled_by_default(&self) -> bool
fn enabled_by_default(&self) -> bool
Whether the check runs when its configuration has no explicit
severity setting.
Most checks are enabled by default. Checks for intentionally opt-in
policy signals may return false; setting their severity to note,
warn, or error enables them, while off keeps them disabled.
Sourcefn applicability(&self, _ctx: &CheckCtx<'_>) -> Applicability
fn applicability(&self, _ctx: &CheckCtx<'_>) -> Applicability
Whether this document and configuration declare work for the check.
The runner calls this cheap predicate even for disabled or unselected checks so applicability remains an independent result dimension. It must not perform the check’s substantive evaluation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".