## Code Quality Analysis
The metrics reveal a significant degradation event around commit ead62b148eb9, followed by an incomplete recovery that leaves the codebase in a compromised state.
1. Erosion Ratio Crisis
f21a82b41ace and fc593cef02582. Complexity Explosion in Key Functions
getElementByType functions show extreme Halstead effort (112,745 and 43,928) with high difficulty scores (34.4 and 22.4)3. Zero Test Coverage Across All Commits
test_to_code_ratio = 0 throughout the entire timeline4. AI Development Indicators
DynamicFieldForm and DynamicFieldView naming patterns suggest template-driven generationPriority 1: Emergency Complexity Remediation
Priority 2: Establish Test Foundation
Priority 3: AI Code Review Protocol
The codebase shows signs of technical debt acceleration typical of AI-assisted development without proper guardrails. The erosion ratio trajectory suggests that without intervention, complexity will continue growing faster than the overall codebase, making future maintenance exponentially more expensive.
Bottom line: This codebase is approaching a maintainability cliff. Address the complexity crisis now or face exponentially higher refactoring costs within 2-3 development cycles.
| Metric | Value |
|---|---|
| Erosion Ratio | 18.2% |
| Total Functions | 281 |
| High-Mass Functions (CC > 10) | 3 |
| Total SLOC | 177,086 |
| Total Files | 3059 |
| Max CC | 27 |
| P90 CC | 5.0 |
| Avg CC | 2.3 |
| Comment Density | 4.4% |
| Test-to-Code Ratio | 0.00 |
| Boilerplate Ratio | 0.0% |
| Naming Consistency | 0.0% |
| Error Handling Entropy | 0.00 |
| File | Function | CC | SLOC | Mass |
|---|---|---|---|---|
| src/application/components/DynamicScreen/components/DynamicFieldView/DynamicFieldView.tsx | getElementByType | 27 | 126 | 303.1 |
| src/application/components/DynamicScreen/components/DynamicFieldForm/DynamicFieldForm.tsx | getElementByType | 13 | 301 | 225.5 |
| src/domain/media/reducers/attachmentReducer.ts | attachmentReducer | 11 | 103 | 111.6 |
| File | Function | Effort | Volume | Difficulty | CC |
|---|---|---|---|---|---|
| src/application/components/DynamicScreen/components/DynamicFieldForm/DynamicFieldForm.tsx | getElementByType | 112,745.8 | 3,281.4 | 34.4 | 13 |
| src/domain/investments/utils/investmentsTreeViewItems.ts | processInvestmentTreeView | 48,098.1 | 2,409.0 | 20.0 | 10 |
| src/application/components/DynamicScreen/components/DynamicFieldView/DynamicFieldView.tsx | getElementByType | 43,928.0 | 1,960.2 | 22.4 | 27 |
| src/application/pages/claims/ClaimsEdition/ClaimsEdition.tsx | ClaimsEdition | 42,627.8 | 2,736.3 | 15.6 | 4 |
| src/infrastructure/redux/clientState/NetworkService/sagas/NetworkSaga.ts | networkRequestSaga | 42,034.4 | 1,220.0 | 34.5 | 7 |
| src/infrastructure/redux/clientState/TreeViewService/reducers/TreeViewReducer.ts | treeViewItemsReducer | 32,740.9 | 1,225.6 | 26.7 | 8 |
| src/application/pages/claims/ClaimsCreation/ClaimsCreation.tsx | ClaimsCreation | 28,957.9 | 2,339.3 | 12.4 | 1 |
| src/application/components/FeatureFlagPanel/FeatureFlagPanel.tsx | FeatureFlagPanel | 28,168.3 | 1,609.6 | 17.5 | 8 |
| src/domain/media/reducers/attachmentReducer.ts | attachmentReducer | 24,192.0 | 960.0 | 25.2 | 11 |
| src/domain/agents/utils/agentContractAgreementFormUtils.ts | buildGqlUpdateAgreement | 20,969.0 | 1,352.8 | 15.5 | 7 |