docs(reviewer): flag cross-module structural duplication, propose a shared generic#194
docs(reviewer): flag cross-module structural duplication, propose a shared generic#194gregorydemay wants to merge 2 commits into
Conversation
…hared generic Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the reviewer agent’s maintainability guidance to treat “parallel” types (new structures mirroring existing siblings) as actionable duplication, encouraging refactors toward shared generic abstractions across the codebase.
Changes:
- Adds a new maintainability rule to flag cross-module structural duplication (not only copy/paste within the diff).
- Guides reviewers to propose extracting shared generic cores (traits + generics) instead of duplicating mirrored types.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| not a one-line repeat; as a rule of thumb, roughly 10+ near-identical lines or the | ||
| same multi-line block repeated at 2+ sites — is at least 🟠 Medium and gates the verdict; | ||
| name the parameterization, helper, or proptest that removes it. | ||
| - Flag structural duplication ACROSS modules/PRs, not just copy-paste within the diff. |
There was a problem hiding this comment.
🤖 Reworded in a9b5d83. The bullet now scopes the duplication search to the repository codebase (including code outside the current diff/PR) and explicitly excludes other open PRs, so it no longer invites cross-PR comparison the agent cannot reliably access. It also now requires the finding to cite the concrete existing sibling being mirrored (the actual type/module, no speculation). Dropped the "/PRs" phrasing entirely; the rest of the bullet (mirror ⇒ shared generic core, generics over copy-paste and macros, ≥🟠 Medium when substantial, name the unifying generic) is unchanged.
|
…her PRs Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🤖 Ready for your review. Standalone tooling change — leaving it DRAFT per our flow. Sharpens the reviewer agent's Maintainability rules with a cross-module heuristic: when a new type closely mirrors an existing sibling (same field/map shape, near-identical methods), the reviewer should treat the parallelism itself as a finding and propose extracting a shared generic core — preferring generics over copy-paste and over macros — rather than only catching within-diff copy-paste. Per Copilot's feedback, the search is scoped to the repository codebase (not other open PRs, which the reviewer can't reliably access) and must cite the concrete sibling being mirrored (no speculation). Docs-only ( Motivation: the trade store in #193 was initially built as a near-line-for-line parallel of |
Extends the reviewer's Maintainability rules so duplication detection looks ACROSS modules and PRs, not just at copy-paste within a single diff.
The reviewer should now recognize when a new type faithfully mirrors an existing sibling — same field/map shape and near-identical methods — and treat that parallelism itself as the finding, proposing a shared generic core (generics over copy-paste and over macros) rather than accepting a duplicated structure.