Skip to main content

Crate diff_risk_core

Crate diff_risk_core 

Source
Expand description

Core risk-scoring engine for diff-risk.

Parses unified diffs, runs a pipeline of Detectors against the changed regions, and aggregates findings into a RiskReport with an overall 0.0–10.0 score.

The CLI front-end lives in the diff-risk-cli crate; this crate is deliberately I/O-free so it can be embedded in editors, pre-commit hooks, and CI tooling.

Re-exports§

pub use detectors::async_boundary::AsyncBoundaryDetector;
pub use detectors::auth::AuthDetector;
pub use detectors::Detector;
pub use diff::parse_unified_diff;
pub use diff::ChangedHunk;
pub use diff::Diff;
pub use diff::DiffError;
pub use report::Finding;
pub use report::RiskCategory;
pub use report::RiskReport;
pub use report::Severity;
pub use scoring::score_findings;

Modules§

detectors
Detector plug-ins. Each detector inspects a Diff and emits Findings.
diff
Minimal unified-diff parser.
report
Output types: Finding, RiskReport, and supporting enums.
scoring
Scoring function — turns a flat list of findings into a 0.0–10.0 score.

Functions§

analyze
Run the default detector suite against a parsed Diff and return a RiskReport.
analyze_with
Run an explicit set of detectors against a parsed Diff.
default_detectors
The detector suite applied by analyze.