Skip to main content

Check

Trait Check 

Source
pub trait Check: Sync {
    // Required methods
    fn name(&self) -> &str;
    fn stage(&self) -> Stage;
    fn scope(&self) -> Scope;
    fn severity(&self) -> Severity;
    fn run(&self, ctx: &Ctx<'_>) -> Outcome;

    // Provided methods
    fn fix(&self) -> Fix { ... }
    fn reach(&self) -> Reach { ... }
}
Expand description

One check, whether compiled in or declared by the repository.

Sync because pre-commit hands every check to its own thread. Both implementations satisfy it for free, and requiring it here is what lets the dispatcher hold &'static dyn Check without caring which kind it has.

Required Methods§

Source

fn name(&self) -> &str

Source

fn stage(&self) -> Stage

Source

fn scope(&self) -> Scope

Source

fn severity(&self) -> Severity

Source

fn run(&self, ctx: &Ctx<'_>) -> Outcome

Provided Methods§

Source

fn fix(&self) -> Fix

Whether this check can repair what it finds. None for almost all.

Source

fn reach(&self) -> Reach

How far the check reaches when amont.conventions is declared — see Reach. Externals default to Convention, which costs them nothing: a declared check only exists where an amont.conf does, and that is exactly the declaration the mode asks for.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§