pub mod analyzers;
pub mod baseline;
pub mod blame;
pub mod config;
pub mod context;
pub mod domain;
pub mod error;
pub mod llm;
pub mod parsers;
pub mod reporters;
pub mod sources;
pub mod suppress;
pub mod workspace;
pub use config::Config;
pub use context::ProjectContext;
pub use domain::{
Attribution, ClaimKind, CodeFact, Confidence, Divergence, FactKind, Location, RuleId,
Severity, SpecClaim,
};
pub use error::SpecDriftError;
use analyzers::DriftAnalyzer;
use rayon::prelude::*;
pub fn run(ctx: &ProjectContext, analyzers: &[Box<dyn DriftAnalyzer>]) -> Vec<Divergence> {
let mut all: Vec<Divergence> = analyzers
.par_iter()
.flat_map_iter(|a| a.analyze(ctx))
.collect();
all.sort_by(|a, b| {
a.location
.file
.cmp(&b.location.file)
.then_with(|| a.location.line.cmp(&b.location.line))
.then_with(|| a.rule.as_str().cmp(b.rule.as_str()))
});
all
}
pub fn apply_config(
mut divs: Vec<Divergence>,
cfg: &Config,
root: &std::path::Path,
) -> Vec<Divergence> {
divs.retain(|d| !cfg.is_suppressed(d, root));
cfg.apply_severity_overrides(&mut divs);
divs
}
pub fn apply_strict(divs: &mut [Divergence]) {
for d in divs.iter_mut() {
if d.rule.confidence() != Confidence::Deterministic {
d.severity = d.severity.promoted();
}
}
}