pub struct RiskScore {
pub total: f64,
pub size: f64,
pub complexity: f64,
pub diffusion: f64,
pub coverage: f64,
pub file_type: f64,
}Expand description
Composite risk score for a set of changes.
The total score is computed from weighted components using the formula:
total = 0.25*size + 0.25*complexity + 0.20*diffusion + 0.15*coverage + 0.15*file_type,
clamped to [0.0, 100.0].
§Examples
use argus_core::RiskScore;
let score = RiskScore::new(80.0, 60.0, 40.0, 20.0, 10.0);
assert!(score.total >= 0.0 && score.total <= 100.0);Fields§
§total: f64Weighted total risk (0–100).
size: f64Size component (0–100).
complexity: f64Complexity delta component (0–100).
diffusion: f64Diffusion component (0–100).
coverage: f64Coverage component (0–100).
file_type: f64File-type risk component (0–100).
Implementations§
Source§impl RiskScore
impl RiskScore
Sourcepub fn new(
size: f64,
complexity: f64,
diffusion: f64,
coverage: f64,
file_type: f64,
) -> Self
pub fn new( size: f64, complexity: f64, diffusion: f64, coverage: f64, file_type: f64, ) -> Self
Create a new risk score from individual components.
The total is computed automatically using the standard weighting formula
and clamped to [0.0, 100.0].
§Examples
use argus_core::RiskScore;
let score = RiskScore::new(100.0, 100.0, 100.0, 100.0, 100.0);
assert_eq!(score.total, 100.0);
let zero = RiskScore::new(0.0, 0.0, 0.0, 0.0, 0.0);
assert_eq!(zero.total, 0.0);Trait Implementations§
Source§impl<'de> Deserialize<'de> for RiskScore
impl<'de> Deserialize<'de> for RiskScore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RiskScore
impl RefUnwindSafe for RiskScore
impl Send for RiskScore
impl Sync for RiskScore
impl Unpin for RiskScore
impl UnsafeUnpin for RiskScore
impl UnwindSafe for RiskScore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more