-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.debtmap.toml
More file actions
196 lines (167 loc) · 6.99 KB
/
.debtmap.toml
File metadata and controls
196 lines (167 loc) · 6.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Improved Debtmap Configuration with False Positive Reduction
[scoring]
# Weights for different scoring factors (must sum to 1.0)
# Using weighted sum model for clear, predictable scoring
#coverage = 0.50 # Weight for test coverage gaps (50% - prioritize untested code)
#complexity = 0.35 # Weight for code complexity (35% - identify complex areas)
#dependency = 0.15 # Weight for dependency criticality (15% - consider impact radius)
[thresholds]
complexity = 10
duplication = 50
max_file_length = 500
max_function_length = 50
# Minimum thresholds for including items in debt analysis
# These help filter out trivial functions that aren't really technical debt
minimum_debt_score = 2.0 # Increased from 1.0 to filter out minor issues
minimum_cyclomatic_complexity = 3 # Increased from 1 to skip simple functions
minimum_cognitive_complexity = 5 # Increased from 1 to skip simple cognitive load
minimum_risk_score = 2.0 # Increased from 1.0 for Risk debt types
# Validation thresholds for 'debtmap validate' command
# Using density-based validation (scale-independent quality metrics)
[thresholds.validation]
# === PRIMARY QUALITY METRICS (Scale-Independent) ===
max_average_complexity = 10.0 # Maximum allowed average complexity per function
max_debt_density = 50.0 # Maximum allowed debt density per 1000 LOC (PRIMARY METRIC)
max_codebase_risk_score = 7.0 # Maximum allowed codebase risk score
# === OPTIONAL METRICS ===
min_coverage_percentage = 0.0 # Minimum required code coverage percentage (0 = disabled)
# === SAFETY NET ===
max_total_debt_score = 10000 # High ceiling to catch extreme cases (rarely triggers)
# === DEPRECATED (Will be removed in v1.0) ===
# These scale-dependent metrics are deprecated. Use max_debt_density instead.
# Uncomment only if you need backward compatibility during migration.
# max_high_complexity_count = 375
# max_debt_items = 20500
# max_high_risk_functions = 50
[languages]
enabled = ["rust", "javascript", "python", "go"]
[ignore]
patterns = [
"target/**",
"venv/**",
"node_modules/**",
"*.min.js",
"benches/**",
"tests/**/*", # Exclude all files in tests directory
"**/test_*.rs", # Exclude test files with test_ prefix
"**/*_test.rs", # Exclude test files with _test suffix
"**/*_tests.rs", # Exclude test files with _tests suffix
"**/fixtures/**", # Exclude test fixtures
"**/mocks/**", # Exclude mock implementations
"**/stubs/**", # Exclude stub implementations
"**/examples/**", # Exclude example code
"**/demo/**", # Exclude demo code
"**/*_demo.rs", # Exclude demo files
"**/testdata/**", # Exclude test data directories
]
# Function name patterns to ignore - common patterns that are intentionally complex
[ignore.functions]
patterns = [
# Test setup/teardown that are naturally complex
"setup_test_*",
"teardown_test_*",
"create_test_*",
"mock_*",
# Generated or macro-expanded code patterns
"derive_*",
"__*", # Dunder methods
# CLI argument parsing - naturally complex
"parse_args",
"parse_cli",
"build_cli",
# Serialization/deserialization - naturally complex pattern matching
"serialize_*",
"deserialize_*",
"to_json",
"from_json",
"to_*_format",
"from_*_format",
]
[output]
default_format = "terminal"
[external_api]
# Enable automatic external API detection for testing
detect_external_api = false
# However, we can still explicitly mark certain functions as APIs if needed
# (Currently empty since debtmap doesn't expose any external APIs)
api_functions = []
api_files = []
[entropy]
enabled = true
weight = 0.5
min_tokens = 10
pattern_threshold = 0.7
# Pattern-specific adjustments to reduce false positives
[patterns]
# Detector functions often have moderate complexity by design
[patterns.detectors]
name_patterns = ["detect_*", "check_*", "validate_*", "verify_*"]
complexity_adjustment = 0.7 # Reduce complexity score by 30% for detector patterns
cognitive_adjustment = 0.8 # Reduce cognitive complexity by 20%
# Builder patterns often have chained method calls
[patterns.builders]
name_patterns = ["*Builder", "builder", "with_*", "set_*"]
orchestration_threshold = 5 # Need at least 5 delegations to be considered orchestration
complexity_adjustment = 0.8 # Reduce complexity score by 20%
# Pattern matching functions are idiomatic in Rust
[patterns.matching]
name_patterns = ["match_*", "classify_*", "categorize_*", "determine_*"]
complexity_adjustment = 0.6 # Reduce complexity score by 40% for pattern matching
cognitive_adjustment = 0.7 # Reduce cognitive complexity by 30%
# Error handling functions naturally have branching
[patterns.error_handling]
name_patterns = ["handle_error", "process_error", "map_error", "convert_error"]
complexity_adjustment = 0.7 # Reduce complexity score by 30%
# Configuration loading is naturally complex
[patterns.configuration]
name_patterns = ["load_config", "parse_config", "init_*", "setup_*"]
complexity_adjustment = 0.8 # Reduce complexity score by 20%
minimum_complexity = 15 # Only flag if complexity > 15
# Visitor pattern implementations
[patterns.visitors]
name_patterns = ["visit_*", "walk_*", "traverse_*"]
orchestration_threshold = 6 # Need at least 6 delegations
complexity_adjustment = 0.7 # Reduce complexity score by 30%
# God Object detection configuration
# Constructor detection configuration (spec 117)
[classification.constructors]
# Constructor name patterns for simple initialization functions
# These patterns help prevent false positives where trivial constructors
# are classified as critical business logic
patterns = [
"new",
"default",
"from_",
"with_",
"create_",
"make_",
"build_",
"of_",
"empty",
"zero",
"any",
]
# Complexity thresholds for constructor classification
max_cyclomatic = 2 # Maximum cyclomatic complexity for simple constructors
max_cognitive = 3 # Maximum cognitive complexity for simple constructors
max_length = 15 # Maximum lines for simple constructors
max_nesting = 1 # Maximum nesting depth for simple constructors
[god_object]
enabled = true # Enable god object detection
max_methods = 20 # Maximum methods before considering a god object
max_fields = 15 # Maximum fields before considering a god object
max_responsibilities = 5 # Maximum distinct responsibilities
score_threshold = 50.0 # Minimum score to flag as god object
# Language-specific thresholds
[god_object.rust]
max_methods = 25 # Rust allows more methods due to trait impls
max_fields = 15
max_responsibilities = 4
[god_object.python]
max_methods = 20
max_fields = 20 # Python classes often have more attributes
max_responsibilities = 5
[god_object.javascript]
max_methods = 15 # JavaScript classes should be smaller
max_fields = 10
max_responsibilities = 3