{"url":"https://api.github.com/repos/github/gh-aw-mcpg/issues/2754","repository_url":"https://api.github.com/repos/github/gh-aw-mcpg","labels_url":"https://api.github.com/repos/github/gh-aw-mcpg/issues/2754/labels{/name}","comments_url":"https://api.github.com/repos/github/gh-aw-mcpg/issues/2754/comments","events_url":"https://api.github.com/repos/github/gh-aw-mcpg/issues/2754/events","html_url":"https://github.com/github/gh-aw-mcpg/issues/2754","id":4162854877,"node_id":"I_kwDOQmd7a874IB_d","number":2754,"title":"[duplicate-code] Duplicate Code Analysis Report","user":{"login":"github-actions[bot]","id":41898282,"node_id":"MDM6Qm90NDE4OTgyODI=","avatar_url":"https://avatars.githubusercontent.com/in/15368?v=4","gravatar_id":"","url":"https://api.github.com/users/github-actions%5Bbot%5D","html_url":"https://github.com/apps/github-actions","followers_url":"https://api.github.com/users/github-actions%5Bbot%5D/followers","following_url":"https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github-actions%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/github-actions%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/github-actions%5Bbot%5D/repos","events_url":"https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/github-actions%5Bbot%5D/received_events","type":"Bot","user_view_type":"public","site_admin":false},"labels":[{"id":9982373324,"node_id":"LA_kwDOQmd7a88AAAACUv7tzA","url":"https://api.github.com/repos/github/gh-aw-mcpg/labels/code-quality","name":"code-quality","color":"ededed","default":false,"description":null},{"id":9982373326,"node_id":"LA_kwDOQmd7a88AAAACUv7tzg","url":"https://api.github.com/repos/github/gh-aw-mcpg/labels/automated-analysis","name":"automated-analysis","color":"ededed","default":false,"description":null}],"state":"closed","locked":false,"assignees":[{"login":"lpcox","id":15877973,"node_id":"MDQ6VXNlcjE1ODc3OTcz","avatar_url":"https://avatars.githubusercontent.com/u/15877973?v=4","gravatar_id":"","url":"https://api.github.com/users/lpcox","html_url":"https://github.com/lpcox","followers_url":"https://api.github.com/users/lpcox/followers","following_url":"https://api.github.com/users/lpcox/following{/other_user}","gists_url":"https://api.github.com/users/lpcox/gists{/gist_id}","starred_url":"https://api.github.com/users/lpcox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpcox/subscriptions","organizations_url":"https://api.github.com/users/lpcox/orgs","repos_url":"https://api.github.com/users/lpcox/repos","events_url":"https://api.github.com/users/lpcox/events{/privacy}","received_events_url":"https://api.github.com/users/lpcox/received_events","type":"User","user_view_type":"public","site_admin":true},{"login":"Copilot","id":198982749,"node_id":"BOT_kgDOC9w8XQ","avatar_url":"https://avatars.githubusercontent.com/in/1143301?v=4","gravatar_id":"","url":"https://api.github.com/users/Copilot","html_url":"https://github.com/apps/copilot-swe-agent","followers_url":"https://api.github.com/users/Copilot/followers","following_url":"https://api.github.com/users/Copilot/following{/other_user}","gists_url":"https://api.github.com/users/Copilot/gists{/gist_id}","starred_url":"https://api.github.com/users/Copilot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Copilot/subscriptions","organizations_url":"https://api.github.com/users/Copilot/orgs","repos_url":"https://api.github.com/users/Copilot/repos","events_url":"https://api.github.com/users/Copilot/events{/privacy}","received_events_url":"https://api.github.com/users/Copilot/received_events","type":"Bot","user_view_type":"public","site_admin":false}],"milestone":null,"comments":0,"created_at":"2026-03-29T06:00:44Z","updated_at":"2026-03-29T17:57:21Z","closed_at":"2026-03-29T17:57:21Z","assignee":{"login":"Copilot","id":198982749,"node_id":"BOT_kgDOC9w8XQ","avatar_url":"https://avatars.githubusercontent.com/in/1143301?v=4","gravatar_id":"","url":"https://api.github.com/users/Copilot","html_url":"https://github.com/apps/copilot-swe-agent","followers_url":"https://api.github.com/users/Copilot/followers","following_url":"https://api.github.com/users/Copilot/following{/other_user}","gists_url":"https://api.github.com/users/Copilot/gists{/gist_id}","starred_url":"https://api.github.com/users/Copilot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Copilot/subscriptions","organizations_url":"https://api.github.com/users/Copilot/orgs","repos_url":"https://api.github.com/users/Copilot/repos","events_url":"https://api.github.com/users/Copilot/events{/privacy}","received_events_url":"https://api.github.com/users/Copilot/received_events","type":"Bot","user_view_type":"public","site_admin":false},"author_association":"CONTRIBUTOR","issue_field_values":[],"type":null,"active_lock_reason":null,"sub_issues_summary":{"total":3,"completed":3,"percent_completed":100},"issue_dependencies_summary":{"blocked_by":0,"total_blocked_by":0,"blocking":0,"total_blocking":0},"body":"## Summary\n\nAnalysis of the latest commit found **3 significant duplication patterns** across the Go codebase, primarily in the `internal/logger`, `internal/config`, and `internal/server` packages. Estimated ~500+ lines of duplicated or structurally repetitive code.\n\n## Detected Patterns\n\n1. **Logger Initialization with Identical Closure Structure** – Severity: High – See sub-issue #2755\n2. **Repetitive Debug Logging Statements in Validation** – Severity: Medium – See sub-issue #2756\n3. **RWMutex Lock/Unlock Boilerplate Across Logger and Server Files** – Severity: Medium – See sub-issue #2757\n\n## Overall Impact\n\n- **Total Duplicated Lines**: ~500 lines (approximate)\n- **Affected Files**: 15+ Go files across `internal/logger`, `internal/config`, `internal/server`, `internal/guard`\n- **Maintainability Risk**: Medium — divergence between parallel implementations is the primary concern\n- **Refactoring Priority**: Medium — patterns are consistent and testable, refactoring carries low regression risk\n\n## Next Steps\n\n1. Review individual pattern sub-issues for detailed analysis and code examples\n2. Prioritize by severity: start with Pattern #1 (logger init closures)\n3. Create implementation plan and ensure unit tests pass after each refactor\n\n## Analysis Metadata\n\n- **Analyzed Files**: 85 Go files (non-test, non-workflow)\n- **Detection Method**: Semantic code analysis\n- **Commit**: 2ab0c8d (fix: resolve duplicate test declarations and fix wantOperation defaults)\n- **Analysis Date**: 2026-03-29","closed_by":{"login":"lpcox","id":15877973,"node_id":"MDQ6VXNlcjE1ODc3OTcz","avatar_url":"https://avatars.githubusercontent.com/u/15877973?v=4","gravatar_id":"","url":"https://api.github.com/users/lpcox","html_url":"https://github.com/lpcox","followers_url":"https://api.github.com/users/lpcox/followers","following_url":"https://api.github.com/users/lpcox/following{/other_user}","gists_url":"https://api.github.com/users/lpcox/gists{/gist_id}","starred_url":"https://api.github.com/users/lpcox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpcox/subscriptions","organizations_url":"https://api.github.com/users/lpcox/orgs","repos_url":"https://api.github.com/users/lpcox/repos","events_url":"https://api.github.com/users/lpcox/events{/privacy}","received_events_url":"https://api.github.com/users/lpcox/received_events","type":"User","user_view_type":"public","site_admin":true},"reactions":{"url":"https://api.github.com/repos/github/gh-aw-mcpg/issues/2754/reactions","total_count":1,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":1},"timeline_url":"https://api.github.com/repos/github/gh-aw-mcpg/issues/2754/timeline","performed_via_github_app":null,"state_reason":"completed","pinned_comment":null}