pub enum MetricKind {
Cognitive,
Cyclomatic,
Halstead,
Loc,
Mi,
Nargs,
Nom,
Npa,
Npm,
Abc,
Exit,
Wmc,
}Expand description
Stable metric identifier set that suppression markers can name.
Names match the JSON field names emitted on crate::CodeMetrics
(and on the per-metric bca threshold registry). Unknown
identifiers in a bca: suppress(...) list produce a hard error so a
typo cannot silently widen suppression scope to other metrics or be
dropped on the floor.
Variants§
Cognitive
Cognitive complexity.
Cyclomatic
Cyclomatic complexity (both standard and modified variants).
Halstead
Halstead suite.
Loc
Lines-of-code suite (sloc, ploc, lloc, cloc, blank).
Mi
Maintainability Index suite.
Nargs
Number of arguments.
Nom
Number of methods / functions.
Npa
Number of public attributes.
Npm
Number of public methods.
Abc
ABC (assignments, branches, conditions) magnitude.
Exit
Number of exit points.
Wmc
Weighted methods per class.
Implementations§
Source§impl MetricKind
impl MetricKind
Sourcepub const ALL: &'static [Self]
pub const ALL: &'static [Self]
Every MetricKind variant, in alphabetical order. Used to
render the “known metrics:” hint in error messages; the test
metric_kind_all_is_alphabetical locks the order so the hint
stays predictable across releases.
Sourcepub fn for_threshold_name(name: &str) -> Option<Self>
pub fn for_threshold_name(name: &str) -> Option<Self>
Resolve a sub-metric threshold name (e.g. cyclomatic.modified,
halstead.volume, loc.lloc) to its parent MetricKind.
The threshold engine uses dotted forms to address individual
sub-metrics, but suppression markers only know about the
top-level metric family — silencing halstead silences all of
halstead.volume, halstead.effort, etc. This translation
happens here so the threshold-check loop can ask one question
(“does this scope cover this metric family?”) instead of
special-casing each dotted name.
Trait Implementations§
Source§impl Clone for MetricKind
impl Clone for MetricKind
Source§fn clone(&self) -> MetricKind
fn clone(&self) -> MetricKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetricKind
impl Debug for MetricKind
Source§impl Display for MetricKind
impl Display for MetricKind
Source§impl FromStr for MetricKind
impl FromStr for MetricKind
Source§impl Hash for MetricKind
impl Hash for MetricKind
Source§impl Ord for MetricKind
impl Ord for MetricKind
Source§fn cmp(&self, other: &MetricKind) -> Ordering
fn cmp(&self, other: &MetricKind) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for MetricKind
impl PartialEq for MetricKind
Source§fn eq(&self, other: &MetricKind) -> bool
fn eq(&self, other: &MetricKind) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for MetricKind
impl PartialOrd for MetricKind
Source§impl Serialize for MetricKind
impl Serialize for MetricKind
impl Copy for MetricKind
impl Eq for MetricKind
impl StructuralPartialEq for MetricKind
Auto Trait Implementations§
impl Freeze for MetricKind
impl RefUnwindSafe for MetricKind
impl Send for MetricKind
impl Sync for MetricKind
impl Unpin for MetricKind
impl UnsafeUnpin for MetricKind
impl UnwindSafe for MetricKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.