Skip to main content

Rule

Trait Rule 

Source
pub trait Rule: Send + Sync {
    // Required methods
    fn check(
        &self,
        state: &mut RuleState,
        line: u32,
        instruction: &Instruction,
        shell: Option<&ParsedShell>,
    );
    fn code(&self) -> &RuleCode;
    fn severity(&self) -> Severity;
    fn message(&self) -> &str;

    // Provided method
    fn finalize(&self, state: RuleState) -> Vec<CheckFailure> { ... }
}
Expand description

A rule that can check Dockerfile instructions.

Required Methods§

Source

fn check( &self, state: &mut RuleState, line: u32, instruction: &Instruction, shell: Option<&ParsedShell>, )

Check an instruction and potentially add failures to the state.

Source

fn code(&self) -> &RuleCode

Get the rule code.

Source

fn severity(&self) -> Severity

Get the default severity.

Source

fn message(&self) -> &str

Get the rule message.

Provided Methods§

Source

fn finalize(&self, state: RuleState) -> Vec<CheckFailure>

Finalize the rule and return any additional failures. Called after all instructions have been processed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F, D> Rule for VeryCustomRule<F, D>

Source§

impl<F> Rule for CustomRule<F>

Source§

impl<F> Rule for SimpleRule<F>
where F: Fn(&Instruction, Option<&ParsedShell>) -> bool + Send + Sync,