Skip to main content

DebtType

Enum DebtType 

Source
pub enum DebtType {
Show 35 variants Todo { reason: Option<String>, }, Fixme { reason: Option<String>, }, CodeSmell { smell_type: Option<String>, }, Complexity { cyclomatic: u32, cognitive: u32, }, Dependency { dependency_type: Option<String>, }, ResourceManagement { issue_type: Option<String>, }, CodeOrganization { issue_type: Option<String>, }, TestComplexity { cyclomatic: u32, cognitive: u32, }, TestQuality { issue_type: Option<String>, }, TestingGap { coverage: f64, cyclomatic: u32, cognitive: u32, }, ComplexityHotspot { cyclomatic: u32, cognitive: u32, }, DeadCode { visibility: FunctionVisibility, cyclomatic: u32, cognitive: u32, usage_hints: Vec<String>, }, Duplication { instances: u32, total_lines: u32, }, Risk { risk_score: f64, factors: Vec<String>, }, TestComplexityHotspot { cyclomatic: u32, cognitive: u32, threshold: u32, }, TestTodo { priority: Priority, reason: Option<String>, }, TestDuplication { instances: u32, total_lines: u32, similarity: f64, }, ErrorSwallowing { pattern: String, context: Option<String>, }, AllocationInefficiency { pattern: String, impact: String, }, StringConcatenation { loop_type: String, iterations: Option<u32>, }, NestedLoops { depth: u32, complexity_estimate: String, }, BlockingIO { operation: String, context: String, }, SuboptimalDataStructure { current_type: String, recommended_type: String, }, GodObject { methods: u32, fields: Option<u32>, responsibilities: u32, god_object_score: f64, lines: u32, }, FeatureEnvy { external_class: String, usage_ratio: f64, }, PrimitiveObsession { primitive_type: String, domain_concept: String, }, MagicValues { value: String, occurrences: u32, }, AssertionComplexity { assertion_count: u32, complexity_score: f64, }, FlakyTestPattern { pattern_type: String, reliability_impact: String, }, AsyncMisuse { pattern: String, performance_impact: String, }, ResourceLeak { resource_type: String, cleanup_missing: String, }, CollectionInefficiency { collection_type: String, inefficiency_type: String, }, ScatteredType { type_name: String, total_methods: usize, file_count: usize, severity: String, }, OrphanedFunctions { target_type: String, function_count: usize, file_count: usize, }, UtilitiesSprawl { function_count: usize, distinct_types: usize, },
}
Expand description

Types of technical debt that debtmap can identify.

Each variant captures specific metrics relevant to that type of debt. The enum is designed to be:

  • Exhaustive: covers all detected debt patterns
  • Self-describing: variant names indicate the issue type
  • Data-rich: captures relevant metrics for prioritization

Variants§

§

Todo

Fields

§reason: Option<String>
§

Fixme

Fields

§reason: Option<String>
§

CodeSmell

Fields

§smell_type: Option<String>
§

Complexity

Fields

§cyclomatic: u32
§cognitive: u32
§

Dependency

Fields

§dependency_type: Option<String>
§

ResourceManagement

Fields

§issue_type: Option<String>
§

CodeOrganization

Fields

§issue_type: Option<String>
§

TestComplexity

Fields

§cyclomatic: u32
§cognitive: u32
§

TestQuality

Fields

§issue_type: Option<String>
§

TestingGap

Fields

§coverage: f64
§cyclomatic: u32
§cognitive: u32
§

ComplexityHotspot

Fields

§cyclomatic: u32
§cognitive: u32
§

DeadCode

Fields

§cyclomatic: u32
§cognitive: u32
§usage_hints: Vec<String>
§

Duplication

Fields

§instances: u32
§total_lines: u32
§

Risk

Fields

§risk_score: f64
§factors: Vec<String>
§

TestComplexityHotspot

Fields

§cyclomatic: u32
§cognitive: u32
§threshold: u32
§

TestTodo

Fields

§priority: Priority
§reason: Option<String>
§

TestDuplication

Fields

§instances: u32
§total_lines: u32
§similarity: f64
§

ErrorSwallowing

Fields

§pattern: String
§context: Option<String>
§

AllocationInefficiency

Fields

§pattern: String
§impact: String
§

StringConcatenation

Fields

§loop_type: String
§iterations: Option<u32>
§

NestedLoops

Fields

§depth: u32
§complexity_estimate: String
§

BlockingIO

Fields

§operation: String
§context: String
§

SuboptimalDataStructure

Fields

§current_type: String
§recommended_type: String
§

GodObject

Unified god object variant representing all detection types (GodClass, GodFile, GodModule) The god_object_indicators.detection_type field distinguishes between these types

Fields

§methods: u32

Number of methods (for GodClass) or functions (for GodFile/GodModule)

§fields: Option<u32>

Number of fields - Some for GodClass, None for GodFile/GodModule

§responsibilities: u32
§god_object_score: f64
§lines: u32

Total lines of code

§

FeatureEnvy

Fields

§external_class: String
§usage_ratio: f64
§

PrimitiveObsession

Fields

§primitive_type: String
§domain_concept: String
§

MagicValues

Fields

§value: String
§occurrences: u32
§

AssertionComplexity

Fields

§assertion_count: u32
§complexity_score: f64
§

FlakyTestPattern

Fields

§pattern_type: String
§reliability_impact: String
§

AsyncMisuse

Fields

§pattern: String
§performance_impact: String
§

ResourceLeak

Fields

§resource_type: String
§cleanup_missing: String
§

CollectionInefficiency

Fields

§collection_type: String
§inefficiency_type: String
§

ScatteredType

Fields

§type_name: String
§total_methods: usize
§file_count: usize
§severity: String
§

OrphanedFunctions

Fields

§target_type: String
§function_count: usize
§file_count: usize
§

UtilitiesSprawl

Fields

§function_count: usize
§distinct_types: usize

Implementations§

Source§

impl DebtType

Source

pub fn display_name(&self) -> &'static str

Pure function: returns the display name for this debt type.

For most variants, this returns a static string. The ErrorSwallowing variant is the exception - it requires dynamic content and is handled separately in the Display impl.

This separation follows the Stillwater pattern: pure core logic in a helper function, I/O (formatting) at the boundary.

Trait Implementations§

Source§

impl Clone for DebtType

Source§

fn clone(&self) -> DebtType

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DebtType

Source§

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

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

impl<'de> Deserialize<'de> for DebtType

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 Display for DebtType

Source§

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

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

impl Hash for DebtType

Custom Hash implementation that handles f64 fields by hashing their bit representations.

§Design Notes

This function has high cyclomatic complexity due to matching on all 33 enum variants. This is intentional structural complexity that cannot be reduced without sacrificing:

  • Type safety (each variant’s fields must be explicitly destructured)
  • Correctness (f64 fields require bit conversion via @f64 marker)
  • Exhaustive matching (compiler ensures all variants are handled)

The complexity is mitigated by:

  • Using the hash_fields! macro to reduce repetition
  • Grouping similar variants with or-patterns where field types match
  • Comprehensive test coverage for all variant groups

Variant groups:

  • Option<String> single field: 7 variants
  • (u32, u32) pairs: 4 variants (Complexity, TestComplexity, ComplexityHotspot, Duplication)
  • (String, String) pairs: 8 variants
  • Remaining unique structures: handled individually
Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for DebtType

Source§

fn eq(&self, other: &DebtType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DebtType

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
Source§

impl Eq for DebtType

Source§

impl StructuralPartialEq for DebtType

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> EnsureExt<T> for T

Source§

fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>
where P: Predicate<T>,

Validate that this value satisfies the given predicate. Read more
Source§

fn ensure_with<P, E, F>( self, predicate: P, error_fn: F, ) -> Validation<T, NonEmptyVec<E>>
where P: Predicate<T>, F: FnOnce(&T) -> E,

Validate with an error-generating function. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
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> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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
Source§

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