Skip to content

feat: Add code duplication detection with jscpd#1289

Open
konard wants to merge 4 commits intomainfrom
issue-1286-5d275bbc791b
Open

feat: Add code duplication detection with jscpd#1289
konard wants to merge 4 commits intomainfrom
issue-1286-5d275bbc791b

Conversation

@konard
Copy link
Contributor

@konard konard commented Feb 13, 2026

Summary

Implements code duplication detection using jscpd (JavaScript Copy Paste Detector) as requested in #1286 (specifically item 3: Code Duplication Detection).

Per @konard's comment, only the code duplication detection feature is needed for now, not the multi-runtime testing support.

Changes

1. Add .jscpd.json configuration file

  • Threshold: 11% (current baseline - can be lowered as duplications are refactored)
  • Minimum 30 tokens and 5 lines for duplication detection
  • Skip comments to focus on code
  • Formats: JavaScript only (the primary source code)
  • Excludes: node_modules, build artifacts, experiments, data, case studies, dependency research
  • Generates HTML reports to ./reports/jscpd/

2. Add jscpd dependency

  • Added jscpd@^4.0.5 as devDependency

3. Add npm script

  • npm run check:duplication - runs jscpd on the codebase

4. CI/CD Integration

  • Added code duplication check step in the lint job of release.yml
  • Runs after ESLint, before file line limit checks

5. Add reports/ to .gitignore

  • jscpd generates HTML reports that should not be committed

Current Status

The codebase currently has 10.65% code duplication (4,445 duplicated lines out of 41,754 total). The threshold is set to 11% to allow the check to pass while preventing significant new duplications.

Reference

Based on best practices from js-ai-driven-development-pipeline-template.

Test Plan

  • npm run check:duplication passes (10.65% < 11% threshold)
  • npm run lint passes
  • npm run format:check passes
  • npm test passes (all tests)
  • CI/CD workflow passes

Fixes

Fixes #1286 (Code Duplication Detection item only)


🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #1286
@konard konard self-assigned this Feb 13, 2026
Add jscpd (JavaScript Copy Paste Detector) to detect code duplications
in the codebase:

- Add .jscpd.json configuration file with sensible defaults:
  - 11% threshold (current baseline)
  - JavaScript format focus
  - Excludes experiments, data, and case study directories
  - Generates HTML reports in ./reports/jscpd

- Add jscpd as devDependency (^4.0.5)

- Add npm script: npm run check:duplication

- Integrate into CI/CD workflow (lint job in release.yml)

- Add reports/ to .gitignore for generated HTML reports

This addresses #1286 request for code duplication detection from
js-ai-driven-development-pipeline-template best practices.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] Add multi-runtime testing support (Bun, Deno) from js-ai-driven-development-pipeline-template feat: Add code duplication detection with jscpd Feb 13, 2026
konard and others added 2 commits February 14, 2026 00:23
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review February 13, 2026 23:49
@konard
Copy link
Contributor Author

konard commented Feb 13, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:


Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add multi-runtime testing support (Bun, Deno) from js-ai-driven-development-pipeline-template

1 participant