EzyGang

Aposlop marks as much duplicate code as jscpd's three passes, in one run

On five well-known repos, one aposlop run marks 9.8% of the code as copied. That's as much as jscpd's three passes, in 2,460 groups against 5,339 pairs.

Contents
  1. Why compare them
  2. How the five repos were set up
  3. What each tool marked
  4. How much of it is noise
  5. Four copies through every tool
  6. Copies inside larger functions
  7. The skills
  8. One skill on one group
  9. Running it on your code
  10. Conclusion

Why compare them

I built aposlop because coding agents add repeated logic, complex control flow and large files faster than reviewers can find them. jscpd and PMD’s CPD were finding copies long before it: jscpd’s repository dates from 2013 and PMD’s from 2012.

I had all three run on five repos you’ve heard of, each tool configured the way its users would set it up. One aposlop run marked as much code as jscpd’s three passes together.

How the five repos were set up

The repos are ripgrep (Rust), Prometheus (Go, plus its TypeScript web UI), Django (Python), Vite (TypeScript) and Excalidraw (TypeScript and TSX). Each is pinned to a commit from 22 to 24 November 2026. Every repo got an .aposlop.toml and a .jscpd.json that leave out tests, fixtures, examples, vendored and generated code, and PMD got the same file list (Rust’s inline unit tests stay in, since no path reaches them). That leaves 2,325 files and 612,520 lines.

Aposlop 1.3.0 got nothing but those excludes. It compares whole functions, and it also compares runs of adjacent statements inside function and control-flow bodies, so a loop copied into two different functions shows up as one group.

jscpd 5.4.3 ran the three passes its own agent skill gives: exact, then --ignore-identifiers --min-tokens 70, then --max-gap-lines 1 --similarity. It ran as the installed binary, so its times include no npx download. PMD’s CPD 7.29.0 got 50 tokens, jscpd’s default, but its renamed options only cover Java and C++, and its TypeScript module skips .tsx files, all 335 of them here.

Everything ran on one i9-11900K with 64 GB of RAM, and each time is the median of five cold runs, added up over the five repos.

What each tool marked

Totals over the five repos, with each line counted once however many findings cover it:

ToolFindingsLines in a copyTime
Aposlop2,460 groups9.8%2.9 s
jscpd, exact1,452 pairs5.4%1.4 s
jscpd, renamed1,702 pairs7.0%1.6 s
jscpd, similar2,185 pairs7.4%2.7 s
jscpd, all three passes5,339 pairs9.8%5.8 s
PMD CPD1,146 matches4.3%36.7 s

Groups and pairs don’t count the same thing: five copies of one function are one aposlop group and ten jscpd pairs.

Each jscpd pass is quicker than the aposlop run, and the three together mark the same 9.8% in twice the time. PMD is the slow one: 23 of its 36.7 seconds went on ripgrep and Excalidraw. On this code it finds exact copies only, and it skipped 5 of ripgrep’s files on lexer errors.

Against jscpd’s three passes together, 34,571 lines are marked by both, 25,282 by jscpd alone and 25,416 by aposlop alone. A copy that begins halfway through a statement stays jscpd’s, because jscpd matches any run of tokens wherever it starts and ends, and aposlop only matches whole statements.

How much of it is noise

I had a model label 360 random findings as real or noise, without telling it which tool produced them. That was on a separate sample of mine: ripgrep, Excalidraw and Django, with tests, fixtures, examples, vendored code and Django’s migrations left out. Noise means a finding a reviewer wouldn’t want, such as boilerplate, data or text, repeated test code, a match across unrelated code, or a short common pattern.

SourceNoiseSample
jscpd, all three passes71%180
jscpd exact / renamed / similar58% / 85% / 73%72 / 52 / 56
Aposlop, whole functions64%61
Aposlop, statement runs55%103

Statement runs were the least noisy row, at 55%, which is still more than half. Most of the noise on both sides was ripgrep’s inline tests and flag definitions. jscpd’s also had 25 matches on data or text and 13 that ran from one function into the next, and aposlop had none of either.

Applied to everything each tool reported on that sample, the rates come to roughly 430 real findings among aposlop’s 1,044 groups and 490 among jscpd’s 1,689 pairs, which means reading about 650 more findings to get about 60 more real copies out of jscpd.

One model did all the labelling and no person checked it. At 180 samples that’s about 7 points either way, and the smaller rows are less sure than that.

Four copies through every tool

Prometheus has AppendHistograms and AppendFloatHistograms, 98 lines each and 87 of them identical, plus five AWS client setup functions in its service discovery. Vite copied a helper into its legacy plugin under the comment “Duplicated from build.ts in Vite Core”, which is at least honest. Django has two clickjacking decorators that differ in one string. All four came out of aposlop’s report.

For each copy, how many findings a tool needed and how much of the copied lines it covered:

CopyAposlopjscpd exactjscpd renamedjscpd similarPMD CPD
Histogram appenders, 2 x 98 lines1 group, 100%4 pairs, 70%3 pairs, 99%4 pairs, 100%7 matches, 92%
AWS clients, 5 x 68-72 lines1 group, 100%7 pairs, 65%9 pairs, 74%10 pairs, 100%4 matches, 77%
Vite helper, 37 and 36 lines1 group, 100%1 pair, 84%1 pair, 84%2 pairs, 100%1 match, 84%
Django decorators, 2 x 28 lines1 group, 100%1 pair, 36%none2 pairs, 100%none

Aposlop also reports five run groups around the histogram appenders. They share code with three more functions in the same file, including a retry and backoff block that appears five times.

jscpd’s similar pass covers all four too, in two to ten pairs each. But its renamed pass and PMD miss the Django decorators.

Copies inside larger functions

These statement-run groups from the five repos are code copied into the middle of functions that are otherwise different:

  • Excalidraw renderer/interactiveScene.ts, lines 200-206, 1187-1193 and 1212-1217: three functions set up the canvas the same way
  • Excalidraw hyperlink/Hyperlink.tsx:503-509 and hyperlink/helpers.ts:168-173: two files making the same two calls
  • Django backends/base/schema.py:559-570 and backends/sqlite3/schema.py:289-300: twelve delete-table lines, copied
  • Django migrate.py, optimizemigration.py and squashmigrations.py: one app_label lookup in all three commands
  • ripgrep printer/src/standard.rs:867-873 and printer/src/summary.rs:726-732: the same statistics updates
  • Prometheus storage/remote/queue_manager.go: five functions repeating the retry and backoff steps

The skills

Aposlop and jscpd both ship five agent skills, and jscpd adds an MCP server. PMD has none. jscpd’s skills (jscpd, dry-refactoring, codebase-refactoring, compare-codebases, code-migration) start when you ask an agent to run jscpd, clean up a codebase or port code. Each one walks the agent through jscpd’s output.

Two of aposlop’s start on every change an agent makes, before any scan. aposlop-code-changes has the agent reuse an existing helper before it writes a new one and keep the diff as small as it can. With aposlop-test-changes, a new test has to protect a behavior that no other test covers. The other three are for running aposlop and for two manual cleanup passes, and all five install with aposlop install-skills.

One skill on one group

An agent took Django’s decorator group through the aposlop and aposlop-code-changes skills, in a throwaway local copy of Django. The aposlop skill has it compare the copies’ behavior and owner before sharing anything, and here that’s easy: one module, one behavior, a different header value. aposlop-code-changes wants an existing helper first. Django doesn’t have one for this, so the change is a single private function (these lines are from the diff):

+def _x_frame_options(view_func, value):
-                response["X-Frame-Options"] = "DENY"
+                response["X-Frame-Options"] = value
+    return _x_frame_options(view_func, "DENY")
+    return _x_frame_options(view_func, "SAMEORIGIN")

The file went from 89 lines to 75, and Django’s 18 tests for the decorators and the clickjacking middleware passed before and after. Aposlop’s report went from 528 groups to 525: the decorators’ group and the two for their inner wrappers were gone, and no new group appeared.

Running it on your code

With uv, from the root of the repository:

uvx aposlop . --terminal-output code

Put your excludes in .aposlop.toml first. Django’s has two lines:

[core]
exclude = ["tests/", "docs/", "js_tests/"]

With that file, the first run on Django took 2 seconds, download included, and listed 528 groups. Your exclude list replaces the built-in one, so if you have node_modules/ or vendor/, add them back.

Conclusion

On this code one aposlop run marks 9.8% of the five repos as copied, in 2.9 seconds and 2,460 groups, where jscpd needs three passes, 5.8 seconds and 5,339 pairs for the same share. They disagree on a lot, though: each one marks about 25,000 lines the other doesn’t.

If your code is outside Go, Rust, Python and TypeScript, use jscpd, which reads 224 formats, and use it for copies that start or end halfway through a statement as well. For a mostly Java repo, PMD’s CPD is the pick, since its renamed options work there. For everything else I’d start with aposlop, mostly because one run hands me each copied block as one group with every copy in it.

More posts

  1. I gave Claude Code 8 real tickets with and without aposlop agent skills, and it wrote 59% less code

    Ran Claude Code on 8 real Django and ripgrep tickets, with and without my skills. With them it wrote 59% less code, and once argued a feature away.