#[non_exhaustive]pub struct Stats { /* private fields */ }Expand description
The Npm metric.
This metric counts the number of public methods 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_npm(&self) -> u64
pub fn interface_npm(&self) -> u64
Returns the number of interface public methods in a space.
Sourcepub fn interface_nm(&self) -> u64
pub fn interface_nm(&self) -> u64
Returns the number of interface methods in a space.
Sourcepub fn class_npm_sum(&self) -> u64
pub fn class_npm_sum(&self) -> u64
Returns the number of class public methods sum in a space.
Sourcepub fn interface_npm_sum(&self) -> u64
pub fn interface_npm_sum(&self) -> u64
Returns the number of interface public methods sum in a space.
Sourcepub fn class_nm_sum(&self) -> u64
pub fn class_nm_sum(&self) -> u64
Returns the number of class methods sum in a space.
Sourcepub fn interface_nm_sum(&self) -> u64
pub fn interface_nm_sum(&self) -> u64
Returns the number of interface methods sum in a space.
Sourcepub fn class_coa(&self) -> f64
pub fn class_coa(&self) -> f64
Returns the class Coa metric value
The Class Operation Accessibility metric value for a class
is computed by dividing the Npm value of the class
by the total number of methods defined in the class.
This metric is an adaptation of the Classified Operation Accessibility (COA)
security metric for not classified methods.
Paper: https://ieeexplore.ieee.org/abstract/document/5381538
Sourcepub fn interface_coa(&self) -> f64
pub fn interface_coa(&self) -> f64
Returns the interface Coa metric value
The Class Operation Accessibility metric value for an interface
is computed by dividing the Npm value of the interface
by the total number of methods defined in the interface.
This metric is an adaptation of the Classified Operation Accessibility (COA)
security metric for not classified methods.
Paper: https://ieeexplore.ieee.org/abstract/document/5381538
Sourcepub fn total_coa(&self) -> f64
pub fn total_coa(&self) -> f64
Returns the total Coa metric value
The total Class Operation Accessibility metric value
is computed by dividing the total Npm value
by the total number of methods.
This metric is an adaptation of the Classified Operation Accessibility (COA)
security metric for not classified methods.
Paper: https://ieeexplore.ieee.org/abstract/document/5381538