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
contains a large family of per-tool constraint builders that all follow the same skeleton: nil guard, slice setup, , a handful of field gates, and . The differences are mostly declarative strings and field selectors, but the control flow is duplicated 33 times in one file.
📊 Duplication Details - 2026-08-11
Duplication Details
Pattern: Per-tool constraint builders
Severity: Medium
Occurrences: 33 builders ( appears 33 times)
Locations:
()
()
()
()
Code Sample:
Impact Analysis
Maintainability: Adding or rewording a constraint pattern requires touching many near-identical functions by hand.
Bug Risk: Gating rules and phrasing can drift between tools when only one copy is updated.
Code Bloat: The duplication obscures the actual catalog of constraints behind repeated plumbing.
Refactoring Recommendations
Move simple constraint builders to a descriptor table
Extract common rendering into a shared helper in .
Estimated effort: medium.
Benefits: new tools become data additions instead of new boilerplate functions.
Keep bespoke functions only for complex tools
Reserve hand-written builders for cases with genuinely unique branching.
Estimated effort: low to medium.
Benefits: keeps flexibility while removing the repeated skeleton.
Implementation Checklist
Group the 33 builders by repeated sentence shapes
Introduce a shared constraint-rendering descriptor/helper
Migrate the simplest builders first
Leave only genuinely bespoke builders as code
Update tool-description tests
Analysis Metadata
Analyzed Files: 1220 changed non-test Go files, with semantic focus on
Detection Method: Serena semantic code analysis plus targeted pattern search
Commit:
Analysis Date: 2026-08-11T22:09:51Z
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
proxy.golang.org
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
🔍 Duplicate Code Detected: Declarative Constraint Builders
Analysis of commit c993af6
Assignee:
@copilotSummary
contains a large family of per-tool constraint builders that all follow the same skeleton: nil guard, slice setup, , a handful of field gates, and . The differences are mostly declarative strings and field selectors, but the control flow is duplicated 33 times in one file.
📊 Duplication Details - 2026-08-11
Duplication Details
Pattern: Per-tool constraint builders
Impact Analysis
Refactoring Recommendations
Move simple constraint builders to a descriptor table
Keep bespoke functions only for complex tools
Implementation Checklist
Analysis Metadata
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.