1pub mod detectors;
12pub mod diff;
13pub mod report;
14pub mod scoring;
15
16pub use detectors::{async_boundary::AsyncBoundaryDetector, auth::AuthDetector, Detector};
17pub use diff::{parse_unified_diff, ChangedHunk, Diff, DiffError};
18pub use report::{Finding, RiskCategory, RiskReport, Severity};
19pub use scoring::score_findings;
20
21#[must_use]
23pub fn analyze(diff: &Diff) -> RiskReport {
24 analyze_with(diff, &default_detectors())
25}
26
27#[must_use]
29pub fn analyze_with(diff: &Diff, detectors: &[Box<dyn Detector>]) -> RiskReport {
30 let mut findings = Vec::new();
31 for detector in detectors {
32 findings.extend(detector.detect(diff));
33 }
34 let score = score_findings(&findings);
35 RiskReport { findings, score }
36}
37
38#[must_use]
40pub fn default_detectors() -> Vec<Box<dyn Detector>> {
41 vec![
42 Box::new(AuthDetector::new()),
43 Box::new(AsyncBoundaryDetector::new()),
44 ]
45}