pub trait CheckSource: Send + Sync {
// Required methods
fn source_id(&self) -> &str;
fn supports_config(&self, config: &CheckConfig) -> bool;
fn run(
&self,
config: &CheckConfig,
state: &RepoState,
) -> Result<CheckResult, CheckSourceError>;
}Expand description
Object-safe trait. Implementations are stored as Box<dyn CheckSource>
in the source registry.
Required Methods§
Sourcefn source_id(&self) -> &str
fn source_id(&self) -> &str
Stable identifier for this source (e.g. "shell", "pre_commit",
"plugin:klasp-plugin-foo"). Tied to &self lifetime — see module
docs for why this isn’t &'static str.
Sourcefn supports_config(&self, config: &CheckConfig) -> bool
fn supports_config(&self, config: &CheckConfig) -> bool
Pre-flight check: does this source know how to handle the given
CheckConfig? Used by the registry to dispatch a check to the
right source.
Sourcefn run(
&self,
config: &CheckConfig,
state: &RepoState,
) -> Result<CheckResult, CheckSourceError>
fn run( &self, config: &CheckConfig, state: &RepoState, ) -> Result<CheckResult, CheckSourceError>
Execute the check and return a structured result.
Errors here are runtime failures (process spawn errors, malformed
output) — semantic failures (lint hits, test failures) ride inside
Verdict::Fail. Use CheckSourceError::Other for impl-specific
errors that don’t fit the predefined variants.