pub struct RepoCraftMetrics {
pub schema_version: u32,
pub cognitive_complexity: Option<CraftPercentiles>,
pub function_length: Option<CraftDistribution>,
pub nesting_depth: Option<CraftDistribution>,
pub file_size_bytes: Option<CraftDistribution>,
pub duplication_ratio: Option<f64>,
pub duplicate_subtree_count: u32,
}Expand description
Repo-level deterministic code-legibility metrics (weft#1389). Ranking reads this as the ‘craft’ axis, distinct from intent/clarity. Schema version stamps the formula so a recompute is tractable when the metric definition changes. Per-language values are not assumed comparable; aggregation is over the versioned “code” language list.
Fields§
§schema_version: u32Formula/schema stamp. Bump when cognitive-complexity, structural-shape, or duplication definitions change so stored rows can be recomputed.
cognitive_complexity: Option<CraftPercentiles>Sonar cognitive complexity, per function, as median / p90.
function_length: Option<CraftDistribution>Function-length distribution (lines).
nesting_depth: Option<CraftDistribution>Maximum nesting-depth distribution (levels).
file_size_bytes: Option<CraftDistribution>File-size distribution (bytes).
duplication_ratio: Option<f64>Fraction of hashed subtrees that collide with another subtree in the same repo. Absent when duplication was not computed.
duplicate_subtree_count: u32Count of distinct subtree-hash collisions. 0 when none or uncomputed.
Implementations§
Source§impl RepoCraftMetrics
impl RepoCraftMetrics
Sourcepub fn duplication_ratio(&self) -> f64
pub fn duplication_ratio(&self) -> f64
Returns the value of duplication_ratio, or the default value if duplication_ratio is unset.
Trait Implementations§
Source§impl Clone for RepoCraftMetrics
impl Clone for RepoCraftMetrics
Source§fn clone(&self) -> RepoCraftMetrics
fn clone(&self) -> RepoCraftMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RepoCraftMetrics
Source§impl Debug for RepoCraftMetrics
impl Debug for RepoCraftMetrics
Source§impl Default for RepoCraftMetrics
impl Default for RepoCraftMetrics
Source§impl Message for RepoCraftMetrics
impl Message for RepoCraftMetrics
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.