Skip to content

Add code duplication detection tooling#103

Merged
khaong merged 5 commits intomainfrom
alex/code-dup-tooling
Jan 27, 2026
Merged

Add code duplication detection tooling#103
khaong merged 5 commits intomainfrom
alex/code-dup-tooling

Conversation

@khaong
Copy link
Contributor

@khaong khaong commented Jan 24, 2026

Summary

  • Configure dupl linter with tiered thresholds for code duplication detection
  • Add mise run dup task for comprehensive duplication checking with file summary
  • Document the duplication prevention workflow in CLAUDE.md

Tiered Thresholds

Command Threshold Scope Purpose
mise run lint 75 tokens New issues only CI gate - blocks serious duplication
mise run dup 50 tokens All issues + summary Advisory - comprehensive check

Test plan

  • mise run dup shows duplication summary grouped by file
  • mise run lint passes (no new duplication)

🤖 Generated with Claude Code


Note

Introduces code duplication detection across the repo with tiered thresholds and supporting tasks.

  • Configures dupl in .golangci.yaml with a 75-token threshold for CI/new issues
  • Adds mise run dup (50-token advisory, JSON summary by file) and dup:staged (staged files, 75-token) tasks in mise.toml
  • Documents the duplication workflow, commands, thresholds, and suppression guidance in CLAUDE.md

Written by Cursor Bugbot for commit 64fd725. This will update automatically on new commits. Configure here.

- Configure dupl linter with tiered thresholds:
  - 75 tokens in lint (blocks CI on serious duplication)
  - 50 tokens in `mise run dup` (advisory, with summary)
- Add mise tasks: `dup` (comprehensive + summary), `dup:staged`
- Document duplication prevention workflow in CLAUDE.md

The go:discover-related skill was also created at ~/.claude/skills/
for pre-implementation code discovery.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: 51a265047d72
Copilot AI review requested due to automatic review settings January 24, 2026 06:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive code duplication detection tooling with tiered thresholds to prevent duplicate code in the codebase.

Changes:

  • Configures the dupl linter (already enabled) with a 75-token threshold in .golangci.yaml for CI enforcement
  • Adds mise run dup task for comprehensive duplication checking at a more sensitive 50-token threshold with file-grouped summary output
  • Adds mise run dup:staged task for quick pre-commit duplication checks on staged files
  • Documents the duplication prevention workflow in CLAUDE.md with clear guidance on thresholds and remediation steps

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.golangci.yaml Adds dupl linter settings with 75-token threshold for CI gate
mise.toml Adds two new tasks: dup (comprehensive check with JSON summary) and dup:staged (quick pre-commit check)
CLAUDE.md Documents duplication detection commands, tiered thresholds, and remediation workflow

- Quote $staged variable using printf/xargs for safer filename handling
- Clarify in description that dup:staged uses threshold 75 (same as CI)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: 92d119290bc7
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

@khaong khaong marked this pull request as ready for review January 27, 2026 05:59
@khaong khaong requested a review from a team as a code owner January 27, 2026 05:59
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Use temp directory approach instead of $(mktemp).yaml to avoid
  orphan temp files (works on both Linux and macOS)
- Use null-delimited pipeline throughout dup:staged to properly
  handle filenames with spaces

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: c169380f5523
Copilot AI review requested due to automatic review settings January 27, 2026 07:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@khaong khaong enabled auto-merge January 27, 2026 08:41
@khaong khaong merged commit 85f1d74 into main Jan 27, 2026
10 of 11 checks passed
@khaong khaong deleted the alex/code-dup-tooling branch January 27, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants