-
Notifications
You must be signed in to change notification settings - Fork 20
[duplicate-code] Duplicate Code Analysis Report #3155
Copy link
Copy link
Open
0 / 10 of 1 issue completedDescription
Analysis of commit 893fa02 — triggered by @lpcox
Summary
Analysis of the gh-aw-mcpg Go codebase found 1 significant duplication pattern meeting the reporting threshold (>10 lines or 3+ similar instances), plus 2 intentional/documented patterns that are acknowledged in the codebase already.
Detected Patterns
-
list*MCP Operations Structural Duplication — Severity: Medium — See sub-issue [duplicate-code] Duplicate Code Pattern: list* MCP Operations Structural Duplication #3156- Three nearly-identical 17-line functions (
listTools,listResources,listPrompts) ininternal/mcp/connection.goshare identical boilerplate with only type-level differences.
- Three nearly-identical 17-line functions (
-
withLockMethod Boilerplate in Logger Types — Severity: Low (documented intentional pattern)- Four logger types each define an identical 3-line
withLockmethod delegating towithMutexLock. Explicitly documented ininternal/logger/common.goas the expected pattern.
- Four logger types each define an identical 3-line
-
Log-Level Quad-Function Pattern — Severity: Low (documented intentional pattern)
- Three sets of four one-liner functions (
LogInfo/LogWarn/LogError/LogDebug, theirMdandWithServervariants) acrossfile_logger.go,markdown_logger.go, andserver_file_logger.go. Also explicitly documented ininternal/logger/common.go.
- Three sets of four one-liner functions (
Overall Impact
- Total Duplicated Lines (significant): ~51 lines (
listTools/listResources/listPrompts, 17 lines × 3) - Affected Files: 1 file with actionable duplication (
internal/mcp/connection.go) - Maintainability Risk: Medium — if the list-operation contract changes (e.g., new error handling, session refresh), all three functions must be updated in sync
- Refactoring Priority: Low-Medium — the code is correct and the pattern is stable; a generic helper would improve maintainability but carries no immediate bug risk
Next Steps
- Review the sub-issue for the
list*pattern and decide whether a generic helper is worth adding - No action needed for the documented logger patterns (already intentional)
Analysis Metadata
- Analyzed Files: All non-test
.gofiles ininternal/(≈80 files) - Detection Method: Semantic and structural pattern analysis
- Commit:
893fa02(Guard coverage: classifycreate_agent_taskas read-write and blocked) - Analysis Date: 2026-04-04
- Note: The HEAD commit modifies only Rust files; Go analysis covers the full current codebase state
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Fields
Give feedbackNo fields configured for issues without a type.