Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.85 KB

File metadata and controls

53 lines (35 loc) · 1.85 KB

🔍 Duplicate Code Detector

For an overview of all available workflows, see the main README.

Automatically identify duplicate code patterns and suggest refactoring opportunities

The Duplicate Code Detector workflow runs daily to analyze recent code changes and detect duplicate patterns. It creates focused issues (max 3 per run) for significant duplication patterns, automatically assigned to @copilot for potential remediation.

Installation

# Install the 'gh aw' extension
gh extension install github/gh-aw

# Add the workflow to your repository
gh aw add-wizard githubnext/agentics/duplicate-code-detector

This walks you through adding the workflow to your repository.

How It Works

graph LR
    A[Analyze Recent Changes] --> B[Detect Patterns]
    B --> C[Find Duplicates]
    C --> D{Significant?}
    D -->|Yes| E[Create Refactoring Issue]
    D -->|No| F[Report: Code is DRY]
Loading

The workflow reports identical or nearly identical functions, repeated code blocks, similar classes with overlapping functionality, and copy-pasted code. It excludes standard boilerplate, test setup code, config files, and small snippets (<5 lines).

Examples

Based on usage in the gh-aw repository: 79% merge rate (76 merged PRs out of 96 proposed).

Usage

Configuration

The workflow is configured to:

  • Run daily
  • Create max 3 issues per run
  • Auto-expire issues after 2 days if not addressed
  • Skip test files, generated code, and workflow files

After editing run gh aw compile to update the workflow and commit all changes to the default branch.

Learn More