pub enum MetricScope {
File,
Function,
Container,
}Expand description
The space kind a metric’s threshold is meaningful on (issue #969).
A threshold gate (bca check, the Python to_sarif binding) walks
every crate::FuncSpace — the file-level SpaceKind::Unit root,
every container (class / impl / …), and every individual function.
For the subtree-summed accessors a metric’s value at any space that
owns children is a sum across many functions, so a per-function
limit would fire on every non-trivial file and multi-method impl.
Scope records the kind each metric actually measures so the front-ends
gate it there and nowhere else — keeping the CLI gate and the binding
in lockstep, the same way Direction keeps their breach direction
aligned.
Variants§
File
Gate only the whole-file SpaceKind::Unit root — the loc.*
size family, whose limit is a per-file ceiling.
Function
Gate only individual function spaces (SpaceKind::Function —
free functions, methods, closures). The per-function complexity
metrics (cognitive, cyclomatic, abc, mi.) and the subtree sums
that describe one function and its nested closures (halstead.,
nargs, nexits, tokens) live here.
Container
Gate only container spaces that own methods (class / struct /
trait / impl / namespace / interface) — the object-oriented size
metrics nom, wmc, npm, npa.
Implementations§
Trait Implementations§
Source§impl Clone for MetricScope
impl Clone for MetricScope
Source§fn clone(&self) -> MetricScope
fn clone(&self) -> MetricScope
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 MetricScope
Source§impl Debug for MetricScope
impl Debug for MetricScope
impl Eq for MetricScope
Source§impl Hash for MetricScope
impl Hash for MetricScope
Source§impl PartialEq for MetricScope
impl PartialEq for MetricScope
Source§fn eq(&self, other: &MetricScope) -> bool
fn eq(&self, other: &MetricScope) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MetricScope
Auto Trait Implementations§
impl Freeze for MetricScope
impl RefUnwindSafe for MetricScope
impl Send for MetricScope
impl Sync for MetricScope
impl Unpin for MetricScope
impl UnsafeUnpin for MetricScope
impl UnwindSafe for MetricScope
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> 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.