diff_risk_core/detectors/mod.rs
1//! Detector plug-ins. Each detector inspects a [`Diff`] and emits
2//! [`Finding`](crate::report::Finding)s.
3//!
4//! The trait is object-safe and intentionally small — one method,
5//! one input, one output — so new detectors (async-boundary, serde-drift,
6//! etc.) can be slotted in without touching existing code.
7
8use crate::diff::Diff;
9use crate::report::Finding;
10
11pub mod async_boundary;
12pub mod auth;
13
14/// A detector inspects a parsed diff and produces zero or more findings.
15pub trait Detector: Send + Sync {
16 /// Short stable identifier (e.g. `"auth-gate"`), used in logs and --explain output.
17 fn name(&self) -> &'static str;
18
19 /// Inspect `diff` and return any findings this detector produces.
20 fn detect(&self, diff: &Diff) -> Vec<Finding>;
21}