You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The refactoring commit (f544f18) that routed all ValidationError constructors through newValidationError introduced all internal/config/ files together, surfacing two structural duplication patterns in internal/config/validation_rules.go. Both patterns involve near-identical validation functions sharing the same logic but differing only in error message wording — a classic copy-paste pattern.
Detected Patterns
This analysis found 2 significant duplication patterns:
Maintainability Risk: Medium — any future change to validation error structure must be applied to both functions in each pair; divergence already visible (different Message wording, missing logValidation.Print call in RequiredStringField that NonEmptyString also lacks)
Refactoring Priority: Medium — straightforward consolidation with no external API changes required
Next Steps
Review individual pattern sub-issues for detailed analysis
Consolidate RequiredStringField and NonEmptyString (have one delegate to the other)
Consolidate TimeoutPositive and PositiveInteger (have TimeoutPositive delegate to PositiveInteger or merge)
Analysis Metadata
Analyzed Files: internal/config/validation_rules.go (primary), full internal/config/ package (secondary)
Summary
The refactoring commit (f544f18) that routed all ValidationError constructors through
newValidationErrorintroduced allinternal/config/files together, surfacing two structural duplication patterns ininternal/config/validation_rules.go. Both patterns involve near-identical validation functions sharing the same logic but differing only in error message wording — a classic copy-paste pattern.Detected Patterns
This analysis found 2 significant duplication patterns:
RequiredStringField/NonEmptyString— near-identical empty-string validators — Severity: Medium — See sub-issue [duplicate-code] Duplicate Code Pattern: Near-Identical Empty-String Validators (RequiredStringField / NonEmptyString) #8696TimeoutPositive/PositiveInteger— overlapping minimum-value validators — Severity: Low — See sub-issue [duplicate-code] Duplicate Code Pattern: Overlapping Minimum-Value Validators (TimeoutPositive / PositiveInteger) #8697Overall Impact
internal/config/validation_rules.go)Messagewording, missinglogValidation.Printcall inRequiredStringFieldthatNonEmptyStringalso lacks)Next Steps
RequiredStringFieldandNonEmptyString(have one delegate to the other)TimeoutPositiveandPositiveInteger(haveTimeoutPositivedelegate toPositiveIntegeror merge)Analysis Metadata
internal/config/validation_rules.go(primary), fullinternal/config/package (secondary)