Skip to main content

Validator

Trait Validator 

Source
pub trait Validator: Send + Sync {
    // Required methods
    fn patterns(&self) -> &[&str];
    fn validate(&self, path: &Path, src: &str) -> Vec<Diagnostic>;

    // Provided method
    fn validate_batch(&self, _files: &[(PathBuf, String)]) -> Vec<Diagnostic> { ... }
}

Required Methods§

Source

fn patterns(&self) -> &[&str]

File glob patterns this validator claims (e.g. .claude/agents/**/*.md).

Source

fn validate(&self, path: &Path, src: &str) -> Vec<Diagnostic>

Validate src (the file contents) for path. Returns all diagnostics.

Provided Methods§

Source

fn validate_batch(&self, _files: &[(PathBuf, String)]) -> Vec<Diagnostic>

Cross-file validation called once after all per-file passes. Receives only the files claimed by this validator. Default implementation returns no diagnostics; override for rules that require global state (e.g. duplicate-name detection).

Implementors§