#[non_exhaustive]pub struct Stats { /* private fields */ }Expand description
The Npa metric.
This metric counts the number of public attributes of classes/interfaces.
Emitted on container spaces — SpaceKind::Class, Struct,
Trait, Impl, Namespace, Interface — and on the
SpaceKind::Unit file root that rolls them up. Never on a
SpaceKind::Function space, which owns no members of its own.
Since #1203 that holds by construction rather than by convention:
the space’s own kind is the only input, so no language can disagree
with it in either direction. Wmc decides the
same way. A language with no class-shaped construct at all — C, Bash,
Lua, Perl, Tcl — emits no block anywhere rather than an all-zero one
on each file root.
The rule governs the block, not the counts behind it: those roll up through every enclosing space regardless, so a type declared inside a function body is reported by the nearest enclosing container, or by the file root when there is none.
Implementations§
Source§impl Stats
impl Stats
Sourcepub fn interface_npa(&self) -> u64
pub fn interface_npa(&self) -> u64
Returns the number of interface public attributes in a space.
Sourcepub fn interface_na(&self) -> u64
pub fn interface_na(&self) -> u64
Returns the number of interface attributes in a space.
Sourcepub fn class_npa_sum(&self) -> u64
pub fn class_npa_sum(&self) -> u64
Returns the number of class public attributes sum in a space.
Sourcepub fn interface_npa_sum(&self) -> u64
pub fn interface_npa_sum(&self) -> u64
Returns the number of interface public attributes sum in a space.
Sourcepub fn class_na_sum(&self) -> u64
pub fn class_na_sum(&self) -> u64
Returns the number of class attributes sum in a space.
Sourcepub fn interface_na_sum(&self) -> u64
pub fn interface_na_sum(&self) -> u64
Returns the number of interface attributes sum in a space.
Sourcepub fn class_cda(&self) -> f64
pub fn class_cda(&self) -> f64
Returns the class Cda metric value
The Class Data Accessibility metric value for a class
is computed by dividing the Npa value of the class
by the total number of attributes defined in the class.
This metric is an adaptation of the Classified Class Data Accessibility (CCDA)
security metric for not classified attributes.
Paper: https://ieeexplore.ieee.org/abstract/document/5381538
Sourcepub fn interface_cda(&self) -> f64
pub fn interface_cda(&self) -> f64
Returns the interface Cda metric value
The Class Data Accessibility metric value for an interface
is computed by dividing the Npa value of the interface
by the total number of attributes defined in the interface.
This metric is an adaptation of the Classified Class Data Accessibility (CCDA)
security metric for not classified attributes.
Paper: https://ieeexplore.ieee.org/abstract/document/5381538
Sourcepub fn total_cda(&self) -> f64
pub fn total_cda(&self) -> f64
Returns the total Cda metric value
The total Class Data Accessibility metric value
is computed by dividing the total Npa value
by the total number of attributes.
This metric is an adaptation of the Classified Class Data Accessibility (CCDA)
security metric for not classified attributes.
Paper: https://ieeexplore.ieee.org/abstract/document/5381538