Repository navigation
ci: Detect duplicate code with jscpd - #3133
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
|
E2E Test Results✅ All tests passed • 382 passed • 1 skipped • 1438s
Tests ran across 4 shards in parallel. |
5724c7a to
d1be584
Compare
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
d1be584 to
89bea78
Compare
Deep Review✅ No critical issues found. No P0/P1: this is advisory CI tooling with no runtime/application code, the security surface is clean ( 🟡 P2 -- recommended
🔵 P3 nitpicks (3)
Reviewers (8): correctness, security, adversarial, reliability, maintainability, project-standards, testing, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
89bea78 to
f31239c
Compare
PR Review
3 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 3 minor 1 posted as inline comment(s) on the changed lines. 2 listed below. Findings outside the changed lines2 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
My thought: this check runs automatically and serves as a signal to authors and reviewers, regardless of whether an agent has followed the grep instructions. It also costs no tokens to run, and can help us identify existing duplicates in addition to preventing new ones. We could potentially tell the agent that this is available to help them find duplicates, I'm not sure whether agents would use it any more effectively than grep or not. Since it runs during lint, agents that run lint should be seeing its output anyway. |
| steps.report.outputs.result != '' && | ||
| github.event.pull_request.head.repo.fork != true | ||
| uses: mshick/add-pr-comment@ec328af66588ab8f77cdeb2c264f14aba45bbf59 # v3.12.0 | ||
| with: |
There was a problem hiding this comment.
🔵 minor — Clean PRs still get a bot comment
Every non-fork PR gets a jscpd comment, even when it adds no duplicates, because dupes.mjs --markdown always prints a body ('No new duplicate code introduced by this PR.'). .github/workflows/knip.yml:98-119 handles the same case by skipping the comment and deleting any stale one. Do the same here: emit empty output when there are no new clones (or add a delete-on-status/cleanup step) so the comment only appears when there is something to act on.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Summary
This PR adds automated duplicate code detection using jscpd.
Detection can be run locally (
yarn dupes,yarn dupes:all, ormake ci-lint) and runs automatically in CI. By default, detection finds duplications that are new on the branch as compared toorigin/main. New duplicates are non-blocking for now, and reported on the PR:Tests and non-typescript code are ignored, as they're expected to have a higher degree of duplication.
Screenshots or video
How to test on Vercel preview
Run
yarn dupes,yarn dupes:all, ormake ci-lintlocally. No app behavior changes expected.References