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
Fixme
CodeSmell
Complexity
Dependency
ResourceManagement
CodeOrganization
TestComplexity
TestQuality
TestingGap
ComplexityHotspot
DeadCode
Duplication
Risk
TestComplexityHotspot
TestTodo
TestDuplication
ErrorSwallowing
AllocationInefficiency
StringConcatenation
NestedLoops
BlockingIO
SuboptimalDataStructure
GodObject
Unified god object variant representing all detection types (GodClass, GodFile, GodModule)
The god_object_indicators.detection_type field distinguishes between these types
Fields
FeatureEnvy
PrimitiveObsession
MagicValues
AssertionComplexity
FlakyTestPattern
AsyncMisuse
ResourceLeak
CollectionInefficiency
ScatteredType
OrphanedFunctions
UtilitiesSprawl
Implementations§
Source§impl DebtType
impl DebtType
Sourcepub fn display_name(&self) -> &'static str
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<'de> Deserialize<'de> for DebtType
impl<'de> Deserialize<'de> for DebtType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for DebtType
Custom Hash implementation that handles f64 fields by hashing their bit representations.
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
@f64marker) - 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
impl Eq for DebtType
impl StructuralPartialEq for DebtType
Auto Trait Implementations§
impl Freeze for DebtType
impl RefUnwindSafe for DebtType
impl Send for DebtType
impl Sync for DebtType
impl Unpin for DebtType
impl UnsafeUnpin for DebtType
impl UnwindSafe for DebtType
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<T> EnsureExt<T> for T
impl<T> EnsureExt<T> for T
Source§fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
Source§fn ensure_with<P, E, F>(
self,
predicate: P,
error_fn: F,
) -> Validation<T, NonEmptyVec<E>>
fn ensure_with<P, E, F>( self, predicate: P, error_fn: F, ) -> Validation<T, NonEmptyVec<E>>
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.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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more