MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / validate

Method validate

atomic-audit/src/risk.rs:55–81  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

53
54impl RiskProfile {
55 pub fn validate(&self) -> Result<(), &'static str> {
56 if self.name.trim().is_empty()
57 || self.api_growth == 0
58 || [
59 self.broad_functions,
60 self.broad_files,
61 self.broad_components,
62 self.api_functions,
63 self.api_components,
64 self.propagation_callers,
65 self.propagation_files,
66 self.moderate_functions,
67 self.moderate_files,
68 self.moderate_callers,
69 ]
70 .contains(&0)
71 {
72 return Err("risk profile requires a nonempty name and positive thresholds");
73 }
74 if self.broad_functions < self.moderate_functions
75 || self.broad_files < self.moderate_files
76 || self.propagation_callers < self.moderate_callers
77 {
78 return Err("high-risk thresholds cannot be below corresponding moderate thresholds");
79 }
80 Ok(())
81 }
82}
83
84#[derive(Clone, Debug, Default, Serialize, Deserialize)]

Callers 1

assessFunction · 0.45

Calls 2

is_emptyMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected