Skip to main content

ComplexityViolation

Struct ComplexityViolation 

Source
pub struct ComplexityViolation {
Show 24 fields pub path: PathBuf, pub name: String, pub line: u32, pub col: u32, pub cyclomatic: u16, pub cognitive: u16, pub line_count: u32, pub param_count: u8, pub react_hook_count: u16, pub react_jsx_max_depth: u16, pub react_prop_count: u16, pub react_hook_profile: Option<ReactHookProfile>, pub exceeded: ExceededThreshold, pub severity: FindingSeverity, pub effective_severity: Option<EffectiveSeverity>, pub crap: Option<f64>, pub coverage_pct: Option<f64>, pub coverage_tier: Option<CoverageTier>, pub coverage_source: Option<CoverageSource>, pub inherited_from: Option<PathBuf>, pub component_rollup: Option<ComponentRollup>, pub contributions: Vec<ComplexityContribution>, pub effective_thresholds: Option<HealthEffectiveThresholds>, pub threshold_source: Option<ThresholdSource>,
}
Expand description

Inner complexity-violation payload.

Fields§

§path: PathBuf

File path relative to the project root.

§name: String

Function name, or a synthesized name for anonymous functions.

§line: u32

1-based line the function starts on.

§col: u32

1-based column the function starts on.

§cyclomatic: u16

Cyclomatic complexity of the function.

§cognitive: u16

Cognitive complexity of the function.

§line_count: u32

Lines of code in the function body.

§param_count: u8

Number of declared parameters.

§react_hook_count: u16

Number of React hook calls in this function’s body (useState / useEffect / useMemo / useCallback / custom use*). Descriptive hotspot context for React components; omitted when zero (non-React).

§react_jsx_max_depth: u16

Deepest JSX element nesting reached in this function’s body. Descriptive hotspot context; omitted when zero (renders no JSX).

§react_prop_count: u16

Number of props destructured from this component’s first parameter. Descriptive hotspot context; omitted when zero.

§react_hook_profile: Option<ReactHookProfile>

Per-kind React hook breakdown (state/effect/memo/callback/custom) plus the max useEffect dependency-array arity, derived from the cached hook_uses IR at the health layer. Descriptive refinement of react_hook_count; present only when at least one component-scope hook was attributed, so non-React findings stay byte-identical.

§exceeded: ExceededThreshold

Which metric crossed its threshold.

§severity: FindingSeverity

Finding severity derived from how far thresholds were crossed.

§effective_severity: Option<EffectiveSeverity>

Gate severity after the complexity-* rules and their overrides[].rules entries: error fails the run, warn does not. The most severe rule of the kinds in exceeded wins. It is separate from the band in severity, which ranks the finding and does not gate it. Absent in reports from older versions.

§crap: Option<f64>

CRAP score (change risk anti-pattern), when coverage data exists.

§coverage_pct: Option<f64>

Test coverage percentage (0-100) backing the CRAP score.

§coverage_tier: Option<CoverageTier>

Coverage tier bucket.

Derived from coverage_pct when coverage was measured. When coverage_source is estimated, coverage_pct is absent and the tier describes the static estimate behind the CRAP score rather than an observation, so read the two fields together.

§coverage_source: Option<CoverageSource>

Provenance of the coverage signal.

§inherited_from: Option<PathBuf>

Component file the inherited coverage estimate came from, for component-inherited coverage.

§component_rollup: Option<ComponentRollup>

Aggregate of the enclosing component’s findings, when rolled up.

§contributions: Vec<ComplexityContribution>

Per-decision-point complexity breakdown explaining WHICH constructs drove the cyclomatic and cognitive scores. Populated only when the caller opts in via health --complexity-breakdown; empty (and omitted from JSON) otherwise so default and CI output stay lean.

§effective_thresholds: Option<HealthEffectiveThresholds>

Resolved thresholds used for this finding when a config override changed at least one ceiling. Omitted for findings using global thresholds.

§threshold_source: Option<ThresholdSource>

Source of the effective thresholds. Omitted when thresholds are global.

Implementations§

Source§

impl ComplexityViolation

Source

pub fn blocks(&self) -> bool

Whether the finding fails the run.

A warn gate severity does not block. A finding without the field, for example from an older saved report, blocks as before.

Source

pub fn resolved_thresholds( &self, summary: &HealthSummary, ) -> HealthEffectiveThresholds

Ceilings this finding was actually evaluated against: the per-file thresholdOverrides result when an override matched, otherwise the run’s global summary ceilings.

Every renderer that prints or compares a threshold must go through this so a finding is never described against a ceiling it was not measured with.

Trait Implementations§

Source§

impl Clone for ComplexityViolation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ComplexityViolation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ComplexityViolation

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<ComplexityViolation> for HealthFinding

Source§

fn from(violation: ComplexityViolation) -> Self

Wrap a violation with empty actions and no introduced flag.

Source§

impl Serialize for ComplexityViolation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more