From 0ffcd4a3cd6d50041a928d5b04bec477157f2440 Mon Sep 17 00:00:00 2001 From: Felipe Leal Date: Wed, 28 Oct 2026 16:26:05 +1100 Subject: [PATCH 1/3] feat: --changed to report only clones a change touches Scans the whole project but keeps only the clone classes with a copy on a line changed since the merge-base with (committed, staged, unstaged or untracked). The Action gets a matching `changed-since` input for pull requests. Also: release workflow only triggers on full version tags, so moving the v1 tag no longer starts a release; add CITATION.cff with the 2021 thesis as a reference. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 3 +- CITATION.cff | 24 ++++++++++ README.md | 12 +++++ action.yml | 7 +++ src/cli.ts | 12 ++++- src/index.ts | 15 ++++++- src/node/changed.ts | 83 +++++++++++++++++++++++++++++++++++ test/changed.test.ts | 66 ++++++++++++++++++++++++++++ 8 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 CITATION.cff create mode 100644 src/node/changed.ts create mode 100644 test/changed.test.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83addd5..b1e0788 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,8 @@ name: Release on: push: - tags: ["v*"] + # Full versions only: moving the major tag (v1) must not start a release. + tags: ["v[0-9]+.[0-9]+.[0-9]+"] permissions: contents: read diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..3e0f68a --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,24 @@ +cff-version: 1.2.0 +message: If you use this software, please cite it, and the thesis it started from. +title: JavaScript Clone Detection +type: software +authors: + - family-names: Leal de Faria + given-names: Luís Felipe +repository-code: https://github.com/felipelealdefaria/javascript-clone-detection +url: https://felipelealdefaria.github.io/javascript-clone-detection/ +license: MIT +version: 1.0.0 +keywords: [clone detection, code duplication, JavaScript, TypeScript, React, static analysis] +references: + - type: thesis + thesis-type: Bachelor's thesis (Trabalho de Conclusão de Curso) + title: Estudo empírico sobre duplicação de código em aplicações JavaScript + authors: + - family-names: Leal de Faria + given-names: Luís Felipe + institution: + name: Universidade Tecnológica Federal do Paraná (UTFPR), Dois Vizinhos + year: 2021 + languages: [pt] + url: http://repositorio.utfpr.edu.br/jspui/handle/1/30141 diff --git a/README.md b/README.md index f619f76..9bd3bca 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,18 @@ steps: sarif_file: jscd.sarif ``` +On pull requests, report only the duplication the PR introduces or touches: + +```yaml +- uses: actions/checkout@v5 + with: + fetch-depth: 0 +- uses: felipelealdefaria/javascript-clone-detection@v1 + with: + changed-since: origin/${{ github.base_ref }} + fail-on-clones: true +``` + ### From code ```ts diff --git a/action.yml b/action.yml index 12859fe..4f291b9 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,11 @@ inputs: ignore: description: Glob patterns to exclude, one per line. default: "" + changed-since: + description: >- + Git ref, e.g. origin/main. Only clones with a copy on a line changed since the merge-base + with this ref are reported. Needs history: use actions/checkout with fetch-depth 0. + default: "" sarif-file: description: Where to write the SARIF report. Upload it with github/codeql-action/upload-sarif. default: jscd.sarif @@ -43,6 +48,7 @@ runs: THRESHOLD: ${{ inputs.threshold }} MIN_TOKENS: ${{ inputs.min-tokens }} IGNORE: ${{ inputs.ignore }} + CHANGED_SINCE: ${{ inputs.changed-since }} SARIF_FILE: ${{ inputs.sarif-file }} FAIL: ${{ inputs.fail-on-clones }} VERSION: ${{ inputs.version }} @@ -53,6 +59,7 @@ runs: while IFS= read -r pattern; do [ -n "$pattern" ] && args+=(--ignore "$pattern") done <<< "$IGNORE" + [ -n "$CHANGED_SINCE" ] && args+=(--changed "$CHANGED_SINCE") jscd=(npx --yes "javascript-clone-detection@$VERSION") NO_COLOR=1 "${jscd[@]}" "${paths[@]}" "${args[@]}" > jscd-report.txt diff --git a/src/cli.ts b/src/cli.ts index 2663f94..dd4cf7c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -19,6 +19,7 @@ Options -f, --format text | json | sarif (default text) -o, --output Write the report to a file instead of stdout -i, --ignore Exclude files matching a glob (repeatable) + -c, --changed Only report clones touching lines changed since (git) --fail Exit with code 1 when clones are found -v, --version Print the version -h, --help Print this help @@ -27,6 +28,7 @@ Examples jscd src jscd src --threshold 0.9 --ignore "**/*.test.ts" jscd . --format sarif --output clones.sarif + jscd src --changed origin/main --fail ` function fail(message: string): never { @@ -68,7 +70,12 @@ async function main(): Promise { let result: Awaited> try { - result = await detectClonesInPaths(positionals, { threshold, minTokens, ignore: values.ignore }) + result = await detectClonesInPaths(positionals, { + threshold, + minTokens, + ignore: values.ignore, + changedSince: values.changed, + }) } catch (error) { fail(error instanceof Error ? error.message : String(error)) } @@ -81,6 +88,8 @@ async function main(): Promise { ? toSarif(result) : toText(result, { color }) + if (values.changed) + process.stderr.write(`Only clones touching changes since ${values.changed}.\n`) if (values.output) { await writeFile(values.output, report) process.stderr.write(`Wrote ${result.pairs.length} clone pairs to ${values.output}\n`) @@ -100,6 +109,7 @@ function parse() { format: { type: 'string', short: 'f' }, output: { type: 'string', short: 'o' }, ignore: { type: 'string', short: 'i', multiple: true }, + changed: { type: 'string', short: 'c' }, fail: { type: 'boolean' }, version: { type: 'boolean', short: 'v' }, help: { type: 'boolean', short: 'h' }, diff --git a/src/index.ts b/src/index.ts index ed06301..40c49cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,16 +2,24 @@ import { readFile } from 'node:fs/promises' import path from 'node:path' import { detectClones } from './core/detect.js' import type { DetectionResult, DetectOptions, SourceFile } from './core/types.js' +import { changedLines, onlyChanged } from './node/changed.js' import { type FindOptions, findSourceFiles } from './node/files.js' export * from './core/index.js' +export { changedLines, onlyChanged } from './node/changed.js' export { DEFAULT_IGNORE, findSourceFiles, SOURCE_EXTENSIONS } from './node/files.js' export { toJson } from './report/json.js' export { toSarif } from './report/sarif.js' export { toText } from './report/text.js' export { VERSION } from './version.js' -export interface PathOptions extends DetectOptions, FindOptions {} +export interface PathOptions extends DetectOptions, FindOptions { + /** + * Git ref (e.g. `origin/main`). When set, only clones with a copy on a line changed since the + * merge-base with this ref are reported. The whole project is still scanned. + */ + changedSince?: string +} /** Finds source files under `paths`, reads them and detects clones. Paths in the result are relative to `cwd`. */ export async function detectClonesInPaths( @@ -19,6 +27,8 @@ export async function detectClonesInPaths( options: PathOptions = {}, ): Promise { const cwd = options.cwd ?? process.cwd() + // Resolve the diff first, so a bad ref fails before the scan. + const changed = options.changedSince ? changedLines(options.changedSince, cwd) : null const absolute = await findSourceFiles(paths, options) const files: SourceFile[] = await Promise.all( absolute.map(async (file) => ({ @@ -26,5 +36,6 @@ export async function detectClonesInPaths( code: await readFile(file, 'utf8'), })), ) - return detectClones(files, options) + const result = detectClones(files, options) + return changed ? onlyChanged(result, changed, cwd) : result } diff --git a/src/node/changed.ts b/src/node/changed.ts new file mode 100644 index 0000000..c874f2b --- /dev/null +++ b/src/node/changed.ts @@ -0,0 +1,83 @@ +import { execFileSync } from 'node:child_process' +import { realpathSync } from 'node:fs' +import path from 'node:path' +import type { DetectionResult, UnitRef } from '../core/types.js' + +/** Changed line ranges per absolute file path; `'all'` for new, untracked files. */ +export type ChangedLines = Map + +function git(args: string[], cwd: string): string { + try { + return execFileSync('git', args, { + cwd, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + maxBuffer: 256 * 1024 * 1024, + }) + } catch (error) { + const stderr = (error as { stderr?: string }).stderr?.trim() + throw new Error(`git ${args[0]} failed${stderr ? `: ${stderr}` : ''}`) + } +} + +/** + * Lines changed in the working tree (committed, staged or not) since the merge-base with `ref`, + * plus untracked files. Same view as a pull request diff against `ref`. + */ +export function changedLines(ref: string, cwd: string): ChangedLines { + const root = git(['rev-parse', '--show-toplevel'], cwd).trim() + const diff = git( + ['diff', '--merge-base', ref, '--unified=0', '--no-color', '--no-ext-diff', '--no-renames'], + cwd, + ) + + const changed: ChangedLines = new Map() + let current: [number, number][] | null = null + for (const line of diff.split('\n')) { + if (line.startsWith('+++ ')) { + const target = line.slice(4) + if (target === '/dev/null') { + current = null + } else { + current = [] + changed.set(path.join(root, target.replace(/^b\//, '')), current) + } + continue + } + const hunk = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(line) + if (hunk && current) { + const start = Number(hunk[1]) + const count = hunk[2] === undefined ? 1 : Number(hunk[2]) + // A pure deletion has count 0: it touches the lines around where the code was removed. + current.push(count === 0 ? [Math.max(start, 1), start + 1] : [start, start + count - 1]) + } + } + + for (const file of git(['ls-files', '--others', '--exclude-standard', '-z'], root).split('\0')) { + if (file) changed.set(path.join(root, file), 'all') + } + return changed +} + +function touches(ref: UnitRef, root: string, changed: ChangedLines): boolean { + const ranges = changed.get(path.resolve(root, ref.file)) + if (!ranges) return false + if (ranges === 'all') return true + return ranges.some(([from, to]) => from <= ref.end.line && to >= ref.start.line) +} + +/** Keeps the clone classes and pairs in which at least one copy overlaps a changed line. */ +export function onlyChanged( + result: DetectionResult, + changed: ChangedLines, + cwd: string, +): DetectionResult { + // git reports real paths; the scan directory may sit behind a symlink (e.g. /var on macOS). + const root = realpathSync(cwd) + const hit = (ref: UnitRef) => touches(ref, root, changed) + return { + ...result, + pairs: result.pairs.filter((p) => hit(p.a) || hit(p.b)), + classes: result.classes.filter((c) => c.members.some(hit)), + } +} diff --git a/test/changed.test.ts b/test/changed.test.ts new file mode 100644 index 0000000..a0990b2 --- /dev/null +++ b/test/changed.test.ts @@ -0,0 +1,66 @@ +import { execFileSync } from 'node:child_process' +import { mkdtempSync, readFileSync, realpathSync, writeFileSync } from 'node:fs' +import { tmpdir } from 'node:os' +import path from 'node:path' +import { beforeEach, describe, expect, it } from 'vitest' +import { changedLines, detectClonesInPaths } from '../src/index.js' + +const format = readFileSync( + path.join(import.meta.dirname, 'fixtures/project/src/utils/format.js'), + 'utf8', +) + +let repo: string +const git = (...args: string[]) => execFileSync('git', args, { cwd: repo, encoding: 'utf8' }) + +// A repository whose main branch already has a clone pair (formatPrice / formatCost). +beforeEach(() => { + repo = realpathSync(mkdtempSync(path.join(tmpdir(), 'jscd-git-'))) + git('init', '-q', '-b', 'main') + git('config', 'user.email', 'test@example.com') + git('config', 'user.name', 'Test') + writeFileSync(path.join(repo, 'format.js'), format) + writeFileSync(path.join(repo, 'other.js'), 'export function other(a) {\n return a\n}\n') + git('add', '.') + git('commit', '-q', '-m', 'base') + git('switch', '-q', '-c', 'feature') +}) + +const scan = (changedSince?: string) => detectClonesInPaths(['.'], { cwd: repo, changedSince }) + +describe('--changed', () => { + it('reports nothing when the clones predate the branch', async () => { + expect((await scan()).pairs.length).toBeGreaterThan(0) + expect((await scan('main')).pairs).toEqual([]) + }) + + it('reports a clone added in an untracked file', async () => { + writeFileSync(path.join(repo, 'copy.js'), format.replaceAll('formatPrice', 'formatAmount')) + const result = await scan('main') + expect(result.pairs.length).toBeGreaterThan(0) + expect(result.pairs.every((p) => p.a.file === 'copy.js' || p.b.file === 'copy.js')).toBe(true) + }) + + it('reports an existing clone when one copy is edited, committed or not', async () => { + const edited = format.replace("if (total < 0) return 'negative'", "if (total < 0) return 'neg'") + writeFileSync(path.join(repo, 'format.js'), edited) + expect((await scan('main')).pairs.length).toBeGreaterThan(0) + git('commit', '-q', '-am', 'edit') + expect((await scan('main')).pairs.length).toBeGreaterThan(0) + }) + + it('ignores edits outside every copy', async () => { + writeFileSync(path.join(repo, 'other.js'), 'export function other(a) {\n return a + 1\n}\n') + expect((await scan('main')).pairs).toEqual([]) + }) + + it('maps hunks to line ranges, including deletions', () => { + writeFileSync(path.join(repo, 'other.js'), 'export function other(a) {\n}\n') + const ranges = changedLines('main', repo).get(path.join(repo, 'other.js')) + expect(ranges).toEqual([[1, 2]]) + }) + + it('fails clearly on an unknown ref', async () => { + await expect(scan('no-such-branch')).rejects.toThrow(/git diff failed/) + }) +}) From 25a4c22de0271f6c018f0765687aad87fa85969c Mon Sep 17 00:00:00 2001 From: Felipe Leal Date: Wed, 28 Oct 2026 16:54:31 +1100 Subject: [PATCH 2/3] perf: 4-5x faster Type-3 search on large codebases On grafana (39k units) matching took 54 s, 88% of it walking shingle posting lists. Now: - 8-token shingles (rare, so short lists), plus 3-token shingles for units under 64 tokens, which may not share an 8-token run. - Units sorted by length; each walks only partners whose length can still reach the threshold (exact, no recall loss). - LCS bit masks built once per unit and reused across its candidates. - Posting cap fixed at 1,000 units instead of 5% of the codebase. Tuned against an exhaustive run on grafana: 99.9% of its Type-3 pairs kept, matching 128 s -> 9.8 s. Benchmark results unchanged. Also adds study/ (empirical study harness) and moves benchmark scoring into benchmark/metrics.ts. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 1 + benchmark/metrics.ts | 64 ++ benchmark/results/results.json | 36 +- benchmark/results/results.md | 8 +- benchmark/run.ts | 65 +- biome.json | 4 +- package.json | 3 +- src/core/detect.ts | 75 +- src/core/similarity.ts | 93 +- study/fetch.ts | 29 + study/projects.ts | 149 ++++ study/results/results.json | 1484 ++++++++++++++++++++++++++++++++ study/results/results.md | 59 ++ study/results/sample.md | 162 ++++ study/run.ts | 435 ++++++++++ 15 files changed, 2526 insertions(+), 141 deletions(-) create mode 100644 benchmark/metrics.ts create mode 100644 study/fetch.ts create mode 100644 study/projects.ts create mode 100644 study/results/results.json create mode 100644 study/results/results.md create mode 100644 study/results/sample.md create mode 100644 study/run.ts diff --git a/.gitignore b/.gitignore index 21bab44..7314d67 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ benchmark/.data benchmark/.cache playground/dist *.sarif +study/.cache diff --git a/benchmark/metrics.ts b/benchmark/metrics.ts new file mode 100644 index 0000000..5bb5778 --- /dev/null +++ b/benchmark/metrics.ts @@ -0,0 +1,64 @@ +import type { Dataset } from './build.js' +import { pairKey, type ToolRun } from './tools.js' + +export interface Rate { + hits: number + total: number +} + +export interface Metrics { + tool: string + durationMs: number + recall: { t1: Rate; t2: Rate; t3: Rate; t4: Rate } + recallByDomain: Record + t3ByEdits: Record + precision: { truePositives: number; falsePositives: number } +} + +export const rate = (r: Rate) => (r.total === 0 ? 0 : r.hits / r.total) +export const pct = (r: Rate) => `${(rate(r) * 100).toFixed(1)}%` +const add = (r: Rate, hit: boolean) => { + r.total++ + if (hit) r.hits++ +} +const empty = (): Rate => ({ hits: 0, total: 0 }) + +export function evaluate(dataset: Dataset, run: ToolRun): Metrics { + const groupOf = new Map() + for (const f of dataset.families) + for (const file of Object.values(f.files)) groupOf.set(file, f.id) + for (const p of dataset.type4) { + groupOf.set(p.a, p.id) + groupOf.set(p.b, p.id) + } + + const m: Metrics = { + tool: run.tool, + durationMs: Math.round(run.durationMs), + recall: { t1: empty(), t2: empty(), t3: empty(), t4: empty() }, + recallByDomain: {}, + t3ByEdits: {}, + precision: { truePositives: 0, falsePositives: 0 }, + } + for (const f of dataset.families) { + m.recallByDomain[f.domain] ??= { t1: empty(), t2: empty(), t3: empty() } + const domain = m.recallByDomain[f.domain] as { t1: Rate; t2: Rate; t3: Rate } + m.t3ByEdits[f.t3Edits] ??= empty() + for (const type of ['t1', 't2', 't3'] as const) { + const hit = run.pairs.has(pairKey(f.files.original, f.files[type])) + add(m.recall[type], hit) + add(domain[type], hit) + if (type === 't3') add(m.t3ByEdits[f.t3Edits] as Rate, hit) + } + } + for (const p of dataset.type4) add(m.recall.t4, run.pairs.has(pairKey(p.a, p.b))) + + // Any detected pair across groups is a false positive: originals were chosen not to be clones. + for (const key of run.pairs) { + const [a, b] = key.split('|') as [string, string] + if (groupOf.get(a) !== undefined && groupOf.get(a) === groupOf.get(b)) + m.precision.truePositives++ + else m.precision.falsePositives++ + } + return m +} diff --git a/benchmark/results/results.json b/benchmark/results/results.json index 2326cbf..dd38436 100644 --- a/benchmark/results/results.json +++ b/benchmark/results/results.json @@ -15,7 +15,7 @@ "metrics": [ { "tool": "jscd (defaults)", - "durationMs": 113, + "durationMs": 98, "recall": { "t1": { "hits": 179, @@ -85,7 +85,7 @@ }, { "tool": "jscpd (defaults)", - "durationMs": 59, + "durationMs": 60, "recall": { "t1": { "hits": 138, @@ -155,7 +155,7 @@ }, { "tool": "jscpd (structural)", - "durationMs": 78, + "durationMs": 75, "recall": { "t1": { "hits": 177, @@ -230,7 +230,7 @@ "metrics": [ { "tool": "jscd", - "durationMs": 172, + "durationMs": 88, "recall": { "t1": { "hits": 179, @@ -241,7 +241,7 @@ "total": 179 }, "t3": { - "hits": 165, + "hits": 162, "total": 179 }, "t4": { @@ -274,7 +274,7 @@ "total": 81 }, "t3": { - "hits": 71, + "hits": 68, "total": 81 } } @@ -285,22 +285,22 @@ "total": 66 }, "2": { - "hits": 56, + "hits": 55, "total": 61 }, "3": { - "hits": 45, + "hits": 43, "total": 52 } }, "precision": { - "truePositives": 1032, - "falsePositives": 1321 + "truePositives": 1023, + "falsePositives": 1273 } }, { "tool": "jscpd (structural)", - "durationMs": 81, + "durationMs": 77, "recall": { "t1": { "hits": 179, @@ -375,7 +375,7 @@ "metrics": [ { "tool": "jscd", - "durationMs": 94, + "durationMs": 66, "recall": { "t1": { "hits": 179, @@ -440,12 +440,12 @@ }, "precision": { "truePositives": 1009, - "falsePositives": 133 + "falsePositives": 117 } }, { "tool": "jscpd (structural)", - "durationMs": 77, + "durationMs": 71, "recall": { "t1": { "hits": 179, @@ -520,7 +520,7 @@ "metrics": [ { "tool": "jscd", - "durationMs": 70, + "durationMs": 60, "recall": { "t1": { "hits": 179, @@ -590,7 +590,7 @@ }, { "tool": "jscpd (structural)", - "durationMs": 77, + "durationMs": 71, "recall": { "t1": { "hits": 177, @@ -665,7 +665,7 @@ "metrics": [ { "tool": "jscd", - "durationMs": 65, + "durationMs": 66, "recall": { "t1": { "hits": 179, @@ -735,7 +735,7 @@ }, { "tool": "jscpd (structural)", - "durationMs": 75, + "durationMs": 69, "recall": { "t1": { "hits": 170, diff --git a/benchmark/results/results.md b/benchmark/results/results.md index a99b6ee..c0939b7 100644 --- a/benchmark/results/results.md +++ b/benchmark/results/results.md @@ -9,9 +9,9 @@ Seed 2021. See [README.md](../README.md) for the method. | Tool | Type-1 | Type-2 | Type-3 | Type-4 | Precision | Time | |---|---:|---:|---:|---:|---:|---:| -| jscd (defaults) | 100.0% | 100.0% | 78.2% | 0/16 | 100.0% | 0.11 s | +| jscd (defaults) | 100.0% | 100.0% | 78.2% | 0/16 | 100.0% | 0.10 s | | jscpd (defaults) | 77.1% | 0.6% | 0.0% | 0/16 | 96.6% | 0.06 s | -| jscpd (structural) | 98.9% | 76.0% | 38.0% | 0/16 | 92.1% | 0.08 s | +| jscpd (structural) | 98.9% | 76.0% | 38.0% | 0/16 | 92.1% | 0.07 s | Precision counts every detected pair across two different families as a false positive. @@ -29,8 +29,8 @@ jscd scores token LCS; jscpd scores shared subtrees. Type-3 recall and precision | Threshold | jscd T3 | jscd precision | jscpd (structural) T3 | jscpd (structural) precision | |---|---:|---:|---:|---:| -| 0.6 | 92.2% | 43.9% | 58.1% | 90.8% | -| 0.7 | 87.7% | 88.4% | 50.8% | 92.4% | +| 0.6 | 90.5% | 44.6% | 58.1% | 90.8% | +| 0.7 | 87.7% | 89.6% | 50.8% | 92.4% | | 0.8 | 78.2% | 100.0% | 38.0% | 92.1% | | 0.9 | 67.0% | 100.0% | 27.4% | 91.3% | diff --git a/benchmark/run.ts b/benchmark/run.ts index fb37b8b..707aea0 100644 --- a/benchmark/run.ts +++ b/benchmark/run.ts @@ -11,74 +11,13 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs' import os from 'node:os' import path from 'node:path' import { buildDataset, DATA_DIR, DATASET_DIR, type Dataset } from './build.js' +import { evaluate, type Metrics, pct, type Rate } from './metrics.js' import { precisionOnRealCode } from './precision.js' -import { jscpdVersion, pairKey, runAll, runSweep, type ToolRun } from './tools.js' +import { jscpdVersion, runAll, runSweep } from './tools.js' const RESULTS_DIR = path.join(import.meta.dirname, 'results') const args = new Set(process.argv.slice(2)) -interface Rate { - hits: number - total: number -} - -export interface Metrics { - tool: string - durationMs: number - recall: { t1: Rate; t2: Rate; t3: Rate; t4: Rate } - recallByDomain: Record - t3ByEdits: Record - precision: { truePositives: number; falsePositives: number } -} - -const rate = (r: Rate) => (r.total === 0 ? 0 : r.hits / r.total) -const pct = (r: Rate) => `${(rate(r) * 100).toFixed(1)}%` -const add = (r: Rate, hit: boolean) => { - r.total++ - if (hit) r.hits++ -} -const empty = (): Rate => ({ hits: 0, total: 0 }) - -export function evaluate(dataset: Dataset, run: ToolRun): Metrics { - const groupOf = new Map() - for (const f of dataset.families) - for (const file of Object.values(f.files)) groupOf.set(file, f.id) - for (const p of dataset.type4) { - groupOf.set(p.a, p.id) - groupOf.set(p.b, p.id) - } - - const m: Metrics = { - tool: run.tool, - durationMs: Math.round(run.durationMs), - recall: { t1: empty(), t2: empty(), t3: empty(), t4: empty() }, - recallByDomain: {}, - t3ByEdits: {}, - precision: { truePositives: 0, falsePositives: 0 }, - } - for (const f of dataset.families) { - m.recallByDomain[f.domain] ??= { t1: empty(), t2: empty(), t3: empty() } - const domain = m.recallByDomain[f.domain] as { t1: Rate; t2: Rate; t3: Rate } - m.t3ByEdits[f.t3Edits] ??= empty() - for (const type of ['t1', 't2', 't3'] as const) { - const hit = run.pairs.has(pairKey(f.files.original, f.files[type])) - add(m.recall[type], hit) - add(domain[type], hit) - if (type === 't3') add(m.t3ByEdits[f.t3Edits] as Rate, hit) - } - } - for (const p of dataset.type4) add(m.recall.t4, run.pairs.has(pairKey(p.a, p.b))) - - // Any detected pair across groups is a false positive: originals were chosen not to be clones. - for (const key of run.pairs) { - const [a, b] = key.split('|') as [string, string] - if (groupOf.get(a) !== undefined && groupOf.get(a) === groupOf.get(b)) - m.precision.truePositives++ - else m.precision.falsePositives++ - } - return m -} - function precision(m: Metrics): string { const { truePositives: tp, falsePositives: fp } = m.precision return tp + fp === 0 ? '–' : `${((tp / (tp + fp)) * 100).toFixed(1)}%` diff --git a/biome.json b/biome.json index c67e8c9..1a0b1da 100644 --- a/biome.json +++ b/biome.json @@ -11,7 +11,9 @@ "!test/fixtures", "!docs", "!benchmark/type4", - "!benchmark/results" + "!benchmark/results", + "!study/.cache", + "!study/results" ] }, "formatter": { diff --git a/package.json b/package.json index f9aa581..b2100ca 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ "bench:embeddings": "tsx benchmark/run.ts --embeddings", "playground": "vite playground", "playground:build": "vite build playground", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "study": "tsx study/run.ts" }, "dependencies": { "@babel/generator": "8.0.6", diff --git a/src/core/detect.ts b/src/core/detect.ts index 10ebb2d..48a5168 100644 --- a/src/core/detect.ts +++ b/src/core/detect.ts @@ -1,6 +1,6 @@ import type * as t from '@babel/types' import { parseSource } from './parse.js' -import { lcsSimilarity, lengthUpperBound, similarityUpperBound } from './similarity.js' +import { LcsQuery, similarityUpperBound } from './similarity.js' import { emitUnit, extractUnits } from './tokenize.js' import type { CloneClass, @@ -16,8 +16,29 @@ import type { export const DEFAULT_THRESHOLD = 0.8 export const DEFAULT_MIN_TOKENS = 50 -/** Token n-gram size used to find Type-3 candidates. */ -const SHINGLE_SIZE = 3 +/** + * Type-3 candidate search. Tuned against an exhaustive run on grafana (39k units): these values + * keep 99.9% of its Type-3 pairs at ~1/13 of the cost, with no change in benchmark recall. + * See benchmark/README.md. + */ +const SHINGLE_SIZE = 8 +/** Short units may not share an 8-token run, so they are also indexed by 3-token shingles. */ +const SHORT_UNIT = 64 +const SHORT_SHINGLE_SIZE = 3 +/** Shingles found in more units than this (boilerplate) are skipped. */ +const MAX_POSTING = 1000 + +/** Index of the first entry greater than `value` in an ascending list. */ +function firstAfter(list: number[], value: number): number { + let lo = 0 + let hi = list.length + while (lo < hi) { + const mid = (lo + hi) >>> 1 + if ((list[mid] as number) <= value) lo = mid + 1 + else hi = mid + } + return lo +} export interface Unit { id: number @@ -170,18 +191,37 @@ export function matchUnits( if (group) group.push(unit) else shapes.set(unit.normKey, [unit]) } - const groups = [...shapes.values()] + // Sorted by length, so every posting list is too, and a unit only needs to walk the partners + // whose length can still reach the threshold: 2·min / (n + m) ≥ t ⇔ m ≤ n · (2 − t) / t. + const groups = [...shapes.values()].sort( + (x, y) => (x[0] as Unit).norm.length - (y[0] as Unit).norm.length, + ) const reps = groups.map((group) => group[0] as Unit) + const lengths = reps.map((rep) => rep.norm.length) + const lastWithin = (maxLength: number) => { + let lo = 0 + let hi = lengths.length + while (lo < hi) { + const mid = (lo + hi) >>> 1 + if ((lengths[mid] as number) <= maxLength) lo = mid + 1 + else hi = mid + } + return lo - 1 + } - // Index token shingles, then verify candidates with cheap bounds before the exact LCS. + // Index token shingles. Long shingles are rare, which keeps posting lists short. const postings = new Map() const shingles: number[][] = reps.map((rep, index) => { const seen = new Set() const n = rep.norm - for (let i = 0; i + SHINGLE_SIZE <= n.length; i++) { - let h = 0x811c9dc5 - for (let k = 0; k < SHINGLE_SIZE; k++) h = Math.imul(h ^ (n[i + k] as number), 0x01000193) - seen.add(h) + const sizes = n.length < SHORT_UNIT ? [SHINGLE_SIZE, SHORT_SHINGLE_SIZE] : [SHINGLE_SIZE] + for (const size of sizes) { + for (let i = 0; i + size <= n.length; i++) { + // The size seeds the hash, so 3- and 8-token shingles never collide. + let h = Math.imul(0x811c9dc5 ^ size, 0x01000193) + for (let k = 0; k < size; k++) h = Math.imul(h ^ (n[i + k] as number), 0x01000193) + seen.add(h) + } } for (const h of seen) { const list = postings.get(h) @@ -191,24 +231,27 @@ export function matchUnits( return [...seen] }) - // Shingles shared by most units (e.g. a `return` prologue) carry no signal and cost O(n²). - const maxPosting = Math.max(64, Math.ceil(reps.length * 0.05)) let comparisons = 0 const visited = new Uint32Array(reps.length) for (let i = 0; i < reps.length; i++) { const rep = reps[i] as Unit + const last = lastWithin(Math.floor((rep.norm.length * (2 - threshold)) / threshold + 1e-9)) + let query: LcsQuery | null = null for (const h of shingles[i] as number[]) { const list = postings.get(h) as number[] - if (list.length > maxPosting) continue - for (const j of list) { - if (j <= i || visited[j] === i + 1) continue + // Shingles found in very many units (boilerplate) carry little signal and cost O(n²). + if (list.length > MAX_POSTING) continue + for (let p = firstAfter(list, i); p < list.length; p++) { + const j = list[p] as number + if (j > last) break + if (visited[j] === i + 1) continue visited[j] = i + 1 const other = reps[j] as Unit - if (lengthUpperBound(rep.norm.length, other.norm.length) < threshold) continue if (similarityUpperBound(rep.sortedNorm, other.sortedNorm) < threshold) continue comparisons++ - const similarity = lcsSimilarity(rep.norm, other.norm) + query ??= new LcsQuery(rep.norm) + const similarity = query.similarity(other.norm) if (similarity < threshold) continue for (const a of groups[i] as Unit[]) { for (const b of groups[j] as Unit[]) add(a, b, 3, similarity) diff --git a/src/core/similarity.ts b/src/core/similarity.ts index 91efa5e..8ade7fb 100644 --- a/src/core/similarity.ts +++ b/src/core/similarity.ts @@ -1,52 +1,69 @@ -/** - * Length of the longest common subsequence of two integer sequences. - * - * Bit-parallel algorithm (Allison & Dix 1986, Hyyrö 2004): each step processes 32 cells of - * the DP table at once, so the cost is O(|a| · |b| / 32) instead of O(|a| · |b|). - */ +/** Length of the longest common subsequence of two integer sequences. */ export function lcsLength(a: ArrayLike, b: ArrayLike): number { - if (a.length === 0 || b.length === 0) return 0 - // Put the shorter sequence in the bit vector. if (a.length > b.length) [a, b] = [b, a] + return new LcsQuery(a).length(b) +} - const m = a.length - const words = Math.ceil(m / 32) - const masks = new Map() - for (let i = 0; i < m; i++) { - const symbol = a[i] as number - let mask = masks.get(symbol) - if (!mask) { - mask = new Uint32Array(words) - masks.set(symbol, mask) +/** + * LCS against a fixed sequence `a`, reusable across many `b`s: the bit masks for `a` are built + * once. Bit-parallel (Allison & Dix 1986, Hyyrö 2004): each step handles 32 cells of the DP + * table, so one query costs O(|a| · |b| / 32). + */ +export class LcsQuery { + private readonly m: number + private readonly words: number + private readonly masks = new Map() + private readonly v: Uint32Array + + constructor(a: ArrayLike) { + this.m = a.length + this.words = Math.max(1, Math.ceil(a.length / 32)) + this.v = new Uint32Array(this.words) + for (let i = 0; i < a.length; i++) { + const symbol = a[i] as number + let mask = this.masks.get(symbol) + if (!mask) { + mask = new Uint32Array(this.words) + this.masks.set(symbol, mask) + } + mask[i >>> 5] = ((mask[i >>> 5] as number) | (1 << (i & 31))) >>> 0 } - mask[i >>> 5] = ((mask[i >>> 5] as number) | (1 << (i & 31))) >>> 0 } - const v = new Uint32Array(words).fill(0xffffffff) - for (let j = 0; j < b.length; j++) { - const mask = masks.get(b[j] as number) - if (!mask) continue - let carry = 0 - let borrow = 0 + length(b: ArrayLike): number { + const { m, words, masks, v } = this + if (m === 0 || b.length === 0) return 0 + v.fill(0xffffffff) + for (let j = 0; j < b.length; j++) { + const mask = masks.get(b[j] as number) + if (!mask) continue + let carry = 0 + let borrow = 0 + for (let w = 0; w < words; w++) { + const vw = v[w] as number + const u = (vw & (mask[w] as number)) >>> 0 + const sum = vw + u + carry + carry = sum > 0xffffffff ? 1 : 0 + const diff = vw - u - borrow + borrow = diff < 0 ? 1 : 0 + v[w] = ((sum >>> 0) | (diff >>> 0)) >>> 0 + } + } + // LCS = number of zero bits among the first m bits. + let ones = 0 for (let w = 0; w < words; w++) { - const vw = v[w] as number - const u = (vw & (mask[w] as number)) >>> 0 - const sum = vw + u + carry - carry = sum > 0xffffffff ? 1 : 0 - const diff = vw - u - borrow - borrow = diff < 0 ? 1 : 0 - v[w] = ((sum >>> 0) | (diff >>> 0)) >>> 0 + let x = v[w] as number + if (w === words - 1 && m % 32 !== 0) x &= (1 << (m % 32)) - 1 + ones += popcount(x) } + return m - ones } - // LCS = number of zero bits among the first m bits. - let ones = 0 - for (let w = 0; w < words; w++) { - let x = v[w] as number - if (w === words - 1 && m % 32 !== 0) x &= (1 << (m % 32)) - 1 - ones += popcount(x) + /** Dice-style similarity 2·LCS / (|a| + |b|). */ + similarity(b: ArrayLike): number { + const total = this.m + b.length + return total === 0 ? 1 : (2 * this.length(b)) / total } - return m - ones } function popcount(x: number): number { diff --git a/study/fetch.ts b/study/fetch.ts new file mode 100644 index 0000000..2eb3c44 --- /dev/null +++ b/study/fetch.ts @@ -0,0 +1,29 @@ +import { execFileSync } from 'node:child_process' +import { existsSync, mkdirSync, rmSync } from 'node:fs' +import path from 'node:path' +import type { Project } from './projects.js' + +export const CACHE_DIR = path.join(import.meta.dirname, '.cache') + +const git = (cwd: string, ...args: string[]) => + execFileSync('git', args, { cwd, stdio: ['ignore', 'ignore', 'pipe'] }) + +/** + * Checks out only the scanned folders of one commit (shallow, sparse, blobs on demand). + * The code is only ever parsed, never installed or executed. + */ +export function fetchProject(project: Project): string { + const dir = path.join(CACHE_DIR, `${project.id}@${project.sha.slice(0, 12)}`) + if (existsSync(path.join(dir, '.done'))) return dir + rmSync(dir, { recursive: true, force: true }) + mkdirSync(dir, { recursive: true }) + git(dir, 'init', '-q') + git(dir, 'remote', 'add', 'origin', `https://github.com/${project.repo}.git`) + if (!project.dirs.includes('.')) { + git(dir, 'sparse-checkout', 'set', '--cone', ...project.dirs) + } + git(dir, 'fetch', '-q', '--depth', '1', '--filter=blob:none', 'origin', project.sha) + git(dir, 'checkout', '-q', 'FETCH_HEAD') + execFileSync('touch', [path.join(dir, '.done')]) + return dir +} diff --git a/study/projects.ts b/study/projects.ts new file mode 100644 index 0000000..6c44ab7 --- /dev/null +++ b/study/projects.ts @@ -0,0 +1,149 @@ +export interface ThesisResult { + functions: number + candidates: number + clones: number +} + +export interface Project { + id: string + repo: string + /** Pinned commit, so the study is reproducible. */ + sha: string + date: string + /** Directories to scan, relative to the repository root. */ + dirs: string[] + group: 'replication' | 'react' + /** v0.6 results reported in the 2021 thesis (Tables 1–3), at threshold 0.8. */ + thesis?: ThesisResult +} + +/** + * Part 1 replicates the thesis: same projects and folders, at the last commit before the 2021 + * analysis (Oct 1, 2021). Part 2 covers well-known open-source React applications at a commit + * pinned on Oct 28, 2026. + */ +export const PROJECTS: Project[] = [ + { + id: 'freecodecamp', + repo: 'freeCodeCamp/freeCodeCamp', + sha: 'd5e3979753eb16ac00b8e530e9956eae91126f56', + date: '2021-09-30', + dirs: ['api-server/src'], + group: 'replication', + thesis: { functions: 158, candidates: 29, clones: 13 }, + }, + { + id: 'javascript-algorithms', + repo: 'trekhleb/javascript-algorithms', + sha: '4548296affb227c29ead868309e48667f8280c55', + date: '2021-07-26', + dirs: ['src'], + group: 'replication', + thesis: { functions: 192, candidates: 60, clones: 21 }, + }, + { + id: 'thealgorithms', + repo: 'TheAlgorithms/JavaScript', + sha: 'ee605b7694f9237574bd8b6ebbe45da253fd05f8', + date: '2021-09-27', + dirs: ['.'], + group: 'replication', + thesis: { functions: 385, candidates: 231, clones: 185 }, + }, + { + id: 'excalidraw', + repo: 'excalidraw/excalidraw', + sha: '14bb42edee3d6fee6be264e3ee78670b3b9cee79', + date: '2026-10-27', + dirs: ['packages', 'excalidraw-app'], + group: 'react', + }, + { + id: 'outline', + repo: 'outline/outline', + sha: '6a2f23c023b952c752dfe025ef0ce2a0083cd0c1', + date: '2026-10-28', + dirs: ['app', 'shared'], + group: 'react', + }, + { + id: 'mastodon', + repo: 'mastodon/mastodon', + sha: 'b0555670b3d24d6e4a977a6bc3894daa128123fa', + date: '2026-10-27', + dirs: ['app/javascript'], + group: 'react', + }, + { + id: 'element-web', + repo: 'element-hq/element-web', + sha: 'c4b8799e5581a460f1557f130a74972917011f2d', + date: '2026-10-27', + dirs: ['apps/web/src'], + group: 'react', + }, + { + id: 'jitsi-meet', + repo: 'jitsi/jitsi-meet', + sha: '0fc01ad1591dad0c92737cf8354376749eafd6dc', + date: '2026-10-28', + dirs: ['react'], + group: 'react', + }, + { + id: 'twenty', + repo: 'twentyhq/twenty', + sha: 'ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72', + date: '2026-10-28', + dirs: ['packages/twenty-front/src'], + group: 'react', + }, + { + id: 'plane', + repo: 'makeplane/plane', + sha: 'a9e70360c5bc5b1beb5f70fe4c2fa765743147ec', + date: '2026-10-26', + dirs: ['apps/web'], + group: 'react', + }, + { + id: 'bluesky', + repo: 'bluesky-social/social-app', + sha: '1a1a3ceea1e72b62496e954619d7d8715717689c', + date: '2026-10-28', + dirs: ['src'], + group: 'react', + }, + { + id: 'signal-desktop', + repo: 'signalapp/Signal-Desktop', + sha: '17502b9d1a9e34af689f31508c4ac4ccee5b5cb7', + date: '2026-10-20', + dirs: ['ts'], + group: 'react', + }, + { + id: 'grafana', + repo: 'grafana/grafana', + sha: 'e0555671bcb0a46fe9bd97114ee4700566e6c44a', + date: '2026-10-28', + dirs: ['public/app'], + group: 'react', + }, + { + id: 'sentry', + repo: 'getsentry/sentry', + sha: '2894b630364ed2d1f38db38c9474d6a4a3851b59', + date: '2026-10-28', + dirs: ['static/app'], + group: 'react', + }, + { + id: 'posthog', + repo: 'PostHog/posthog', + sha: '0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef', + date: '2026-10-28', + dirs: ['frontend/src'], + group: 'react', + }, +] diff --git a/study/results/results.json b/study/results/results.json new file mode 100644 index 0000000..e890e01 --- /dev/null +++ b/study/results/results.json @@ -0,0 +1,1484 @@ +[ + { + "id": "freecodecamp", + "repo": "freeCodeCamp/freeCodeCamp", + "sha": "d5e3979753eb16ac00b8e530e9956eae91126f56", + "date": "2021-09-30", + "group": "replication", + "thesis": { + "functions": 158, + "candidates": 29, + "clones": 13 + }, + "files": { + "production": 77, + "test": 1, + "story": 0 + }, + "loc": { + "production": 5654, + "test": 205, + "story": 0 + }, + "clonedLoc": { + "production": 127, + "test": 0, + "story": 0 + }, + "units": 201, + "pairs": 3, + "pairsByType": [ + 0, + 1, + 2 + ], + "classes": 3, + "classesByType": [ + 0, + 1, + 2 + ], + "classesByKind": { + "component": 0, + "hook": 0, + "test": 0, + "story": 0, + "other": 3 + }, + "largestClass": 2, + "parseErrors": 0, + "durationMs": 48, + "sample": [ + { + "key": "freecodecamp:api-server/src/common/models/block.js:3|api-server/src/server/models/auth-token.js:3", + "type": 3, + "similarity": 0.8429752066115702, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L3-L9", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/auth-token.js#L3-L15" + }, + { + "key": "freecodecamp:api-server/src/common/models/user.js:996|api-server/src/common/models/user.js:1013", + "type": 2, + "similarity": 1, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029" + }, + { + "key": "freecodecamp:api-server/src/server/boot/challenge.js:249|api-server/src/server/boot/challenge.js:297", + "type": 3, + "similarity": 0.8353658536585366, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L249-L295", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L297-L329" + } + ], + "noMinimum": { + "units": 552, + "pairs": 1125, + "classes": 27, + "sample": [ + { + "key": "freecodecamp:api-server/src/common/models/user.js:858|api-server/src/server/utils/donation.js:138", + "type": 3, + "similarity": 0.8181818181818182, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L858-L858", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/donation.js#L138-L140" + }, + { + "key": "freecodecamp:api-server/src/common/models/user.js:498|api-server/src/common/models/user.js:581", + "type": 3, + "similarity": 0.9523809523809523, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L498-L504", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L581-L587" + }, + { + "key": "freecodecamp:api-server/src/server/boot/authentication.js:177|api-server/src/server/boot/randomAPIs.js:86", + "type": 3, + "similarity": 0.9545454545454546, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/authentication.js#L177-L180", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L86-L94" + }, + { + "key": "freecodecamp:api-server/src/server/boot/news.js:5|api-server/src/server/boot/status.js:1", + "type": 3, + "similarity": 0.8837209302325582, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/news.js#L5-L10", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/status.js#L1-L6" + }, + { + "key": "freecodecamp:api-server/src/common/models/block.js:4|api-server/src/common/models/user.js:173", + "type": 3, + "similarity": 0.822429906542056, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L4-L8", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L173-L180" + }, + { + "key": "freecodecamp:api-server/src/common/models/user.js:996|api-server/src/common/models/user.js:1013", + "type": 2, + "similarity": 1, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029" + }, + { + "key": "freecodecamp:api-server/src/server/boot/certificate.js:331|api-server/src/server/boot/certificate.js:502", + "type": 1, + "similarity": 1, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L331-L336", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L502-L507" + }, + { + "key": "freecodecamp:api-server/src/server/boot/randomAPIs.js:105|api-server/src/server/boot/user.js:95", + "type": 3, + "similarity": 0.8679245283018868, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L105-L111", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/user.js#L95-L98" + }, + { + "key": "freecodecamp:api-server/src/server/utils/getDynamicPropsForUser.js:1|api-server/src/server/utils/user-stats.js:138", + "type": 3, + "similarity": 0.9142857142857143, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/getDynamicPropsForUser.js#L1-L14", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/user-stats.js#L138-L145" + }, + { + "key": "freecodecamp:api-server/src/server/boot/settings.js:63|api-server/src/server/boot/settings.js:204", + "type": 3, + "similarity": 0.8395061728395061, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L63-L69", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L204-L215" + }, + { + "key": "freecodecamp:api-server/src/server/models/donation.js:36|api-server/src/server/models/donation.js:61", + "type": 2, + "similarity": 1, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L36-L40", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L61-L65" + }, + { + "key": "freecodecamp:api-server/src/server/utils/rx.js:29|api-server/src/server/utils/rx.js:36", + "type": 3, + "similarity": 0.8717948717948718, + "a": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L29-L31", + "b": "https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L36-L38" + } + ] + } + }, + { + "id": "javascript-algorithms", + "repo": "trekhleb/javascript-algorithms", + "sha": "4548296affb227c29ead868309e48667f8280c55", + "date": "2021-07-26", + "group": "replication", + "thesis": { + "functions": 192, + "candidates": 60, + "clones": 21 + }, + "files": { + "production": 168, + "test": 0, + "story": 0 + }, + "loc": { + "production": 9448, + "test": 0, + "story": 0 + }, + "clonedLoc": { + "production": 902, + "test": 0, + "story": 0 + }, + "units": 266, + "pairs": 26, + "pairsByType": [ + 2, + 3, + 21 + ], + "classes": 20, + "classesByType": [ + 2, + 2, + 16 + ], + "classesByKind": { + "component": 0, + "hook": 0, + "test": 0, + "story": 0, + "other": 20 + }, + "largestClass": 3, + "parseErrors": 0, + "durationMs": 31, + "sample": [ + { + "key": "javascript-algorithms:src/data-structures/doubly-linked-list/DoublyLinkedList.js:238|src/data-structures/linked-list/LinkedList.js:215", + "type": 3, + "similarity": 0.8923076923076924, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L238-L262", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L215-L237" + }, + { + "key": "javascript-algorithms:src/data-structures/tree/fenwick-tree/FenwickTree.js:22|src/data-structures/tree/fenwick-tree/FenwickTree.js:40", + "type": 3, + "similarity": 0.8155339805825242, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L22-L32", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L40-L52" + }, + { + "key": "javascript-algorithms:src/algorithms/graph/detect-cycle/detectDirectedCycle.js:38|src/algorithms/graph/detect-cycle/detectUndirectedCycle.js:31", + "type": 3, + "similarity": 0.96, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectDirectedCycle.js#L38-L62", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectUndirectedCycle.js#L31-L51" + }, + { + "key": "javascript-algorithms:src/algorithms/math/matrix/Matrix.js:249|src/algorithms/math/matrix/Matrix.js:295", + "type": 3, + "similarity": 0.9846153846153847, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L249-L263", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L295-L309" + }, + { + "key": "javascript-algorithms:src/algorithms/math/fourier-transform/discreteFourierTransform.js:22|src/algorithms/math/fourier-transform/inverseDiscreteFourierTransform.js:16", + "type": 3, + "similarity": 0.9442622950819672, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/discreteFourierTransform.js#L22-L69", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/inverseDiscreteFourierTransform.js#L16-L58" + }, + { + "key": "javascript-algorithms:src/algorithms/graph/articulation-points/articulationPoints.js:59|src/algorithms/graph/bridges/graphBridges.js:48", + "type": 3, + "similarity": 0.8012618296529969, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/articulation-points/articulationPoints.js#L59-L103", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/bridges/graphBridges.js#L48-L85" + }, + { + "key": "javascript-algorithms:src/algorithms/sets/knapsack-problem/Knapsack.js:14|src/algorithms/sets/knapsack-problem/Knapsack.js:46", + "type": 3, + "similarity": 0.9807692307692307, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L46-L60" + }, + { + "key": "javascript-algorithms:src/algorithms/graph/breadth-first-search/breadthFirstSearch.js:19|src/algorithms/graph/depth-first-search/depthFirstSearch.js:17", + "type": 1, + "similarity": 1, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/breadth-first-search/breadthFirstSearch.js#L19-L42", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/depth-first-search/depthFirstSearch.js#L17-L40" + }, + { + "key": "javascript-algorithms:src/data-structures/tree/avl-tree/AvlTree.js:86|src/data-structures/tree/avl-tree/AvlTree.js:114", + "type": 2, + "similarity": 1, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L86-L109", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L114-L136" + }, + { + "key": "javascript-algorithms:src/data-structures/doubly-linked-list/DoublyLinkedList.js:129|src/data-structures/linked-list/LinkedList.js:103", + "type": 1, + "similarity": 1, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125" + }, + { + "key": "javascript-algorithms:src/data-structures/tree/avl-tree/AvlTree.js:60|src/data-structures/tree/avl-tree/AvlTree.js:141", + "type": 2, + "similarity": 1, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L60-L81", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L141-L162" + }, + { + "key": "javascript-algorithms:src/data-structures/bloom-filter/BloomFilter.js:73|src/data-structures/bloom-filter/BloomFilter.js:90", + "type": 3, + "similarity": 0.8947368421052632, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L90-L99" + } + ], + "noMinimum": { + "units": 683, + "pairs": 1805, + "classes": 53, + "sample": [ + { + "key": "javascript-algorithms:src/algorithms/tree/depth-first-search/depthFirstSearch.js:23|src/algorithms/tree/depth-first-search/depthFirstSearch.js:26", + "type": 3, + "similarity": 0.8333333333333334, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L23-L23", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L26-L26" + }, + { + "key": "javascript-algorithms:src/data-structures/graph/GraphVertex.js:81|src/data-structures/graph/GraphVertex.js:93", + "type": 3, + "similarity": 0.8888888888888888, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L81-L87", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L93-L99" + }, + { + "key": "javascript-algorithms:src/algorithms/uncategorized/n-queens/QueenPosition.js:9|src/data-structures/linked-list/LinkedListNode.js:2", + "type": 3, + "similarity": 0.95, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L9-L12", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedListNode.js#L2-L5" + }, + { + "key": "javascript-algorithms:src/data-structures/doubly-linked-list/DoublyLinkedList.js:129|src/data-structures/linked-list/LinkedList.js:103", + "type": 1, + "similarity": 1, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125" + }, + { + "key": "javascript-algorithms:src/algorithms/sets/knapsack-problem/Knapsack.js:14|src/algorithms/sets/knapsack-problem/Knapsack.js:30", + "type": 3, + "similarity": 0.9807692307692307, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L30-L44" + }, + { + "key": "javascript-algorithms:src/algorithms/sets/knapsack-problem/KnapsackItem.js:16|src/algorithms/uncategorized/n-queens/QueenPosition.js:28", + "type": 3, + "similarity": 0.9230769230769231, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/KnapsackItem.js#L16-L18", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L28-L34" + }, + { + "key": "javascript-algorithms:src/data-structures/bloom-filter/BloomFilter.js:73|src/data-structures/bloom-filter/BloomFilter.js:105", + "type": 3, + "similarity": 0.8833333333333333, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L105-L116" + }, + { + "key": "javascript-algorithms:src/algorithms/image-processing/utils/imageData.js:17|src/algorithms/image-processing/utils/imageData.js:33", + "type": 3, + "similarity": 0.8395061728395061, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L17-L25", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L33-L39" + }, + { + "key": "javascript-algorithms:src/algorithms/math/bits/multiply.js:35|src/algorithms/math/bits/multiply.js:37", + "type": 3, + "similarity": 0.875, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L35-L35", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L37-L37" + }, + { + "key": "javascript-algorithms:src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js:21|src/algorithms/sorting/radix-sort/RadixSort.js:137", + "type": 3, + "similarity": 0.9583333333333334, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js#L21-L23", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/radix-sort/RadixSort.js#L137-L143" + }, + { + "key": "javascript-algorithms:src/algorithms/sorting/SortTester.js:30|src/data-structures/graph/GraphVertex.js:16", + "type": 3, + "similarity": 0.9393939393939394, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/SortTester.js#L30-L35", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L16-L22" + }, + { + "key": "javascript-algorithms:src/data-structures/graph/GraphVertex.js:66|src/data-structures/graph/GraphVertex.js:125", + "type": 3, + "similarity": 0.8076923076923077, + "a": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L66-L68", + "b": "https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L125-L129" + } + ] + } + }, + { + "id": "thealgorithms", + "repo": "TheAlgorithms/JavaScript", + "sha": "ee605b7694f9237574bd8b6ebbe45da253fd05f8", + "date": "2021-09-27", + "group": "replication", + "thesis": { + "functions": 385, + "candidates": 231, + "clones": 185 + }, + "files": { + "production": 235, + "test": 0, + "story": 0 + }, + "loc": { + "production": 11805, + "test": 0, + "story": 0 + }, + "clonedLoc": { + "production": 655, + "test": 0, + "story": 0 + }, + "units": 364, + "pairs": 29, + "pairsByType": [ + 5, + 2, + 22 + ], + "classes": 16, + "classesByType": [ + 2, + 1, + 13 + ], + "classesByKind": { + "component": 0, + "hook": 0, + "test": 0, + "story": 0, + "other": 16 + }, + "largestClass": 5, + "parseErrors": 0, + "durationMs": 42, + "sample": [ + { + "key": "thealgorithms:Conversions/LowerCaseConversion.js:18|Conversions/UpperCaseConversion.js:18", + "type": 3, + "similarity": 0.9821428571428571, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/LowerCaseConversion.js#L18-L33", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/UpperCaseConversion.js#L18-L33" + }, + { + "key": "thealgorithms:Maths/Fibonacci.js:3|Maths/Fibonacci.js:62", + "type": 3, + "similarity": 0.9107142857142857, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L3-L14", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L62-L70" + }, + { + "key": "thealgorithms:Cache/LFUCache.js:106|Cache/LRUCache.js:89", + "type": 2, + "similarity": 1, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L106-L141", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L89-L124" + }, + { + "key": "thealgorithms:Graphs/DepthFirstSearchRecursive.js:12|Graphs/KruskalMST.js:61", + "type": 3, + "similarity": 0.8869565217391304, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L12-L18", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L61-L67" + }, + { + "key": "thealgorithms:Search/TernarySearch.js:33|Search/TernarySearch.js:68", + "type": 3, + "similarity": 0.8619246861924686, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L33-L67", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L68-L102" + }, + { + "key": "thealgorithms:Graphs/KruskalMST.js:104|Graphs/PrimMST.js:200", + "type": 3, + "similarity": 0.944, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L104-L113", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L200-L208" + }, + { + "key": "thealgorithms:Linear-Algebra/src/la_lib.js:60|Linear-Algebra/src/la_lib.js:73", + "type": 3, + "similarity": 0.9852941176470589, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L60-L71", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L73-L84" + }, + { + "key": "thealgorithms:Graphs/DepthFirstSearchIterative.js:1|Graphs/DepthFirstSearchRecursive.js:1", + "type": 3, + "similarity": 0.8434504792332268, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L1-L39", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L1-L34" + }, + { + "key": "thealgorithms:Cache/LFUCache.js:56|Cache/LRUCache.js:42", + "type": 1, + "similarity": 1, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L56-L104", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L42-L87" + }, + { + "key": "thealgorithms:Hashes/SHA1.js:67|Hashes/SHA256.js:78", + "type": 1, + "similarity": 1, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L67-L88", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L78-L99" + }, + { + "key": "thealgorithms:Dynamic-Programming/SieveOfEratosthenes.js:1|Maths/SieveOfEratosthenes.js:1", + "type": 3, + "similarity": 0.9879518072289156, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/SieveOfEratosthenes.js#L1-L19", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/SieveOfEratosthenes.js#L1-L27" + }, + { + "key": "thealgorithms:Recursive/FloodFill.js:41|Recursive/FloodFill.js:65", + "type": 3, + "similarity": 0.8455284552845529, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74" + } + ], + "noMinimum": { + "units": 828, + "pairs": 1695, + "classes": 56, + "sample": [ + { + "key": "thealgorithms:Hashes/SHA1.js:116|Maths/ReversePolishNotation.js:5", + "type": 3, + "similarity": 0.8181818181818182, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L116-L116", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/ReversePolishNotation.js#L5-L5" + }, + { + "key": "thealgorithms:Dynamic-Programming/LongestPalindromicSubsequence.js:33|Dynamic-Programming/LongestValidParentheses.js:37", + "type": 2, + "similarity": 1, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestPalindromicSubsequence.js#L33-L37", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestValidParentheses.js#L37-L41" + }, + { + "key": "thealgorithms:Data-Structures/Vectors/Vector2.js:131|Recursive/KochSnowflake.js:55", + "type": 3, + "similarity": 0.9354838709677419, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Vectors/Vector2.js#L131-L135", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/KochSnowflake.js#L55-L59" + }, + { + "key": "thealgorithms:String/CheckFlatCase.js:12|String/CheckKebabCase.js:10", + "type": 3, + "similarity": 0.8852459016393442, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckFlatCase.js#L12-L20", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckKebabCase.js#L10-L18" + }, + { + "key": "thealgorithms:Cache/LRUCache.js:1|Trees/BreadthFirstTreeTraversal.js:6", + "type": 3, + "similarity": 0.8571428571428571, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L1-L9", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Trees/BreadthFirstTreeTraversal.js#L6-L12" + }, + { + "key": "thealgorithms:Data-Structures/Queue/CircularQueue.js:71|Data-Structures/Stack/Stack.js:48", + "type": 3, + "similarity": 0.9, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Queue/CircularQueue.js#L71-L75", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Stack/Stack.js#L48-L50" + }, + { + "key": "thealgorithms:Maths/Area.js:18|Maths/Area.js:76", + "type": 3, + "similarity": 0.95, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L18-L21", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L76-L79" + }, + { + "key": "thealgorithms:Recursive/FloodFill.js:41|Recursive/FloodFill.js:65", + "type": 3, + "similarity": 0.8455284552845529, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74" + }, + { + "key": "thealgorithms:Maths/Volume.js:53|Maths/Volume.js:88", + "type": 3, + "similarity": 0.90625, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L53-L58", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L88-L93" + }, + { + "key": "thealgorithms:Graphs/DepthFirstSearchIterative.js:12|Graphs/PrimMST.js:157", + "type": 3, + "similarity": 0.8869565217391304, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L12-L18", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L157-L163" + }, + { + "key": "thealgorithms:Dynamic-Programming/ClimbingStairs.js:19|Recursive/FibonacciNumberRecursive.js:10", + "type": 3, + "similarity": 0.9545454545454546, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/ClimbingStairs.js#L19-L23", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FibonacciNumberRecursive.js#L10-L13" + }, + { + "key": "thealgorithms:Hashes/SHA1.js:21|Hashes/SHA256.js:32", + "type": 1, + "similarity": 1, + "a": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L21-L27", + "b": "https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L32-L38" + } + ] + } + }, + { + "id": "excalidraw", + "repo": "excalidraw/excalidraw", + "sha": "14bb42edee3d6fee6be264e3ee78670b3b9cee79", + "date": "2026-10-27", + "group": "react", + "files": { + "production": 504, + "test": 161, + "story": 0 + }, + "loc": { + "production": 132744, + "test": 66799, + "story": 0 + }, + "clonedLoc": { + "production": 2937, + "test": 16657, + "story": 0 + }, + "units": 5148, + "pairs": 2214, + "pairsByType": [ + 22, + 489, + 1703 + ], + "classes": 287, + "classesByType": [ + 10, + 36, + 241 + ], + "classesByKind": { + "component": 17, + "hook": 0, + "test": 227, + "story": 0, + "other": 43 + }, + "largestClass": 52, + "parseErrors": 0, + "durationMs": 936, + "jscpd": { + "percentage": 7.038237374325183, + "durationMs": 105 + }, + "sample": [ + { + "key": "excalidraw:packages/element/tests/align.test.tsx:226|packages/element/tests/align.test.tsx:386", + "type": 3, + "similarity": 0.8739495798319328, + "a": "https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L226-L238", + "b": "https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L386-L400" + }, + { + "key": "excalidraw:packages/element/src/delta.ts:1990|packages/element/src/delta.ts:2014", + "type": 3, + "similarity": 0.8711656441717791, + "a": "https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L1990-L2008", + "b": "https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L2014-L2042" + }, + { + "key": "excalidraw:packages/excalidraw/tests/charts.test.tsx:59|packages/excalidraw/tests/charts.test.tsx:78", + "type": 3, + "similarity": 0.9557522123893806, + "a": "https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L59-L76", + "b": "https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L78-L97" + } + ] + }, + { + "id": "outline", + "repo": "outline/outline", + "sha": "6a2f23c023b952c752dfe025ef0ce2a0083cd0c1", + "date": "2026-10-28", + "group": "react", + "files": { + "production": 1159, + "test": 117, + "story": 0 + }, + "loc": { + "production": 145032, + "test": 12334, + "story": 0 + }, + "clonedLoc": { + "production": 6253, + "test": 4127, + "story": 0 + }, + "units": 3822, + "pairs": 892, + "pairsByType": [ + 27, + 119, + 746 + ], + "classes": 191, + "classesByType": [ + 13, + 32, + 146 + ], + "classesByKind": { + "component": 16, + "hook": 4, + "test": 57, + "story": 0, + "other": 114 + }, + "largestClass": 45, + "parseErrors": 0, + "durationMs": 639, + "jscpd": { + "percentage": 3.4001228268543127, + "durationMs": 72 + }, + "sample": [ + { + "key": "outline:shared/helpers/AuthenticationHelper.test.ts:64|shared/helpers/AuthenticationHelper.test.ts:76", + "type": 3, + "similarity": 0.9325153374233128, + "a": "https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L64-L74", + "b": "https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L76-L87" + }, + { + "key": "outline:shared/editor/commands/codeFence.ts:18|shared/editor/commands/codeFence.ts:43", + "type": 2, + "similarity": 1, + "a": "https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L18-L35", + "b": "https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L43-L60" + }, + { + "key": "outline:app/components/CommandBar/SearchIndex.test.ts:192|app/components/CommandBar/SearchIndex.test.ts:275", + "type": 3, + "similarity": 0.8225806451612904, + "a": "https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L192-L204", + "b": "https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L275-L285" + } + ] + }, + { + "id": "mastodon", + "repo": "mastodon/mastodon", + "sha": "b0555670b3d24d6e4a977a6bc3894daa128123fa", + "date": "2026-10-27", + "group": "react", + "files": { + "production": 862, + "test": 33, + "story": 51 + }, + "loc": { + "production": 90824, + "test": 2976, + "story": 4059 + }, + "clonedLoc": { + "production": 3666, + "test": 378, + "story": 86 + }, + "units": 2189, + "pairs": 504, + "pairsByType": [ + 8, + 94, + 402 + ], + "classes": 95, + "classesByType": [ + 3, + 22, + 70 + ], + "classesByKind": { + "component": 19, + "hook": 2, + "test": 10, + "story": 3, + "other": 61 + }, + "largestClass": 20, + "parseErrors": 0, + "durationMs": 344, + "jscpd": { + "percentage": 1.743863851695597, + "durationMs": 59 + }, + "sample": [ + { + "key": "mastodon:app/javascript/mastodon/features/notifications_v2/components/notification_quoted_update.tsx:20|app/javascript/mastodon/features/notifications_v2/components/notification_update.tsx:20", + "type": 1, + "similarity": 1, + "a": "https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_quoted_update.tsx#L20-L31", + "b": "https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_update.tsx#L20-L31" + }, + { + "key": "mastodon:app/javascript/mastodon/actions/announcements.js:139|app/javascript/mastodon/actions/statuses.js:325", + "type": 3, + "similarity": 0.8, + "a": "https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/announcements.js#L139-L147", + "b": "https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/statuses.js#L325-L333" + }, + { + "key": "mastodon:app/javascript/mastodon/actions/accounts.js:294|app/javascript/mastodon/actions/trends.js:85", + "type": 3, + "similarity": 0.8225806451612904, + "a": "https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/accounts.js#L294-L300", + "b": "https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/trends.js#L85-L89" + } + ] + }, + { + "id": "element-web", + "repo": "element-hq/element-web", + "sha": "c4b8799e5581a460f1557f130a74972917011f2d", + "date": "2026-10-27", + "group": "react", + "files": { + "production": 1451, + "test": 823, + "story": 0 + }, + "loc": { + "production": 194453, + "test": 134602, + "story": 0 + }, + "clonedLoc": { + "production": 3253, + "test": 25511, + "story": 0 + }, + "units": 11361, + "pairs": 1996, + "pairsByType": [ + 33, + 297, + 1666 + ], + "classes": 719, + "classesByType": [ + 15, + 96, + 608 + ], + "classesByKind": { + "component": 11, + "hook": 2, + "test": 640, + "story": 0, + "other": 66 + }, + "largestClass": 20, + "parseErrors": 14, + "durationMs": 2412, + "jscpd": { + "percentage": 4.420688887593345, + "durationMs": 136 + }, + "sample": [ + { + "key": "element-web:apps/web/src/events/EventTileFactory.tsx:448|apps/web/src/events/EventTileFactory.tsx:513", + "type": 3, + "similarity": 0.8952380952380953, + "a": "https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L448-L464", + "b": "https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L513-L527" + }, + { + "key": "element-web:apps/web/src/utils/arrays.test.ts:258|apps/web/src/utils/arrays.test.ts:270", + "type": 3, + "similarity": 0.9310344827586207, + "a": "https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L258-L268", + "b": "https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L270-L281" + }, + { + "key": "element-web:apps/web/src/components/structures/MessagePanel.test.tsx:154|apps/web/src/components/structures/MessagePanel.test.tsx:213", + "type": 3, + "similarity": 0.8333333333333334, + "a": "https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L154-L168", + "b": "https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L213-L235" + } + ] + }, + { + "id": "jitsi-meet", + "repo": "jitsi/jitsi-meet", + "sha": "0fc01ad1591dad0c92737cf8354376749eafd6dc", + "date": "2026-10-28", + "group": "react", + "files": { + "production": 1981, + "test": 11, + "story": 0 + }, + "loc": { + "production": 196720, + "test": 621, + "story": 0 + }, + "clonedLoc": { + "production": 4924, + "test": 37, + "story": 0 + }, + "units": 3416, + "pairs": 323, + "pairsByType": [ + 9, + 44, + 270 + ], + "classes": 85, + "classesByType": [ + 6, + 13, + 66 + ], + "classesByKind": { + "component": 14, + "hook": 0, + "test": 1, + "story": 0, + "other": 70 + }, + "largestClass": 37, + "parseErrors": 0, + "durationMs": 524, + "jscpd": { + "percentage": 1.4618165386353366, + "durationMs": 70 + }, + "sample": [ + { + "key": "jitsi-meet:react/features/calendar-sync/components/CalendarListContent.native.tsx:60|react/features/chat/components/web/ChatInput.tsx:153", + "type": 3, + "similarity": 0.8554913294797688, + "a": "https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/calendar-sync/components/CalendarListContent.native.tsx#L60-L71", + "b": "https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/chat/components/web/ChatInput.tsx#L153-L164" + }, + { + "key": "jitsi-meet:react/features/voice-agents/actions.ts:109|react/features/voice-agents/actions.ts:128", + "type": 2, + "similarity": 1, + "a": "https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L109-L119", + "b": "https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L128-L138" + }, + { + "key": "jitsi-meet:react/features/welcome/components/Tabs.tsx:73|react/features/welcome/components/Tabs.tsx:87", + "type": 3, + "similarity": 0.835820895522388, + "a": "https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L73-L85", + "b": "https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L87-L97" + } + ] + }, + { + "id": "twenty", + "repo": "twentyhq/twenty", + "sha": "ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72", + "date": "2026-10-28", + "group": "react", + "files": { + "production": 9183, + "test": 1728, + "story": 471 + }, + "loc": { + "production": 454660, + "test": 173983, + "story": 70249 + }, + "clonedLoc": { + "production": 17488, + "test": 46043, + "story": 8500 + }, + "units": 15313, + "pairs": 7075, + "pairsByType": [ + 99, + 495, + 6481 + ], + "classes": 920, + "classesByType": [ + 25, + 108, + 787 + ], + "classesByKind": { + "component": 66, + "hook": 52, + "test": 549, + "story": 99, + "other": 154 + }, + "largestClass": 397, + "parseErrors": 0, + "durationMs": 3887, + "jscpd": { + "percentage": 4.882453575045414, + "durationMs": 309 + }, + "sample": [ + { + "key": "twenty:packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts:125|packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts:230", + "type": 3, + "similarity": 0.8244274809160306, + "a": "https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L125-L138", + "b": "https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L230-L245" + }, + { + "key": "twenty:packages/twenty-front/src/modules/auth/utils/__tests__/isValidReturnToPath.test.ts:3|packages/twenty-front/src/utils/__tests__/compareNonEmptyStrings.test.ts:3", + "type": 3, + "similarity": 0.8423005565862709, + "a": "https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/auth/utils/__tests__/isValidReturnToPath.test.ts#L3-L55", + "b": "https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/utils/__tests__/compareNonEmptyStrings.test.ts#L3-L51" + }, + { + "key": "twenty:packages/twenty-front/src/modules/ai/components/__stories__/AiChatInlineBanner.stories.tsx:34|packages/twenty-front/src/modules/sse-db-event/components/__stories__/SSEProvider.stories.tsx:128", + "type": 3, + "similarity": 0.8, + "a": "https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/ai/components/__stories__/AiChatInlineBanner.stories.tsx#L34-L42", + "b": "https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/sse-db-event/components/__stories__/SSEProvider.stories.tsx#L128-L141" + } + ] + }, + { + "id": "plane", + "repo": "makeplane/plane", + "sha": "a9e70360c5bc5b1beb5f70fe4c2fa765743147ec", + "date": "2026-10-26", + "group": "react", + "files": { + "production": 1842, + "test": 0, + "story": 0 + }, + "loc": { + "production": 160578, + "test": 0, + "story": 0 + }, + "clonedLoc": { + "production": 21258, + "test": 0, + "story": 0 + }, + "units": 3492, + "pairs": 3578, + "pairsByType": [ + 60, + 579, + 2939 + ], + "classes": 269, + "classesByType": [ + 17, + 41, + 211 + ], + "classesByKind": { + "component": 61, + "hook": 3, + "test": 0, + "story": 0, + "other": 205 + }, + "largestClass": 100, + "parseErrors": 0, + "durationMs": 624, + "jscpd": { + "percentage": 7.645608592990416, + "durationMs": 97 + }, + "sample": [ + { + "key": "plane:apps/web/services/integrations/github.service.ts:28|apps/web/services/issue/issue.service.ts:378", + "type": 3, + "similarity": 0.8932038834951457, + "a": "https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/integrations/github.service.ts#L28-L36", + "b": "https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/issue/issue.service.ts#L378-L390" + }, + { + "key": "plane:apps/web/components/core/modals/bulk-delete-issues-modal.tsx:69|apps/web/components/inbox/modals/select-duplicate.tsx:57", + "type": 1, + "similarity": 1, + "a": "https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/core/modals/bulk-delete-issues-modal.tsx#L69-L80", + "b": "https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/inbox/modals/select-duplicate.tsx#L57-L68" + }, + { + "key": "plane:apps/web/components/issues/issue-modal/components/default-properties.tsx:207|apps/web/components/project/create/header.tsx:59", + "type": 3, + "similarity": 0.864, + "a": "https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/issues/issue-modal/components/default-properties.tsx#L207-L220", + "b": "https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/project/create/header.tsx#L59-L70" + } + ] + }, + { + "id": "bluesky", + "repo": "bluesky-social/social-app", + "sha": "1a1a3ceea1e72b62496e954619d7d8715717689c", + "date": "2026-10-28", + "group": "react", + "files": { + "production": 1841, + "test": 164, + "story": 0 + }, + "loc": { + "production": 243231, + "test": 28720, + "story": 0 + }, + "clonedLoc": { + "production": 15157, + "test": 3521, + "story": 0 + }, + "units": 5668, + "pairs": 918, + "pairsByType": [ + 60, + 156, + 702 + ], + "classes": 295, + "classesByType": [ + 30, + 48, + 217 + ], + "classesByKind": { + "component": 64, + "hook": 30, + "test": 83, + "story": 0, + "other": 118 + }, + "largestClass": 21, + "parseErrors": 0, + "durationMs": 1055, + "jscpd": { + "percentage": 4.5948876839659185, + "durationMs": 107 + }, + "sample": [ + { + "key": "bluesky:src/lib/appState.test.ts:186|src/lib/appState.test.ts:268", + "type": 3, + "similarity": 0.9719626168224299, + "a": "https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L186-L194", + "b": "https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L268-L276" + }, + { + "key": "bluesky:src/state/queries/find-contacts.ts:50|src/state/queries/messages/join-requests.ts:71", + "type": 3, + "similarity": 0.9636363636363636, + "a": "https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/find-contacts.ts#L50-L60", + "b": "https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/messages/join-requests.ts#L71-L82" + }, + { + "key": "bluesky:src/view/shell/Drawer.tsx:654|src/view/shell/Drawer.tsx:720", + "type": 3, + "similarity": 0.8780487804878049, + "a": "https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L654-L677", + "b": "https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L720-L742" + } + ] + }, + { + "id": "signal-desktop", + "repo": "signalapp/Signal-Desktop", + "sha": "17502b9d1a9e34af689f31508c4ac4ccee5b5cb7", + "date": "2026-10-20", + "group": "react", + "files": { + "production": 2355, + "test": 0, + "story": 329 + }, + "loc": { + "production": 453672, + "test": 0, + "story": 45349 + }, + "clonedLoc": { + "production": 40175, + "test": 0, + "story": 7976 + }, + "units": 9827, + "pairs": 2489, + "pairsByType": [ + 23, + 423, + 2043 + ], + "classes": 617, + "classesByType": [ + 15, + 95, + 507 + ], + "classesByKind": { + "component": 27, + "hook": 2, + "test": 0, + "story": 94, + "other": 494 + }, + "largestClass": 50, + "parseErrors": 1, + "durationMs": 1938, + "jscpd": { + "percentage": 5.203984334175524, + "durationMs": 162 + }, + "sample": [ + { + "key": "signal-desktop:ts/test-node/sql/migration_920_test.node.ts:155|ts/test-node/sql/migration_920_test.node.ts:299", + "type": 2, + "similarity": 1, + "a": "https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L155-L170", + "b": "https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L299-L314" + }, + { + "key": "signal-desktop:ts/components/LeftPane.dom.stories.tsx:1166|ts/components/LeftPane.dom.stories.tsx:1190", + "type": 3, + "similarity": 0.9482758620689655, + "a": "https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1166-L1188", + "b": "https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1190-L1212" + }, + { + "key": "signal-desktop:ts/util/iterables.std.ts:67|ts/util/iterables.std.ts:115", + "type": 2, + "similarity": 1, + "a": "https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L67-L82", + "b": "https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L115-L127" + } + ] + }, + { + "id": "grafana", + "repo": "grafana/grafana", + "sha": "e0555671bcb0a46fe9bd97114ee4700566e6c44a", + "date": "2026-10-28", + "group": "react", + "files": { + "production": 4744, + "test": 2420, + "story": 0 + }, + "loc": { + "production": 566434, + "test": 490251, + "story": 0 + }, + "clonedLoc": { + "production": 21732, + "test": 147894, + "story": 0 + }, + "units": 39276, + "pairs": 16051, + "pairsByType": [ + 266, + 1618, + 14167 + ], + "classes": 3202, + "classesByType": [ + 127, + 416, + 2659 + ], + "classesByKind": { + "component": 80, + "hook": 11, + "test": 2768, + "story": 0, + "other": 343 + }, + "largestClass": 429, + "parseErrors": 0, + "durationMs": 12192, + "jscpd": { + "percentage": 8.277124360234552, + "durationMs": 457 + }, + "sample": [ + { + "key": "grafana:public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:281|public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:538", + "type": 3, + "similarity": 0.991869918699187, + "a": "https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L281-L308", + "b": "https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L538-L564" + }, + { + "key": "grafana:public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx:225|public/app/features/home/Recommendations/NoDataCard.test.tsx:35", + "type": 3, + "similarity": 0.8130081300813008, + "a": "https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx#L225-L235", + "b": "https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/home/Recommendations/NoDataCard.test.tsx#L35-L42" + }, + { + "key": "grafana:public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts:343|public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts:2425", + "type": 3, + "similarity": 0.8672566371681416, + "a": "https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L343-L354", + "b": "https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L2425-L2433" + } + ] + }, + { + "id": "sentry", + "repo": "getsentry/sentry", + "sha": "2894b630364ed2d1f38db38c9474d6a4a3851b59", + "date": "2026-10-28", + "group": "react", + "files": { + "production": 6348, + "test": 2254, + "story": 101 + }, + "loc": { + "production": 798084, + "test": 446791, + "story": 21785 + }, + "clonedLoc": { + "production": 50432, + "test": 147827, + "story": 2638 + }, + "units": 33648, + "pairs": 47943, + "pairsByType": [ + 574, + 2842, + 44527 + ], + "classes": 2359, + "classesByType": [ + 80, + 298, + 1981 + ], + "classesByKind": { + "component": 121, + "hook": 30, + "test": 1791, + "story": 38, + "other": 379 + }, + "largestClass": 855, + "parseErrors": 1, + "durationMs": 9316, + "jscpd": { + "percentage": 9.91631994963031, + "durationMs": 550 + }, + "sample": [ + { + "key": "sentry:static/app/views/issueList/issueViews/renameIssueViewModal.tsx:72|static/app/views/settings/project/projectFilters/customFilterModal.tsx:954", + "type": 3, + "similarity": 0.896551724137931, + "a": "https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/issueList/issueViews/renameIssueViewModal.tsx#L72-L81", + "b": "https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/settings/project/projectFilters/customFilterModal.tsx#L954-L966" + }, + { + "key": "sentry:static/app/components/searchQueryBuilder/index.spec.tsx:2680|static/app/components/searchQueryBuilder/index.spec.tsx:2740", + "type": 3, + "similarity": 0.9010989010989011, + "a": "https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2680-L2701", + "b": "https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2740-L2765" + }, + { + "key": "sentry:static/app/gettingStartedDocs/javascript-nuxt/feedback.tsx:33|static/app/gettingStartedDocs/javascript-remix/feedback.tsx:33", + "type": 3, + "similarity": 0.8114285714285714, + "a": "https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-nuxt/feedback.tsx#L33-L68", + "b": "https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-remix/feedback.tsx#L33-L76" + } + ] + }, + { + "id": "posthog", + "repo": "PostHog/posthog", + "sha": "0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef", + "date": "2026-10-28", + "group": "react", + "files": { + "production": 4385, + "test": 1337, + "story": 389 + }, + "loc": { + "production": 829115, + "test": 270766, + "story": 54203 + }, + "clonedLoc": { + "production": 29400, + "test": 43535, + "story": 5306 + }, + "units": 27944, + "pairs": 5273, + "pairsByType": [ + 177, + 705, + 4391 + ], + "classes": 1375, + "classesByType": [ + 54, + 141, + 1180 + ], + "classesByKind": { + "component": 115, + "hook": 2, + "test": 806, + "story": 72, + "other": 380 + }, + "largestClass": 71, + "parseErrors": 1, + "durationMs": 8471, + "jscpd": { + "percentage": 3.718239145789718, + "durationMs": 373 + }, + "sample": [ + { + "key": "posthog:frontend/src/scenes/insights/insightVizDataLogic.test.ts:1369|frontend/src/scenes/insights/insightVizDataLogic.test.ts:1525", + "type": 3, + "similarity": 0.8495575221238938, + "a": "https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1369-L1386", + "b": "https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1525-L1545" + }, + { + "key": "posthog:frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts:248|frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts:276", + "type": 3, + "similarity": 0.9636363636363636, + "a": "https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L248-L261", + "b": "https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L276-L287" + }, + { + "key": "posthog:frontend/src/lib/monaco/domUtils.ts:19|frontend/src/lib/monaco/domUtils.ts:56", + "type": 3, + "similarity": 0.9469026548672567, + "a": "https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L19-L54", + "b": "https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L56-L95" + } + ] + } +] diff --git a/study/results/results.md b/study/results/results.md new file mode 100644 index 0000000..67713c2 --- /dev/null +++ b/study/results/results.md @@ -0,0 +1,59 @@ +# Study results + +## Part 1: replication of the 2021 thesis + +Same projects and folders as the thesis, at the last commit before October 2021, threshold 0.8. Test files are excluded (v0.6 only saw top-level functions, so it never compared test callbacks). + +| Project | Version | Units compared | Pairs reported | Clone classes | Real clones | +|---|---|---:|---:|---:|---:| +| [freeCodeCamp/freeCodeCamp](https://github.com/freeCodeCamp/freeCodeCamp/tree/d5e3979753eb16ac00b8e530e9956eae91126f56) | v0.6 (thesis, all candidates labeled) | 158 | 29 | – | 13/29 (44.8%) | +| | v1, no size minimum (like v0.6) | 552 | 1,125 | 27 | – sampled | +| | v1, defaults (≥ 50 tokens) | 201 | 3 | 3 | – sampled | +| [trekhleb/javascript-algorithms](https://github.com/trekhleb/javascript-algorithms/tree/4548296affb227c29ead868309e48667f8280c55) | v0.6 (thesis, all candidates labeled) | 192 | 60 | – | 21/60 (35.0%) | +| | v1, no size minimum (like v0.6) | 683 | 1,805 | 53 | – sampled | +| | v1, defaults (≥ 50 tokens) | 266 | 26 | 20 | – sampled | +| [TheAlgorithms/JavaScript](https://github.com/TheAlgorithms/JavaScript/tree/ee605b7694f9237574bd8b6ebbe45da253fd05f8) | v0.6 (thesis, all candidates labeled) | 385 | 231 | – | 185/231 (80.1%) | +| | v1, no size minimum (like v0.6) | 828 | 1,695 | 56 | – sampled | +| | v1, defaults (≥ 50 tokens) | 364 | 29 | 16 | – sampled | + +## Part 2: React applications + +**Cloned code** = share of non-blank lines inside a function, method or class that has at least one clone (jscd defaults: Type-1–3, threshold 0.8, ≥ 50 tokens). jscpd's figure is its own duplicated-lines percentage over all scanned files, for reference. + +| App | Files | Lines | Cloned code | Cloned test code | jscpd dup. | Clone classes (T1/T2/T3) | Largest class | Precision (sample) | Time | +|---|---:|---:|---:|---:|---:|---:|---:|---:|---:| +| [excalidraw/excalidraw](https://github.com/excalidraw/excalidraw/tree/14bb42edee3d6fee6be264e3ee78670b3b9cee79) | 665 | 199,543 | **2.2%** | 24.9% | 7.0% | 287 (10/36/241) | 52 | – | 0.9 s | +| [outline/outline](https://github.com/outline/outline/tree/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1) | 1,276 | 157,366 | **4.3%** | 33.5% | 3.4% | 191 (13/32/146) | 45 | – | 0.6 s | +| [mastodon/mastodon](https://github.com/mastodon/mastodon/tree/b0555670b3d24d6e4a977a6bc3894daa128123fa) | 946 | 97,859 | **4.0%** | 12.7% | 1.7% | 95 (3/22/70) | 20 | – | 0.3 s | +| [element-hq/element-web](https://github.com/element-hq/element-web/tree/c4b8799e5581a460f1557f130a74972917011f2d) | 2,274 | 329,055 | **1.7%** | 19.0% | 4.4% | 719 (15/96/608) | 20 | – | 2.4 s | +| [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet/tree/0fc01ad1591dad0c92737cf8354376749eafd6dc) | 1,992 | 197,341 | **2.5%** | 6.0% | 1.5% | 85 (6/13/66) | 37 | – | 0.5 s | +| [twentyhq/twenty](https://github.com/twentyhq/twenty/tree/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72) | 11,382 | 698,892 | **3.8%** | 26.5% | 4.9% | 920 (25/108/787) | 397 | – | 3.9 s | +| [makeplane/plane](https://github.com/makeplane/plane/tree/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec) | 1,842 | 160,578 | **13.2%** | – | 7.6% | 269 (17/41/211) | 100 | – | 0.6 s | +| [bluesky-social/social-app](https://github.com/bluesky-social/social-app/tree/1a1a3ceea1e72b62496e954619d7d8715717689c) | 2,005 | 271,951 | **6.2%** | 12.3% | 4.6% | 295 (30/48/217) | 21 | – | 1.1 s | +| [signalapp/Signal-Desktop](https://github.com/signalapp/Signal-Desktop/tree/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7) | 2,684 | 499,021 | **8.9%** | – | 5.2% | 617 (15/95/507) | 50 | – | 1.9 s | +| [grafana/grafana](https://github.com/grafana/grafana/tree/e0555671bcb0a46fe9bd97114ee4700566e6c44a) | 7,164 | 1,056,685 | **3.8%** | 30.2% | 8.3% | 3,202 (127/416/2659) | 429 | – | 12.2 s | +| [getsentry/sentry](https://github.com/getsentry/sentry/tree/2894b630364ed2d1f38db38c9474d6a4a3851b59) | 8,703 | 1,266,660 | **6.3%** | 33.1% | 9.9% | 2,359 (80/298/1981) | 855 | – | 9.3 s | +| [PostHog/posthog](https://github.com/PostHog/posthog/tree/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef) | 6,111 | 1,154,084 | **3.5%** | 16.1% | 3.7% | 1,375 (54/141/1180) | 71 | – | 8.5 s | + +Median cloned production code: **3.9%** (range 1.7–13.2%). + +### What gets cloned + +Clone classes by the kind of unit most of their copies are (heuristic: hooks start with `use`, components are capitalized units in `.jsx`/`.tsx` files, tests and stories by file path): + +| App | Components | Hooks | Other production | Tests | Stories | +|---|---:|---:|---:|---:|---:| +| excalidraw | 5.9% | 0.0% | 15.0% | 79.1% | 0.0% | +| outline | 8.4% | 2.1% | 59.7% | 29.8% | 0.0% | +| mastodon | 20.0% | 2.1% | 64.2% | 10.5% | 3.2% | +| element-web | 1.5% | 0.3% | 9.2% | 89.0% | 0.0% | +| jitsi-meet | 16.5% | 0.0% | 82.4% | 1.2% | 0.0% | +| twenty | 7.2% | 5.7% | 16.7% | 59.7% | 10.8% | +| plane | 22.7% | 1.1% | 76.2% | 0.0% | 0.0% | +| bluesky | 21.7% | 10.2% | 40.0% | 28.1% | 0.0% | +| signal-desktop | 4.4% | 0.3% | 80.1% | 0.0% | 15.2% | +| grafana | 2.5% | 0.3% | 10.7% | 86.4% | 0.0% | +| sentry | 5.1% | 1.3% | 16.1% | 75.9% | 1.6% | +| posthog | 8.4% | 0.1% | 27.6% | 58.6% | 5.2% | + +All apps together: 10,414 clone classes; components 5.9%, hooks 1.3%, other production 23.3%, tests 66.6%, stories 2.9%. Type-1/2/3 split of classes: 3.8% / 12.9% / 83.3%. diff --git a/study/results/sample.md b/study/results/sample.md new file mode 100644 index 0000000..25e648d --- /dev/null +++ b/study/results/sample.md @@ -0,0 +1,162 @@ +# Precision sample + +One pair per clone class, seeded. Links point to the pinned commits; no third-party code is copied here. Labels: [labels.json](../labels.json). + +## freeCodeCamp/freeCodeCamp + +Defaults: + +1. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L3-L9) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/auth-token.js#L3-L15) · **unlabeled** +2. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029) · **unlabeled** +3. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L249-L295) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L297-L329) · **unlabeled** + +No size minimum: + +1. Type-3 (82%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L858-L858) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/donation.js#L138-L140) · **unlabeled** +2. Type-3 (95%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L498-L504) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L581-L587) · **unlabeled** +3. Type-3 (95%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/authentication.js#L177-L180) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L86-L94) · **unlabeled** +4. Type-3 (88%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/news.js#L5-L10) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/status.js#L1-L6) · **unlabeled** +5. Type-3 (82%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L4-L8) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L173-L180) · **unlabeled** +6. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029) · **unlabeled** +7. Type-1 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L331-L336) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L502-L507) · **unlabeled** +8. Type-3 (87%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L105-L111) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/user.js#L95-L98) · **unlabeled** +9. Type-3 (91%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/getDynamicPropsForUser.js#L1-L14) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/user-stats.js#L138-L145) · **unlabeled** +10. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L63-L69) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L204-L215) · **unlabeled** +11. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L36-L40) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L61-L65) · **unlabeled** +12. Type-3 (87%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L29-L31) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L36-L38) · **unlabeled** + +## trekhleb/javascript-algorithms + +Defaults: + +1. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L238-L262) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L215-L237) · **unlabeled** +2. Type-3 (82%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L22-L32) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L40-L52) · **unlabeled** +3. Type-3 (96%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectDirectedCycle.js#L38-L62) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectUndirectedCycle.js#L31-L51) · **unlabeled** +4. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L249-L263) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L295-L309) · **unlabeled** +5. Type-3 (94%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/discreteFourierTransform.js#L22-L69) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/inverseDiscreteFourierTransform.js#L16-L58) · **unlabeled** +6. Type-3 (80%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/articulation-points/articulationPoints.js#L59-L103) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/bridges/graphBridges.js#L48-L85) · **unlabeled** +7. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L46-L60) · **unlabeled** +8. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/breadth-first-search/breadthFirstSearch.js#L19-L42) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/depth-first-search/depthFirstSearch.js#L17-L40) · **unlabeled** +9. Type-2 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L86-L109) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L114-L136) · **unlabeled** +10. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125) · **unlabeled** +11. Type-2 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L60-L81) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L141-L162) · **unlabeled** +12. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L90-L99) · **unlabeled** + +No size minimum: + +1. Type-3 (83%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L23-L23) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L26-L26) · **unlabeled** +2. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L81-L87) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L93-L99) · **unlabeled** +3. Type-3 (95%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L9-L12) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedListNode.js#L2-L5) · **unlabeled** +4. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125) · **unlabeled** +5. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L30-L44) · **unlabeled** +6. Type-3 (92%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/KnapsackItem.js#L16-L18) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L28-L34) · **unlabeled** +7. Type-3 (88%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L105-L116) · **unlabeled** +8. Type-3 (84%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L17-L25) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L33-L39) · **unlabeled** +9. Type-3 (88%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L35-L35) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L37-L37) · **unlabeled** +10. Type-3 (96%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js#L21-L23) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/radix-sort/RadixSort.js#L137-L143) · **unlabeled** +11. Type-3 (94%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/SortTester.js#L30-L35) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L16-L22) · **unlabeled** +12. Type-3 (81%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L66-L68) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L125-L129) · **unlabeled** + +## TheAlgorithms/JavaScript + +Defaults: + +1. Type-3 (98%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/LowerCaseConversion.js#L18-L33) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/UpperCaseConversion.js#L18-L33) · **unlabeled** +2. Type-3 (91%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L3-L14) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L62-L70) · **unlabeled** +3. Type-2 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L106-L141) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L89-L124) · **unlabeled** +4. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L12-L18) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L61-L67) · **unlabeled** +5. Type-3 (86%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L33-L67) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L68-L102) · **unlabeled** +6. Type-3 (94%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L104-L113) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L200-L208) · **unlabeled** +7. Type-3 (99%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L60-L71) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L73-L84) · **unlabeled** +8. Type-3 (84%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L1-L39) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L1-L34) · **unlabeled** +9. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L56-L104) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L42-L87) · **unlabeled** +10. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L67-L88) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L78-L99) · **unlabeled** +11. Type-3 (99%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/SieveOfEratosthenes.js#L1-L19) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/SieveOfEratosthenes.js#L1-L27) · **unlabeled** +12. Type-3 (85%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74) · **unlabeled** + +No size minimum: + +1. Type-3 (82%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L116-L116) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/ReversePolishNotation.js#L5-L5) · **unlabeled** +2. Type-2 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestPalindromicSubsequence.js#L33-L37) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestValidParentheses.js#L37-L41) · **unlabeled** +3. Type-3 (94%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Vectors/Vector2.js#L131-L135) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/KochSnowflake.js#L55-L59) · **unlabeled** +4. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckFlatCase.js#L12-L20) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckKebabCase.js#L10-L18) · **unlabeled** +5. Type-3 (86%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L1-L9) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Trees/BreadthFirstTreeTraversal.js#L6-L12) · **unlabeled** +6. Type-3 (90%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Queue/CircularQueue.js#L71-L75) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Stack/Stack.js#L48-L50) · **unlabeled** +7. Type-3 (95%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L18-L21) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L76-L79) · **unlabeled** +8. Type-3 (85%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74) · **unlabeled** +9. Type-3 (91%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L53-L58) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L88-L93) · **unlabeled** +10. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L12-L18) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L157-L163) · **unlabeled** +11. Type-3 (95%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/ClimbingStairs.js#L19-L23) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FibonacciNumberRecursive.js#L10-L13) · **unlabeled** +12. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L21-L27) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L32-L38) · **unlabeled** + +## excalidraw/excalidraw + +1. Type-3 (87%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L226-L238) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L386-L400) · **unlabeled** +2. Type-3 (87%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L1990-L2008) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L2014-L2042) · **unlabeled** +3. Type-3 (96%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L59-L76) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L78-L97) · **unlabeled** + +## outline/outline + +1. Type-3 (93%) · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L64-L74) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L76-L87) · **unlabeled** +2. Type-2 · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L18-L35) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L43-L60) · **unlabeled** +3. Type-3 (82%) · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L192-L204) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L275-L285) · **unlabeled** + +## mastodon/mastodon + +1. Type-1 · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_quoted_update.tsx#L20-L31) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_update.tsx#L20-L31) · **unlabeled** +2. Type-3 (80%) · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/announcements.js#L139-L147) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/statuses.js#L325-L333) · **unlabeled** +3. Type-3 (82%) · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/accounts.js#L294-L300) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/trends.js#L85-L89) · **unlabeled** + +## element-hq/element-web + +1. Type-3 (90%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L448-L464) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L513-L527) · **unlabeled** +2. Type-3 (93%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L258-L268) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L270-L281) · **unlabeled** +3. Type-3 (83%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L154-L168) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L213-L235) · **unlabeled** + +## jitsi/jitsi-meet + +1. Type-3 (86%) · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/calendar-sync/components/CalendarListContent.native.tsx#L60-L71) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/chat/components/web/ChatInput.tsx#L153-L164) · **unlabeled** +2. Type-2 · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L109-L119) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L128-L138) · **unlabeled** +3. Type-3 (84%) · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L73-L85) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L87-L97) · **unlabeled** + +## twentyhq/twenty + +1. Type-3 (82%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L125-L138) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L230-L245) · **unlabeled** +2. Type-3 (84%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/auth/utils/__tests__/isValidReturnToPath.test.ts#L3-L55) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/utils/__tests__/compareNonEmptyStrings.test.ts#L3-L51) · **unlabeled** +3. Type-3 (80%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/ai/components/__stories__/AiChatInlineBanner.stories.tsx#L34-L42) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/sse-db-event/components/__stories__/SSEProvider.stories.tsx#L128-L141) · **unlabeled** + +## makeplane/plane + +1. Type-3 (89%) · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/integrations/github.service.ts#L28-L36) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/issue/issue.service.ts#L378-L390) · **unlabeled** +2. Type-1 · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/core/modals/bulk-delete-issues-modal.tsx#L69-L80) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/inbox/modals/select-duplicate.tsx#L57-L68) · **unlabeled** +3. Type-3 (86%) · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/issues/issue-modal/components/default-properties.tsx#L207-L220) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/project/create/header.tsx#L59-L70) · **unlabeled** + +## bluesky-social/social-app + +1. Type-3 (97%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L186-L194) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L268-L276) · **unlabeled** +2. Type-3 (96%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/find-contacts.ts#L50-L60) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/messages/join-requests.ts#L71-L82) · **unlabeled** +3. Type-3 (88%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L654-L677) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L720-L742) · **unlabeled** + +## signalapp/Signal-Desktop + +1. Type-2 · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L155-L170) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L299-L314) · **unlabeled** +2. Type-3 (95%) · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1166-L1188) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1190-L1212) · **unlabeled** +3. Type-2 · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L67-L82) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L115-L127) · **unlabeled** + +## grafana/grafana + +1. Type-3 (99%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L281-L308) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L538-L564) · **unlabeled** +2. Type-3 (81%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx#L225-L235) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/home/Recommendations/NoDataCard.test.tsx#L35-L42) · **unlabeled** +3. Type-3 (87%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L343-L354) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L2425-L2433) · **unlabeled** + +## getsentry/sentry + +1. Type-3 (90%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/issueList/issueViews/renameIssueViewModal.tsx#L72-L81) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/settings/project/projectFilters/customFilterModal.tsx#L954-L966) · **unlabeled** +2. Type-3 (90%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2680-L2701) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2740-L2765) · **unlabeled** +3. Type-3 (81%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-nuxt/feedback.tsx#L33-L68) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-remix/feedback.tsx#L33-L76) · **unlabeled** + +## PostHog/posthog + +1. Type-3 (85%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1369-L1386) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1525-L1545) · **unlabeled** +2. Type-3 (96%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L248-L261) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L276-L287) · **unlabeled** +3. Type-3 (95%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L19-L54) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L56-L95) · **unlabeled** diff --git a/study/run.ts b/study/run.ts new file mode 100644 index 0000000..e7c4d96 --- /dev/null +++ b/study/run.ts @@ -0,0 +1,435 @@ +/** + * Empirical study: how much code is cloned in real JavaScript and React projects? + * + * npm run study fetch (once) and analyze every project + * npm run study -- only some projects + * + * Writes study/results/{results.json,results.md,sample.md}. + */ +import { execFileSync } from 'node:child_process' +import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' +import { tmpdir } from 'node:os' +import path from 'node:path' +import { Rng } from '../benchmark/rng.js' +import { + type CloneClass, + type ClonePair, + DEFAULT_IGNORE, + type DetectionResult, + detectClonesInPaths, + type UnitRef, +} from '../src/index.js' +import { fetchProject } from './fetch.js' +import { PROJECTS, type Project } from './projects.js' + +const RESULTS_DIR = path.join(import.meta.dirname, 'results') +const LABELS_FILE = path.join(import.meta.dirname, 'labels.json') +const ROOT = path.join(import.meta.dirname, '..') + +/** Generated, vendored and translation files are not written by people. */ +const IGNORE = [ + '**/__generated__/**', + '**/generated/**', + '**/*.generated.*', + '**/*.gen.*', + '**/vendor/**', + '**/locales/**', + '**/locale/**', + '**/__snapshots__/**', + '**/*.min.*', +] + +/** The replication excludes tests: v0.6 compared top-level functions only, never test callbacks. */ +const TEST_GLOBS = [ + '**/__test__/**', + '**/__tests__/**', + '**/test/**', + '**/tests/**', + '**/*.test.*', + '**/*.spec.*', +] + +type FileKind = 'production' | 'test' | 'story' +type UnitKind = 'component' | 'hook' | 'test' | 'story' | 'other' + +const TEST_PATH = + /(^|\/)(__tests?__|tests?|spec|specs|__mocks__|mocks?|e2e|fixtures?|testing|test-utils)\/|\.(test|spec)\.[cm]?[jt]sx?$/i +const STORY_PATH = /\.(stories|story)\.[cm]?[jt]sx?$/i + +export function fileKind(file: string): FileKind { + if (STORY_PATH.test(file)) return 'story' + if (TEST_PATH.test(file)) return 'test' + return 'production' +} + +/** Heuristic: components are capitalized functions/classes in JSX/TSX files; hooks start with `use`. */ +export function unitKind(ref: UnitRef): UnitKind { + const kind = fileKind(ref.file) + if (kind !== 'production') return kind + if (/^use[A-Z0-9]/.test(ref.name)) return 'hook' + if (/^[A-Z]/.test(ref.name) && /\.[jt]sx$/.test(ref.file)) return 'component' + return 'other' +} + +interface LabelEntry { + label: 'clone' | 'not-clone' + note?: string +} + +interface ProjectResult { + id: string + repo: string + sha: string + date: string + group: Project['group'] + thesis?: Project['thesis'] + files: Record + loc: Record + clonedLoc: Record + units: number + pairs: number + pairsByType: [number, number, number] + classes: number + classesByType: [number, number, number] + classesByKind: Record + largestClass: number + parseErrors: number + durationMs: number + jscpd?: { percentage: number; durationMs: number } + sample: Sample[] + /** Replication only: v1 with no minimum size, like v0.6. */ + noMinimum?: { units: number; pairs: number; classes: number; sample: Sample[] } +} + +interface Sample { + key: string + type: number + similarity: number + a: string + b: string +} + +const nonBlank = (text: string) => text.split('\n').filter((l) => l.trim()).length + +function lineSets(classes: CloneClass[]): Map> { + const lines = new Map>() + for (const cls of classes) { + for (const m of cls.members) { + const set = lines.get(m.file) ?? new Set() + for (let l = m.start.line; l <= m.end.line; l++) set.add(l) + lines.set(m.file, set) + } + } + return lines +} + +function majority(values: T[]): T { + const counts = new Map() + for (const v of values) counts.set(v, (counts.get(v) ?? 0) + 1) + return [...counts.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] as T +} + +function runJscpd(cwd: string, dirs: string[]): ProjectResult['jscpd'] { + const out = mkdtempSync(path.join(tmpdir(), 'jscpd-study-')) + const started = performance.now() + try { + execFileSync( + path.join(ROOT, 'node_modules', '.bin', 'jscpd'), + [ + ...dirs, + '--reporters', + 'json', + '--output', + out, + '--no-gitignore', + '--format', + 'javascript,typescript,jsx,tsx', + '--ignore', + [...DEFAULT_IGNORE, ...IGNORE].join(','), + ], + { cwd, stdio: ['ignore', 'ignore', 'ignore'], maxBuffer: 1 << 28 }, + ) + const report = JSON.parse(readFileSync(path.join(out, 'jscpd-report.json'), 'utf8')) + return { + percentage: Number(report.statistics.total.percentage), + durationMs: Math.round(performance.now() - started), + } + } catch { + return undefined + } finally { + rmSync(out, { recursive: true, force: true }) + } +} + +const permalink = (p: Project, ref: UnitRef) => + `https://github.com/${p.repo}/blob/${p.sha}/${ref.file}#L${ref.start.line}-L${ref.end.line}` +const sampleKey = (p: Project, pair: ClonePair) => + `${p.id}:${pair.a.file}:${pair.a.start.line}|${pair.b.file}:${pair.b.start.line}` + +async function analyze(project: Project): Promise { + const cwd = fetchProject(project) + const ignore = project.group === 'replication' ? [...IGNORE, ...TEST_GLOBS] : IGNORE + const started = performance.now() + const result: DetectionResult = await detectClonesInPaths(project.dirs, { cwd, ignore }) + const durationMs = Math.round(performance.now() - started) + + // Lines of code per file kind, and how many of them sit in a cloned unit. + const { findSourceFiles } = await import('../src/index.js') + const files = await findSourceFiles(project.dirs, { cwd, ignore }) + const cloned = lineSets(result.classes) + const zero = () => ({ production: 0, test: 0, story: 0 }) + const fileCount = zero() + const loc = zero() + const clonedLoc = zero() + for (const abs of files) { + const rel = path.relative(cwd, abs).split(path.sep).join('/') + const kind = fileKind(rel) + const lines = readFileSync(abs, 'utf8').split('\n') + fileCount[kind]++ + loc[kind] += nonBlank(lines.join('\n')) + const set = cloned.get(rel) + if (set) for (const l of set) if (lines[l - 1]?.trim()) clonedLoc[kind]++ + } + + const classesByKind: Record = { + component: 0, + hook: 0, + test: 0, + story: 0, + other: 0, + } + for (const cls of result.classes) classesByKind[majority(cls.members.map(unitKind))]++ + + // Precision sample: one pair per clone class, seeded. The thesis labeled every candidate; + // here the replication projects get up to 12 pairs each and the React apps 3. + const sample = samplePairs(project, result, project.group === 'replication' ? 12 : 3) + + // v0.6 had no minimum size. Running v1 the same way makes the replication like-for-like. + let noMinimum: ProjectResult['noMinimum'] + if (project.group === 'replication') { + const loose = await detectClonesInPaths(project.dirs, { cwd, ignore, minTokens: 0 }) + noMinimum = { + units: loose.units, + pairs: loose.pairs.length, + classes: loose.classes.length, + sample: samplePairs(project, loose, 12), + } + } + + const byType = (items: { type: number }[]) => + [1, 2, 3].map((t) => items.filter((x) => x.type === t).length) as [number, number, number] + + return { + id: project.id, + repo: project.repo, + sha: project.sha, + date: project.date, + group: project.group, + thesis: project.thesis, + files: fileCount, + loc, + clonedLoc, + units: result.units, + pairs: result.pairs.length, + pairsByType: byType(result.pairs), + classes: result.classes.length, + classesByType: byType(result.classes), + classesByKind, + largestClass: Math.max(0, ...result.classes.map((c) => c.members.length)), + parseErrors: result.errors.length, + durationMs, + jscpd: project.group === 'react' ? runJscpd(cwd, project.dirs) : undefined, + sample, + noMinimum, + } +} + +function samplePairs(project: Project, result: DetectionResult, n: number): Sample[] { + const classOf = new Map() + result.classes.forEach((cls, i) => { + for (const m of cls.members) classOf.set(`${m.file}:${m.start.line}:${m.start.column}`, i) + }) + const seen = new Set() + return new Rng(2021) + .shuffle(result.pairs) + .filter((p) => { + const k = classOf.get(`${p.a.file}:${p.a.start.line}:${p.a.start.column}`) + if (seen.has(k)) return false + seen.add(k) + return true + }) + .slice(0, n) + .map((p) => ({ + key: sampleKey(project, p), + type: p.type, + similarity: p.similarity, + a: permalink(project, p.a), + b: permalink(project, p.b), + })) +} + +const pct = (n: number, d: number) => (d === 0 ? '–' : `${((n / d) * 100).toFixed(1)}%`) +const int = (n: number) => n.toLocaleString('en-US') +const median = (xs: number[]) => { + const s = [...xs].sort((a, b) => a - b) + const m = Math.floor(s.length / 2) + return s.length % 2 ? (s[m] as number) : ((s[m - 1] as number) + (s[m] as number)) / 2 +} + +function markdown(results: ProjectResult[], labels: Record): string { + const precision = (r: { sample: Sample[] }) => { + const labeled = r.sample.filter((s) => labels[s.key]) + const clones = labeled.filter((s) => labels[s.key]?.label === 'clone').length + return labeled.length === 0 ? '–' : `${clones}/${labeled.length}` + } + const replication = results.filter((r) => r.group === 'replication') + const react = results.filter((r) => r.group === 'react') + const lines: string[] = ['# Study results', ''] + + if (replication.length > 0) { + lines.push( + '## Part 1: replication of the 2021 thesis', + '', + 'Same projects and folders as the thesis, at the last commit before October 2021, threshold 0.8. Test files are excluded (v0.6 only saw top-level functions, so it never compared test callbacks).', + '', + '| Project | Version | Units compared | Pairs reported | Clone classes | Real clones |', + '|---|---|---:|---:|---:|---:|', + ...replication.flatMap((r) => { + const t = r.thesis + const link = `[${r.repo}](https://github.com/${r.repo}/tree/${r.sha})` + return [ + `| ${link} | v0.6 (thesis, all candidates labeled) | ${t?.functions ?? '–'} | ${t?.candidates ?? '–'} | – | ${t ? `${t.clones}/${t.candidates} (${pct(t.clones, t.candidates)})` : '–'} |`, + r.noMinimum + ? `| | v1, no size minimum (like v0.6) | ${int(r.noMinimum.units)} | ${int(r.noMinimum.pairs)} | ${int(r.noMinimum.classes)} | ${precision(r.noMinimum)} sampled |` + : '', + `| | v1, defaults (≥ 50 tokens) | ${int(r.units)} | ${int(r.pairs)} | ${int(r.classes)} | ${precision(r)} sampled |`, + ].filter(Boolean) + }), + '', + ) + } + + if (react.length > 0) { + const coverage = (r: ProjectResult) => + r.loc.production ? r.clonedLoc.production / r.loc.production : 0 + lines.push( + '## Part 2: React applications', + '', + "**Cloned code** = share of non-blank lines inside a function, method or class that has at least one clone (jscd defaults: Type-1–3, threshold 0.8, ≥ 50 tokens). jscpd's figure is its own duplicated-lines percentage over all scanned files, for reference.", + '', + '| App | Files | Lines | Cloned code | Cloned test code | jscpd dup. | Clone classes (T1/T2/T3) | Largest class | Precision (sample) | Time |', + '|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|', + ...react.map( + (r) => + `| [${r.repo}](https://github.com/${r.repo}/tree/${r.sha}) | ${int(r.files.production + r.files.test + r.files.story)} | ${int(r.loc.production + r.loc.test + r.loc.story)} | **${pct(r.clonedLoc.production, r.loc.production)}** | ${pct(r.clonedLoc.test, r.loc.test)} | ${r.jscpd ? `${r.jscpd.percentage.toFixed(1)}%` : '–'} | ${int(r.classes)} (${r.classesByType.join('/')}) | ${r.largestClass} | ${precision(r)} | ${(r.durationMs / 1000).toFixed(1)} s |`, + ), + '', + `Median cloned production code: **${(median(react.map(coverage)) * 100).toFixed(1)}%** (range ${(Math.min(...react.map(coverage)) * 100).toFixed(1)}–${(Math.max(...react.map(coverage)) * 100).toFixed(1)}%).`, + '', + '### What gets cloned', + '', + 'Clone classes by the kind of unit most of their copies are (heuristic: hooks start with `use`, components are capitalized units in `.jsx`/`.tsx` files, tests and stories by file path):', + '', + '| App | Components | Hooks | Other production | Tests | Stories |', + '|---|---:|---:|---:|---:|---:|', + ...react.map((r) => { + const k = r.classesByKind + const total = r.classes + return `| ${r.id} | ${pct(k.component, total)} | ${pct(k.hook, total)} | ${pct(k.other, total)} | ${pct(k.test, total)} | ${pct(k.story, total)} |` + }), + '', + ) + const sum = (f: (r: ProjectResult) => number) => react.reduce((acc, r) => acc + f(r), 0) + const all = sum((r) => r.classes) + lines.push( + `All apps together: ${int(all)} clone classes; components ${pct( + sum((r) => r.classesByKind.component), + all, + )}, hooks ${pct( + sum((r) => r.classesByKind.hook), + all, + )}, other production ${pct( + sum((r) => r.classesByKind.other), + all, + )}, tests ${pct( + sum((r) => r.classesByKind.test), + all, + )}, stories ${pct( + sum((r) => r.classesByKind.story), + all, + )}. Type-1/2/3 split of classes: ${[0, 1, 2] + .map((i) => + pct( + sum((r) => r.classesByType[i] as number), + all, + ), + ) + .join(' / ')}.`, + '', + ) + } + return lines.join('\n') +} + +function sampleLine(s: Sample, i: number, label: LabelEntry | undefined): string { + return `${i + 1}. Type-${s.type}${s.type === 3 ? ` (${(s.similarity * 100).toFixed(0)}%)` : ''} · [A](${s.a}) ↔ [B](${s.b}) · **${label?.label ?? 'unlabeled'}**${label?.note ? `: ${label.note}` : ''}` +} + +function sampleMarkdown(results: ProjectResult[], labels: Record): string { + return [ + '# Precision sample', + '', + 'One pair per clone class, seeded. Links point to the pinned commits; no third-party code is copied here. Labels: [labels.json](../labels.json).', + '', + ...results.flatMap((r) => [ + `## ${r.repo}`, + '', + ...(r.noMinimum ? ['Defaults:', ''] : []), + ...r.sample.map((s, i) => { + const label = labels[s.key] + return sampleLine(s, i, label) + }), + '', + ...(r.noMinimum + ? [ + 'No size minimum:', + '', + ...r.noMinimum.sample.map((s, i) => sampleLine(s, i, labels[s.key])), + '', + ] + : []), + ]), + ].join('\n') +} + +async function main() { + const only = new Set(process.argv.slice(2)) + const selected = PROJECTS.filter((p) => only.size === 0 || only.has(p.id)) + const labels: Record = existsSync(LABELS_FILE) + ? JSON.parse(readFileSync(LABELS_FILE, 'utf8')).labels + : {} + + const results: ProjectResult[] = [] + for (const project of selected) { + process.stdout.write(`${project.repo}… `) + const r = await analyze(project) + results.push(r) + console.log( + `${int(r.units)} units, ${int(r.classes)} classes, cloned ${pct(r.clonedLoc.production, r.loc.production)} (${(r.durationMs / 1000).toFixed(1)} s)`, + ) + } + + writeFileSync(path.join(RESULTS_DIR, 'results.json'), `${JSON.stringify(results, null, 2)}\n`) + writeFileSync(path.join(RESULTS_DIR, 'results.md'), `${markdown(results, labels).trimEnd()}\n`) + writeFileSync( + path.join(RESULTS_DIR, 'sample.md'), + `${sampleMarkdown(results, labels).trimEnd()}\n`, + ) + const unlabeled = results + .flatMap((r) => [...r.sample, ...(r.noMinimum?.sample ?? [])]) + .filter((s) => !labels[s.key]).length + if (unlabeled > 0) + console.warn(`${unlabeled} sampled pairs unlabeled (see study/results/sample.md).`) +} + +await main() From c360c276377de311793421e6ebb62c00377e0859 Mon Sep 17 00:00:00 2001 From: Felipe Leal Date: Wed, 28 Oct 2026 17:00:08 +1100 Subject: [PATCH 3/3] feat(study): replication of the 2021 thesis and 12 React apps - Replication on the thesis's projects at their 2021 commits: run like v0.6 (no size minimum), v1's sampled precision is 64% vs v0.6's 68.4%; with the 50-token default it is 96% (26/27). - 12 open-source React apps (6.1M lines): median 3.8% of production code is in a cloned unit, 24.9% of test code; 70% of clone classes are in tests; 83% are Type-3; 31/36 sampled pairs are real clones. - Labels (AI-assisted, thesis rubric) link to code at pinned commits; no third-party code is copied into the repository. README: final thesis (title, advisor, UTFPR repository, v0.6 results), study summary, new matcher description and timings. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 4 +- README.md | 43 +++-- benchmark/README.md | 1 + study/README.md | 67 ++++++++ study/labels.json | 320 +++++++++++++++++++++++++++++++++++++ study/results/results.json | 102 ++++++------ study/results/results.md | 44 ++--- study/results/sample.md | 198 +++++++++++------------ study/run.ts | 2 +- study/show.ts | 39 +++++ 10 files changed, 633 insertions(+), 187 deletions(-) create mode 100644 study/README.md create mode 100644 study/labels.json create mode 100644 study/show.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 88cfc17..d62d8f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,15 +10,17 @@ A rewrite. The 2021 idea (normalize syntax trees, then compare) stays; everythin - Functions, methods and classes as units, including nested ones. - Type-1, Type-2 and Type-3 classification, with clone classes. - `jscd` CLI with text, JSON and SARIF reports, `--ignore` and `--fail`. +- `--changed ` (and the Action's `changed-since`): only report clones touching lines changed since a git ref, for pull requests. - Node API (`detectClonesInPaths`) and a browser-safe core (`javascript-clone-detection/core`). - GitHub Action for code scanning. - Browser playground. - Benchmark against jscpd, with real-code precision and an embeddings experiment. +- Empirical study: a replication of the 2021 thesis and 12 open-source React apps. ### Changed - Consistent renaming, with a separate namespace for property names (v0.6 renamed every name to one placeholder). -- Scoring by bit-parallel LCS over normalized tokens, behind a candidate index (v0.6 ran Levenshtein on regenerated code for every pair). +- Scoring by bit-parallel LCS over normalized tokens, behind a candidate index of 8-token shingles and a length window (v0.6 ran Levenshtein on regenerated code for every pair). - Deterministic output; nothing is written to the scanned directory. ### Removed diff --git a/README.md b/README.md index 9bd3bca..49dfbe7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Finds copy-pasted code in JavaScript, TypeScript and React projects, including c ![The playground comparing two snippets: a Type-3 clone, 96% similar, with the added statement marked](.github/assets/playground.png) -This started in 2021 as my undergraduate thesis research on code duplication in React apps ([background](#background-the-2021-thesis)). Version 1 is a rewrite, with a benchmark that checks it. +This started in 2021 as my bachelor's thesis on code duplication in JavaScript applications ([background](#background-the-2021-thesis)). Version 1 is a rewrite, with a benchmark that checks it and an [empirical study](#empirical-study) that uses it. ## Quick start @@ -149,10 +149,10 @@ flowchart LR } ``` -4. **Type-3** pairs are found without comparing every pair. One representative per normalized shape is indexed by 3-token shingles. Each candidate pair must pass two cheap upper bounds, from length and from token counts, before the exact score: 2·LCS / (|a| + |b|) over normalized tokens, computed with a bit-parallel LCS that handles 32 cells of the table per step. +4. **Type-3** pairs are found without comparing every pair. One representative per normalized shape is indexed by 8-token shingles (plus 3-token shingles for short units). Units are sorted by length, so each one only visits partners whose length can still reach the threshold. A candidate must then pass an upper bound from token counts before the exact score: 2·LCS / (|a| + |b|) over normalized tokens, computed with a bit-parallel LCS that handles 32 cells of the table per step. 5. **Report.** A clone nested inside a reported clone is dropped, and pairs are grouped into clone classes. Text and SARIF reports list classes; JSON has every pair. -A 1,600-file TypeScript monorepo (5,000 units) takes about 1 s and 370 MB on an M5 Pro. +On an M5 Pro, grafana's frontend (7,200 files, 1.1 million lines, 39,000 units) takes 12 s, and all 12 apps in the [empirical study](#empirical-study) (6.1 million lines) take 42 s. ### Design decisions @@ -164,6 +164,7 @@ A 1,600-file TypeScript monorepo (5,000 units) takes about 1 s and 370 MB on an | Units are functions, methods and classes | Fixed-size token windows (jscpd) | Reports name what was copied. It misses copies smaller than a function. | | Default 50-token minimum | 30 | On a real shadcn/ui project, half the reported units were one-line wrapper components. | | Default threshold 0.8 | Lower | Precision falls from 88% at 0.7 to 44% at 0.6 ([sweep](benchmark/results/results.md#type-3-threshold-sweep)). | +| 8-token shingles and a length window | 3-token shingles only | Tuned against an exhaustive run on grafana: 99.9% of its Type-3 pairs at about 1/13 of the cost, with no change on the benchmark. | ## Results @@ -180,6 +181,19 @@ On a [mutation-based benchmark](benchmark/README.md): 179 real functions and com Full results: [benchmark/results/results.md](benchmark/results/results.md). Method and threats to validity: [benchmark/README.md](benchmark/README.md). +## Empirical study + +The thesis asked how much real JavaScript code is cloned. [The study](study/README.md) answers it again with v1, in two parts. + +**Replication of the thesis** on its three projects, at their 2021 commits. The minimum size explains most of the precision gap. Run like v0.6 (no size minimum), v1's sampled precision is 64%, against v0.6's 68.4%; with the 50-token default it is 96% (26 of 27). + +**12 open-source React apps** (excalidraw, grafana, sentry, mastodon, Signal and others; 6.1 million lines): + +- **3.8%** of production code (median) sits in a cloned function, method or class; tests are cloned about six times as often (24.9%). +- 70% of clone classes are in tests. Of the production ones, only 21.5% are components; most are services, thunks, handlers and utilities. +- **83% of clone classes are Type-3:** copies that were edited after pasting. +- 31 of 36 sampled pairs are real clones (86%). + ## Limitations - Type-4 clones (same behavior, different code) are out of scope for a structural detector. @@ -189,18 +203,20 @@ Full results: [benchmark/results/results.md](benchmark/results/results.md). Meth ## Background: the 2021 thesis -This project began as my undergraduate thesis research at UTFPR, _Estudo empírico sobre duplicação de código em aplicações React.js_ ([PDF, Portuguese](https://drive.google.com/file/d/1MN8iBSfdD1yGMQ9aV-jwjdwJvRckiLfy/view?usp=sharing)). The study cites estimates that 7–23% of a typical system is cloned code. When it ran JSInspect, jscpd and Code Climate on a small React app, none of them flagged similar components as clones. The goal was a detector that understands React. +This project began as my bachelor's thesis in Software Engineering at UTFPR, _Estudo empírico sobre duplicação de código em aplicações JavaScript_ (2021, advised by Prof. Dr. Gustavo Jansen de Souza Santos; [UTFPR repository](http://repositorio.utfpr.edu.br/jspui/handle/1/30141), in Portuguese). It cites estimates that 7–23% of a typical system is cloned code. In its [proposal](https://drive.google.com/file/d/1MN8iBSfdD1yGMQ9aV-jwjdwJvRckiLfy/view?usp=sharing), JSInspect, jscpd and Code Climate, run on a small React app, flagged no similar components as clones. + +The thesis built v0.6 and ran it on freeCodeCamp, trekhleb/javascript-algorithms and TheAlgorithms/JavaScript. Every candidate was validated by hand: 219 of 320 were real clones (68.4% precision), mostly Type-3. Its conclusion was that manual validation stays necessary, because what counts as a clone depends on the reader. -Version 0.6 (2021) proved the core idea: normalizing syntax trees turns arrow-vs-regular and renamed copies into identical text. But it couldn't parse JSX, so it couldn't read React components. It scored with Levenshtein distance on text, compared every pair, wrote its working files into the scanned directory, and had no way to measure accuracy. Version 1 keeps the idea and rebuilds everything else: +Version 0.6 (2021) proved the core idea: normalizing syntax trees turns arrow-vs-regular and renamed copies into identical text. But it couldn't parse JSX, so it couldn't read React components. It scored with Levenshtein distance on text, compared every pair, and wrote its working files into the scanned directory. Version 1 keeps the idea and rebuilds everything else: -| | v0.6 (2021) | v1 (2026) | -| ---------- | ---------------------------------------------- | --------------------------------------------------------- | -| Languages | JavaScript, no JSX | JavaScript, JSX, TypeScript, TSX | -| Units | Top-level functions | Functions, methods, classes, nested | -| Renaming | Every name → one placeholder | Consistent, with separate property names | -| Scoring | Levenshtein on regenerated code, all pairs | Hashing, candidate index and bit-parallel LCS | -| Output | A score; files written into the scanned folder | Type-1/2/3 classes; text, JSON or SARIF | -| Evaluation | One hand-written pair per type | 179-family benchmark, jscpd baseline, real-code precision | +| | v0.6 (2021) | v1 (2026) | +| ---------- | ---------------------------------------------- | -------------------------------------------------------- | +| Languages | JavaScript, no JSX | JavaScript, JSX, TypeScript, TSX | +| Units | Top-level functions | Functions, methods, classes, nested | +| Renaming | Every name → one placeholder | Consistent, with separate property names | +| Scoring | Levenshtein on regenerated code, all pairs | Hashing, candidate index and bit-parallel LCS | +| Output | A score; files written into the scanned folder | Type-1/2/3 classes; text, JSON or SARIF | +| Evaluation | 3 projects, every candidate validated by hand | Mutation benchmark vs. jscpd, replication, 12 React apps | The 2021 examples live on as [test fixtures](test/fixtures/legacy) and as presets in the playground. The original code is at [v0.6.0](https://github.com/felipelealdefaria/javascript-clone-detection/tree/e46ca101352ca0f8dd1e5317982fa9da3a629cab). @@ -214,6 +230,7 @@ npm run typecheck npm run build # dist/ npm run playground # local playground at http://localhost:5173 npm run bench # benchmark (downloads the corpus once) +npm run study # empirical study (fetches 15 projects once) ``` Requires Node 22.18 or later. diff --git a/benchmark/README.md b/benchmark/README.md index 5c02081..ec4be6f 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -50,6 +50,7 @@ Both tools' Type-3 scores are also swept from 0.6 to 0.9, because they measure d - **Type-1 and Type-2 recall are expected to be 100% for jscd.** The mutations are exactly what its normalizer erases. These rows show that the normalizer is correct, not that the approach is clever. The informative rows are Type-3, Type-4, the threshold sweep, and precision on real code. - **The benchmark was used during development.** It exposed a real bug: renaming a destructured prop (`{ title }` → `{ title: heading }`) made React components look different. Fixing it (property names got their own renaming namespace) raised React Type-2 recall from 21% to 100%. The fix is a general correctness change, but the numbers are post-fix. +- **The candidate search was tuned outside the benchmark.** The benchmark is too small to stress it. Shingle size and posting cap were tuned against an exhaustive run on grafana (39,000 units), keeping 99.9% of its Type-3 pairs. Benchmark results did not change. - **Mutants are synthetic.** Real copy-paste edits are messier. Real-code precision partly covers this gap; real-code recall is not measured. - **Type-4 is small and hand-written:** 16 pairs, written by the same author as the tool. - **Precision on real code covers jscd only,** with 29 labeled pairs. The table shows 95% Wilson lower bounds for that reason. diff --git a/study/README.md b/study/README.md new file mode 100644 index 0000000..c1c03bd --- /dev/null +++ b/study/README.md @@ -0,0 +1,67 @@ +# How much code do JavaScript and React projects clone? + +This study revisits the question of my 2021 thesis, _Estudo empírico sobre duplicação de código em aplicações JavaScript_ ([UTFPR repository](http://repositorio.utfpr.edu.br/jspui/handle/1/30141)), with the v1 detector. It has two parts: + +1. **Replication.** The thesis's three projects at their 2021 state, compared with the thesis's own results. +2. **React applications.** Twelve well-known open-source React apps: how much of their code is cloned, of which type, and in which kinds of code. + +Full tables: [results/results.md](results/results.md). Every labeled pair, linked to its code: [results/sample.md](results/sample.md). + +```bash +npm run study # fetches each project once (sparse, shallow), then analyzes all +npm run study -- grafana # one project +``` + +## Findings + +**1. The minimum size explains most of the precision gap between v0.6 and v1.** Run without a size minimum, as v0.6 was, v1's precision is close to v0.6's. The 50-token minimum is what lifts it: + +| | Real clones among reported pairs | 95% lower bound | +| -------------------------------------- | -------------------------------: | --------------: | +| v0.6 (thesis, every candidate labeled) | 219/320 (68.4%) | 63% | +| v1, no size minimum (36 sampled) | 23/36 (64%) | 48% | +| v1, defaults (27 sampled) | 26/27 (96%) | 82% | + +Without a minimum, the false positives are what the thesis described: one-line callbacks, getters and two-field constructors that share a shape by coincidence. The thesis had its own hypothesis: stop normalizing function-call names. That raised freeCodeCamp's precision from 45% to 80%. A size minimum gets a similar effect differently, by never comparing units too small to carry a signal. + +**2. In React apps, a median of 3.8% of production code sits in a cloned function, method or class** (range 1.7–13.2%, pooled 4.5%), across 12 apps, 47,000 files and 6.1 million lines. That is below the 7–23% the thesis cites for typical systems (Roy & Cordy, 2008). The definitions differ, though: here a clone must be a whole function, method or class of at least 50 tokens, at 0.8 similarity. + +**3. Test code is cloned about six times as often as production code:** median 24.9% of test lines, pooled 26.8%. About 70% of all clone classes are in tests, mostly copy-adapted test cases. It is the clearest pattern in the data, and the reason `--ignore "**/*.test.*"` is a sensible default for teams that accept duplication in tests. + +**4. Most production clones are not components.** Of the 2,845 production clone classes, 21.5% are components, 4.9% hooks and 73.7% other code: API service methods, Redux thunks, event handlers, utilities. The thesis proposal focused on duplicated React components, which the existing tools missed. In these apps they are a minority of production clones. + +**5. 83% of clone classes are Type-3:** copies that were edited after pasting. Exact copies are 3.8%, renamed copies 12.9%. The thesis also found mostly Type-3 clones. Detectors that only find exact or renamed copies miss most real duplication. + +**6. Precision on application code:** 31 of 36 sampled pairs are real clones (86%; ≥ 71% at 95% confidence). The five false positives are test or story code with coincidentally similar structure, plus two React idioms: constructors that bind handlers, and a tab list rendered next to its tab panels. + +### Patterns seen while labeling + +- **Mirrored pairs:** next/previous, add/subtract, allow/decline, left/right rotations. Each is written twice, with one operator or direction changed. +- **Per-variant copies:** setup docs per framework (Sentry), notification components per type (Mastodon), the same `useEffect` in two modals (Plane). +- **Request templates:** a Redux thunk or service method copied for each endpoint, with request, success and failure steps. +- **Copy-adapted tests:** the largest group by far. + +## Method + +**Projects** ([projects.ts](projects.ts)) are pinned to a commit and fetched with a sparse, shallow `git` checkout of the scanned folders only. The code is parsed, never installed or run. + +| Part | Projects | Commit | +| ----------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | +| Replication | freeCodeCamp (`api-server/src`), trekhleb/javascript-algorithms (`src`), TheAlgorithms/JavaScript | Last commit before 2021-10-01, the thesis's analysis period | +| React apps | excalidraw, outline, mastodon, element-web, jitsi-meet, twenty, plane, bluesky social-app, Signal-Desktop, grafana, sentry, posthog | 2026-10-28 | + +**Detection:** jscd defaults (threshold 0.8, at least 50 tokens). Generated, vendored, locale and minified files are excluded. The replication also excludes test files, as v0.6 only compared top-level functions and never saw test callbacks. + +**Cloned code** is the share of non-blank lines inside a unit that belongs to a clone class. Files are split by path into tests (`__tests__/`, `test/`, `test-*/`, `*.test.*`, `*_test.*`, …), stories (`*.stories.*`) and production. Unit kinds are heuristics: hooks start with `use`, and components are capitalized units in `.jsx`/`.tsx` files. + +**jscpd** (5.4.2, defaults) also runs on each app, for reference. Its percentage counts duplicated lines in token windows, so it is not the same measure. + +**Precision** is from a seeded sample with at most one pair per clone class: 12 per replication project and setting, 3 per app. Pairs are labeled with the thesis's rubric. A pair is a clone when both units are copies with the same intent, so a fix to one would likely be needed in the other; that includes copies that differ only by an operator, as in the thesis's Figure 25. Coincidental similarity between units with different purposes is not a clone, as in the thesis's Figure 22. Labels and notes: [labels.json](labels.json). + +## Threats to validity + +- **The labels are AI-assisted** and were made by the same project that built the tool. The thesis labels were made by an invited developer and reviewed by the author and advisor. Every pair links to its code so the labels can be audited. +- **Samples are small.** The table shows 95% Wilson lower bounds for that reason. +- **The thesis labeled every candidate pair; this study samples one pair per clone class.** Classes with many copies weigh less here. +- **The v0.6 and v1 numbers come from the same code but different unit definitions.** v1 also compares methods and nested functions. Counts are not directly comparable; precision is. +- **Twelve apps, chosen for popularity.** They are not a random sample of React code, and the kind heuristics will misclassify some units. diff --git a/study/labels.json b/study/labels.json new file mode 100644 index 0000000..d4fee41 --- /dev/null +++ b/study/labels.json @@ -0,0 +1,320 @@ +{ + "_about": "Labels for study/results/sample.md, made by inspection (AI-assisted) with the 2021 thesis rubric: a pair is a clone when both units are copies with the same intent, so a maintenance change in one would likely be needed in the other, including copies that differ only by an operator; coincidental structural similarity between units with different purposes is not a clone. Each pair links to the code at a pinned commit.", + "labels": { + "freecodecamp:api-server/src/common/models/block.js:3|api-server/src/server/models/auth-token.js:3": { + "label": "clone" + }, + "freecodecamp:api-server/src/common/models/user.js:996|api-server/src/common/models/user.js:1013": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/boot/challenge.js:249|api-server/src/server/boot/challenge.js:297": { + "label": "clone" + }, + "freecodecamp:api-server/src/common/models/user.js:858|api-server/src/server/utils/donation.js:138": { + "label": "not-clone", + "note": "Two one-line promise callbacks." + }, + "freecodecamp:api-server/src/common/models/user.js:498|api-server/src/common/models/user.js:581": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/boot/authentication.js:177|api-server/src/server/boot/randomAPIs.js:86": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/boot/news.js:5|api-server/src/server/boot/status.js:1": { + "label": "not-clone", + "note": "Framework router boot files for unrelated routes." + }, + "freecodecamp:api-server/src/common/models/block.js:4|api-server/src/common/models/user.js:173": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/boot/certificate.js:331|api-server/src/server/boot/certificate.js:502": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/boot/randomAPIs.js:105|api-server/src/server/boot/user.js:95": { + "label": "not-clone", + "note": "Two tiny unrelated route handlers." + }, + "freecodecamp:api-server/src/server/utils/getDynamicPropsForUser.js:1|api-server/src/server/utils/user-stats.js:138": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/boot/settings.js:63|api-server/src/server/boot/settings.js:204": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/models/donation.js:36|api-server/src/server/models/donation.js:61": { + "label": "clone" + }, + "freecodecamp:api-server/src/server/utils/rx.js:29|api-server/src/server/utils/rx.js:36": { + "label": "not-clone", + "note": "Two different one-line Rx helpers." + }, + "javascript-algorithms:src/data-structures/doubly-linked-list/DoublyLinkedList.js:238|src/data-structures/linked-list/LinkedList.js:215": { + "label": "clone" + }, + "javascript-algorithms:src/data-structures/tree/fenwick-tree/FenwickTree.js:22|src/data-structures/tree/fenwick-tree/FenwickTree.js:40": { + "label": "not-clone", + "note": "Fenwick tree update vs. prefix query: shared range guard, different algorithms by design." + }, + "javascript-algorithms:src/algorithms/graph/detect-cycle/detectDirectedCycle.js:38|src/algorithms/graph/detect-cycle/detectUndirectedCycle.js:31": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/math/matrix/Matrix.js:249|src/algorithms/math/matrix/Matrix.js:295": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/math/fourier-transform/discreteFourierTransform.js:22|src/algorithms/math/fourier-transform/inverseDiscreteFourierTransform.js:16": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/graph/articulation-points/articulationPoints.js:59|src/algorithms/graph/bridges/graphBridges.js:48": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/sets/knapsack-problem/Knapsack.js:14|src/algorithms/sets/knapsack-problem/Knapsack.js:46": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/graph/breadth-first-search/breadthFirstSearch.js:19|src/algorithms/graph/depth-first-search/depthFirstSearch.js:17": { + "label": "clone" + }, + "javascript-algorithms:src/data-structures/tree/avl-tree/AvlTree.js:86|src/data-structures/tree/avl-tree/AvlTree.js:114": { + "label": "clone" + }, + "javascript-algorithms:src/data-structures/doubly-linked-list/DoublyLinkedList.js:129|src/data-structures/linked-list/LinkedList.js:103": { + "label": "clone" + }, + "javascript-algorithms:src/data-structures/tree/avl-tree/AvlTree.js:60|src/data-structures/tree/avl-tree/AvlTree.js:141": { + "label": "clone" + }, + "javascript-algorithms:src/data-structures/bloom-filter/BloomFilter.js:73|src/data-structures/bloom-filter/BloomFilter.js:90": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/tree/depth-first-search/depthFirstSearch.js:23|src/algorithms/tree/depth-first-search/depthFirstSearch.js:26": { + "label": "not-clone", + "note": "Two one-line stub callbacks." + }, + "javascript-algorithms:src/data-structures/graph/GraphVertex.js:81|src/data-structures/graph/GraphVertex.js:93": { + "label": "clone", + "note": "Same lookup copied with a different predicate." + }, + "javascript-algorithms:src/algorithms/uncategorized/n-queens/QueenPosition.js:9|src/data-structures/linked-list/LinkedListNode.js:2": { + "label": "not-clone", + "note": "Two-field constructors of unrelated classes." + }, + "javascript-algorithms:src/algorithms/sets/knapsack-problem/Knapsack.js:14|src/algorithms/sets/knapsack-problem/Knapsack.js:30": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/sets/knapsack-problem/KnapsackItem.js:16|src/algorithms/uncategorized/n-queens/QueenPosition.js:28": { + "label": "not-clone", + "note": "Unrelated one-line getters." + }, + "javascript-algorithms:src/data-structures/bloom-filter/BloomFilter.js:73|src/data-structures/bloom-filter/BloomFilter.js:105": { + "label": "clone" + }, + "javascript-algorithms:src/algorithms/image-processing/utils/imageData.js:17|src/algorithms/image-processing/utils/imageData.js:33": { + "label": "clone", + "note": "Pixel index computation copied between getter and setter." + }, + "javascript-algorithms:src/algorithms/math/bits/multiply.js:35|src/algorithms/math/bits/multiply.js:37": { + "label": "not-clone", + "note": "Intentional case split inside one algorithm." + }, + "javascript-algorithms:src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js:21|src/algorithms/sorting/radix-sort/RadixSort.js:137": { + "label": "clone", + "note": "Same array-of-buckets idiom in two modules." + }, + "javascript-algorithms:src/algorithms/sorting/SortTester.js:30|src/data-structures/graph/GraphVertex.js:16": { + "label": "clone", + "note": "Comparator copied with a different key." + }, + "javascript-algorithms:src/data-structures/graph/GraphVertex.js:66|src/data-structures/graph/GraphVertex.js:125": { + "label": "not-clone", + "note": "Unrelated one-line methods." + }, + "thealgorithms:Conversions/LowerCaseConversion.js:18|Conversions/UpperCaseConversion.js:18": { + "label": "clone" + }, + "thealgorithms:Maths/Fibonacci.js:3|Maths/Fibonacci.js:62": { + "label": "clone" + }, + "thealgorithms:Cache/LFUCache.js:106|Cache/LRUCache.js:89": { + "label": "clone" + }, + "thealgorithms:Graphs/DepthFirstSearchRecursive.js:12|Graphs/KruskalMST.js:61": { + "label": "clone" + }, + "thealgorithms:Search/TernarySearch.js:33|Search/TernarySearch.js:68": { + "label": "clone" + }, + "thealgorithms:Graphs/KruskalMST.js:104|Graphs/PrimMST.js:200": { + "label": "clone" + }, + "thealgorithms:Linear-Algebra/src/la_lib.js:60|Linear-Algebra/src/la_lib.js:73": { + "label": "clone" + }, + "thealgorithms:Graphs/DepthFirstSearchIterative.js:1|Graphs/DepthFirstSearchRecursive.js:1": { + "label": "clone" + }, + "thealgorithms:Cache/LFUCache.js:56|Cache/LRUCache.js:42": { + "label": "clone" + }, + "thealgorithms:Hashes/SHA1.js:67|Hashes/SHA256.js:78": { + "label": "clone" + }, + "thealgorithms:Dynamic-Programming/SieveOfEratosthenes.js:1|Maths/SieveOfEratosthenes.js:1": { + "label": "clone" + }, + "thealgorithms:Recursive/FloodFill.js:41|Recursive/FloodFill.js:65": { + "label": "clone" + }, + "thealgorithms:Hashes/SHA1.js:116|Maths/ReversePolishNotation.js:5": { + "label": "not-clone", + "note": "Unrelated one-line arrow functions." + }, + "thealgorithms:Dynamic-Programming/LongestPalindromicSubsequence.js:33|Dynamic-Programming/LongestValidParentheses.js:37": { + "label": "clone" + }, + "thealgorithms:Data-Structures/Vectors/Vector2.js:131|Recursive/KochSnowflake.js:55": { + "label": "clone" + }, + "thealgorithms:String/CheckFlatCase.js:12|String/CheckKebabCase.js:10": { + "label": "clone" + }, + "thealgorithms:Cache/LRUCache.js:1|Trees/BreadthFirstTreeTraversal.js:6": { + "label": "not-clone", + "note": "Constructors of unrelated node classes." + }, + "thealgorithms:Data-Structures/Queue/CircularQueue.js:71|Data-Structures/Stack/Stack.js:48": { + "label": "not-clone", + "note": "Print loops of different data structures." + }, + "thealgorithms:Maths/Area.js:18|Maths/Area.js:76": { + "label": "clone" + }, + "thealgorithms:Maths/Volume.js:53|Maths/Volume.js:88": { + "label": "clone" + }, + "thealgorithms:Graphs/DepthFirstSearchIterative.js:12|Graphs/PrimMST.js:157": { + "label": "clone" + }, + "thealgorithms:Dynamic-Programming/ClimbingStairs.js:19|Recursive/FibonacciNumberRecursive.js:10": { + "label": "not-clone", + "note": "Unrelated demo snippets." + }, + "thealgorithms:Hashes/SHA1.js:21|Hashes/SHA256.js:32": { + "label": "clone" + }, + "excalidraw:packages/element/tests/align.test.tsx:226|packages/element/tests/align.test.tsx:386": { + "label": "clone" + }, + "excalidraw:packages/element/src/delta.ts:1990|packages/element/src/delta.ts:2014": { + "label": "clone" + }, + "excalidraw:packages/excalidraw/tests/charts.test.tsx:59|packages/excalidraw/tests/charts.test.tsx:78": { + "label": "clone" + }, + "outline:shared/helpers/AuthenticationHelper.test.ts:64|shared/helpers/AuthenticationHelper.test.ts:76": { + "label": "clone" + }, + "outline:shared/editor/commands/codeFence.ts:18|shared/editor/commands/codeFence.ts:43": { + "label": "clone" + }, + "outline:app/components/CommandBar/SearchIndex.test.ts:192|app/components/CommandBar/SearchIndex.test.ts:275": { + "label": "clone", + "note": "Copy-adapted test template." + }, + "mastodon:app/javascript/mastodon/features/notifications_v2/components/notification_quoted_update.tsx:20|app/javascript/mastodon/features/notifications_v2/components/notification_update.tsx:20": { + "label": "clone" + }, + "mastodon:app/javascript/mastodon/actions/announcements.js:139|app/javascript/mastodon/actions/statuses.js:325": { + "label": "clone", + "note": "Redux thunk template (request/success/fail) reused for another endpoint." + }, + "mastodon:app/javascript/mastodon/actions/accounts.js:294|app/javascript/mastodon/actions/trends.js:85": { + "label": "clone" + }, + "element-web:apps/web/src/events/EventTileFactory.tsx:448|apps/web/src/events/EventTileFactory.tsx:513": { + "label": "clone" + }, + "element-web:apps/web/src/utils/arrays.test.ts:258|apps/web/src/utils/arrays.test.ts:270": { + "label": "clone" + }, + "element-web:apps/web/src/components/structures/MessagePanel.test.tsx:154|apps/web/src/components/structures/MessagePanel.test.tsx:213": { + "label": "clone" + }, + "jitsi-meet:react/features/calendar-sync/components/CalendarListContent.native.tsx:60|react/features/chat/components/web/ChatInput.tsx:153": { + "label": "not-clone", + "note": "React class constructors binding different handlers: an idiom, not a copy." + }, + "jitsi-meet:react/features/voice-agents/actions.ts:109|react/features/voice-agents/actions.ts:128": { + "label": "clone" + }, + "jitsi-meet:react/features/welcome/components/Tabs.tsx:73|react/features/welcome/components/Tabs.tsx:87": { + "label": "not-clone", + "note": "Tab list and tab panels: complementary renderings, not copies." + }, + "twenty:packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts:125|packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts:230": { + "label": "clone" + }, + "twenty:packages/twenty-front/src/modules/auth/utils/__tests__/isValidReturnToPath.test.ts:3|packages/twenty-front/src/utils/__tests__/compareNonEmptyStrings.test.ts:3": { + "label": "not-clone", + "note": "Tests of unrelated functions with the same table-like layout." + }, + "twenty:packages/twenty-front/src/modules/ai/components/__stories__/AiChatInlineBanner.stories.tsx:34|packages/twenty-front/src/modules/sse-db-event/components/__stories__/SSEProvider.stories.tsx:128": { + "label": "not-clone", + "note": "Storybook play functions testing unrelated behavior." + }, + "plane:apps/web/services/integrations/github.service.ts:28|apps/web/services/issue/issue.service.ts:378": { + "label": "clone", + "note": "Service method template reused for another endpoint." + }, + "plane:apps/web/components/core/modals/bulk-delete-issues-modal.tsx:69|apps/web/components/inbox/modals/select-duplicate.tsx:57": { + "label": "clone" + }, + "plane:apps/web/components/issues/issue-modal/components/default-properties.tsx:207|apps/web/components/project/create/header.tsx:59": { + "label": "clone", + "note": "Form-field render template reused for another widget." + }, + "bluesky:src/lib/appState.test.ts:186|src/lib/appState.test.ts:268": { + "label": "clone" + }, + "bluesky:src/state/queries/find-contacts.ts:50|src/state/queries/messages/join-requests.ts:71": { + "label": "clone" + }, + "bluesky:src/view/shell/Drawer.tsx:654|src/view/shell/Drawer.tsx:720": { + "label": "clone" + }, + "signal-desktop:ts/test-node/sql/migration_920_test.node.ts:155|ts/test-node/sql/migration_920_test.node.ts:299": { + "label": "clone" + }, + "signal-desktop:ts/components/LeftPane.dom.stories.tsx:1166|ts/components/LeftPane.dom.stories.tsx:1190": { + "label": "clone" + }, + "signal-desktop:ts/util/iterables.std.ts:67|ts/util/iterables.std.ts:115": { + "label": "clone" + }, + "grafana:public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:281|public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:538": { + "label": "clone" + }, + "grafana:public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx:225|public/app/features/home/Recommendations/NoDataCard.test.tsx:35": { + "label": "not-clone", + "note": "Render tests of unrelated components." + }, + "grafana:public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts:343|public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts:2425": { + "label": "clone" + }, + "sentry:static/app/views/issueList/issueViews/renameIssueViewModal.tsx:72|static/app/views/settings/project/projectFilters/customFilterModal.tsx:954": { + "label": "clone" + }, + "sentry:static/app/components/searchQueryBuilder/index.spec.tsx:2680|static/app/components/searchQueryBuilder/index.spec.tsx:2740": { + "label": "clone" + }, + "sentry:static/app/gettingStartedDocs/javascript-nuxt/feedback.tsx:33|static/app/gettingStartedDocs/javascript-remix/feedback.tsx:33": { + "label": "clone" + }, + "posthog:frontend/src/scenes/insights/insightVizDataLogic.test.ts:1369|frontend/src/scenes/insights/insightVizDataLogic.test.ts:1525": { + "label": "clone" + }, + "posthog:frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts:248|frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts:276": { + "label": "clone" + }, + "posthog:frontend/src/lib/monaco/domUtils.ts:19|frontend/src/lib/monaco/domUtils.ts:56": { + "label": "clone" + } + } +} diff --git a/study/results/results.json b/study/results/results.json index e890e01..3347c09 100644 --- a/study/results/results.json +++ b/study/results/results.json @@ -47,7 +47,7 @@ }, "largestClass": 2, "parseErrors": 0, - "durationMs": 48, + "durationMs": 59, "sample": [ { "key": "freecodecamp:api-server/src/common/models/block.js:3|api-server/src/server/models/auth-token.js:3", @@ -211,7 +211,7 @@ }, "largestClass": 3, "parseErrors": 0, - "durationMs": 31, + "durationMs": 33, "sample": [ { "key": "javascript-algorithms:src/data-structures/doubly-linked-list/DoublyLinkedList.js:238|src/data-structures/linked-list/LinkedList.js:215", @@ -438,7 +438,7 @@ }, "largestClass": 5, "parseErrors": 0, - "durationMs": 42, + "durationMs": 38, "sample": [ { "key": "thealgorithms:Conversions/LowerCaseConversion.js:18|Conversions/UpperCaseConversion.js:18", @@ -624,13 +624,13 @@ "date": "2026-10-27", "group": "react", "files": { - "production": 504, - "test": 161, + "production": 503, + "test": 162, "story": 0 }, "loc": { - "production": 132744, - "test": 66799, + "production": 132704, + "test": 66839, "story": 0 }, "clonedLoc": { @@ -660,10 +660,10 @@ }, "largestClass": 52, "parseErrors": 0, - "durationMs": 936, + "durationMs": 930, "jscpd": { "percentage": 7.038237374325183, - "durationMs": 105 + "durationMs": 109 }, "sample": [ { @@ -732,10 +732,10 @@ }, "largestClass": 45, "parseErrors": 0, - "durationMs": 639, + "durationMs": 559, "jscpd": { "percentage": 3.4001228268543127, - "durationMs": 72 + "durationMs": 70 }, "sample": [ { @@ -804,10 +804,10 @@ }, "largestClass": 20, "parseErrors": 0, - "durationMs": 344, + "durationMs": 314, "jscpd": { "percentage": 1.743863851695597, - "durationMs": 59 + "durationMs": 56 }, "sample": [ { @@ -840,13 +840,13 @@ "date": "2026-10-27", "group": "react", "files": { - "production": 1451, - "test": 823, + "production": 1450, + "test": 824, "story": 0 }, "loc": { - "production": 194453, - "test": 134602, + "production": 194294, + "test": 134761, "story": 0 }, "clonedLoc": { @@ -876,10 +876,10 @@ }, "largestClass": 20, "parseErrors": 14, - "durationMs": 2412, + "durationMs": 2383, "jscpd": { "percentage": 4.420688887593345, - "durationMs": 136 + "durationMs": 137 }, "sample": [ { @@ -948,10 +948,10 @@ }, "largestClass": 37, "parseErrors": 0, - "durationMs": 524, + "durationMs": 510, "jscpd": { "percentage": 1.4618165386353366, - "durationMs": 70 + "durationMs": 71 }, "sample": [ { @@ -1020,10 +1020,10 @@ }, "largestClass": 397, "parseErrors": 0, - "durationMs": 3887, + "durationMs": 3849, "jscpd": { "percentage": 4.882453575045414, - "durationMs": 309 + "durationMs": 311 }, "sample": [ { @@ -1092,10 +1092,10 @@ }, "largestClass": 100, "parseErrors": 0, - "durationMs": 624, + "durationMs": 603, "jscpd": { "percentage": 7.645608592990416, - "durationMs": 97 + "durationMs": 98 }, "sample": [ { @@ -1164,10 +1164,10 @@ }, "largestClass": 21, "parseErrors": 0, - "durationMs": 1055, + "durationMs": 1029, "jscpd": { "percentage": 4.5948876839659185, - "durationMs": 107 + "durationMs": 105 }, "sample": [ { @@ -1200,18 +1200,18 @@ "date": "2026-10-20", "group": "react", "files": { - "production": 2355, - "test": 0, + "production": 1866, + "test": 489, "story": 329 }, "loc": { - "production": 453672, - "test": 0, + "production": 348333, + "test": 105339, "story": 45349 }, "clonedLoc": { - "production": 40175, - "test": 0, + "production": 11542, + "test": 28633, "story": 7976 }, "units": 9827, @@ -1230,16 +1230,16 @@ "classesByKind": { "component": 27, "hook": 2, - "test": 0, + "test": 331, "story": 94, - "other": 494 + "other": 163 }, "largestClass": 50, "parseErrors": 1, - "durationMs": 1938, + "durationMs": 1927, "jscpd": { "percentage": 5.203984334175524, - "durationMs": 162 + "durationMs": 160 }, "sample": [ { @@ -1272,13 +1272,13 @@ "date": "2026-10-28", "group": "react", "files": { - "production": 4744, - "test": 2420, + "production": 4743, + "test": 2421, "story": 0 }, "loc": { - "production": 566434, - "test": 490251, + "production": 565927, + "test": 490758, "story": 0 }, "clonedLoc": { @@ -1308,10 +1308,10 @@ }, "largestClass": 429, "parseErrors": 0, - "durationMs": 12192, + "durationMs": 12244, "jscpd": { "percentage": 8.277124360234552, - "durationMs": 457 + "durationMs": 449 }, "sample": [ { @@ -1380,10 +1380,10 @@ }, "largestClass": 855, "parseErrors": 1, - "durationMs": 9316, + "durationMs": 9922, "jscpd": { "percentage": 9.91631994963031, - "durationMs": 550 + "durationMs": 548 }, "sample": [ { @@ -1416,13 +1416,13 @@ "date": "2026-10-28", "group": "react", "files": { - "production": 4385, - "test": 1337, + "production": 4384, + "test": 1338, "story": 389 }, "loc": { - "production": 829115, - "test": 270766, + "production": 829041, + "test": 270840, "story": 54203 }, "clonedLoc": { @@ -1452,10 +1452,10 @@ }, "largestClass": 71, "parseErrors": 1, - "durationMs": 8471, + "durationMs": 8129, "jscpd": { "percentage": 3.718239145789718, - "durationMs": 373 + "durationMs": 356 }, "sample": [ { diff --git a/study/results/results.md b/study/results/results.md index 67713c2..a32560f 100644 --- a/study/results/results.md +++ b/study/results/results.md @@ -7,14 +7,14 @@ Same projects and folders as the thesis, at the last commit before October 2021, | Project | Version | Units compared | Pairs reported | Clone classes | Real clones | |---|---|---:|---:|---:|---:| | [freeCodeCamp/freeCodeCamp](https://github.com/freeCodeCamp/freeCodeCamp/tree/d5e3979753eb16ac00b8e530e9956eae91126f56) | v0.6 (thesis, all candidates labeled) | 158 | 29 | – | 13/29 (44.8%) | -| | v1, no size minimum (like v0.6) | 552 | 1,125 | 27 | – sampled | -| | v1, defaults (≥ 50 tokens) | 201 | 3 | 3 | – sampled | +| | v1, no size minimum (like v0.6) | 552 | 1,125 | 27 | 8/12 sampled | +| | v1, defaults (≥ 50 tokens) | 201 | 3 | 3 | 3/3 sampled | | [trekhleb/javascript-algorithms](https://github.com/trekhleb/javascript-algorithms/tree/4548296affb227c29ead868309e48667f8280c55) | v0.6 (thesis, all candidates labeled) | 192 | 60 | – | 21/60 (35.0%) | -| | v1, no size minimum (like v0.6) | 683 | 1,805 | 53 | – sampled | -| | v1, defaults (≥ 50 tokens) | 266 | 26 | 20 | – sampled | +| | v1, no size minimum (like v0.6) | 683 | 1,805 | 53 | 7/12 sampled | +| | v1, defaults (≥ 50 tokens) | 266 | 26 | 20 | 11/12 sampled | | [TheAlgorithms/JavaScript](https://github.com/TheAlgorithms/JavaScript/tree/ee605b7694f9237574bd8b6ebbe45da253fd05f8) | v0.6 (thesis, all candidates labeled) | 385 | 231 | – | 185/231 (80.1%) | -| | v1, no size minimum (like v0.6) | 828 | 1,695 | 56 | – sampled | -| | v1, defaults (≥ 50 tokens) | 364 | 29 | 16 | – sampled | +| | v1, no size minimum (like v0.6) | 828 | 1,695 | 56 | 8/12 sampled | +| | v1, defaults (≥ 50 tokens) | 364 | 29 | 16 | 12/12 sampled | ## Part 2: React applications @@ -22,20 +22,20 @@ Same projects and folders as the thesis, at the last commit before October 2021, | App | Files | Lines | Cloned code | Cloned test code | jscpd dup. | Clone classes (T1/T2/T3) | Largest class | Precision (sample) | Time | |---|---:|---:|---:|---:|---:|---:|---:|---:|---:| -| [excalidraw/excalidraw](https://github.com/excalidraw/excalidraw/tree/14bb42edee3d6fee6be264e3ee78670b3b9cee79) | 665 | 199,543 | **2.2%** | 24.9% | 7.0% | 287 (10/36/241) | 52 | – | 0.9 s | -| [outline/outline](https://github.com/outline/outline/tree/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1) | 1,276 | 157,366 | **4.3%** | 33.5% | 3.4% | 191 (13/32/146) | 45 | – | 0.6 s | -| [mastodon/mastodon](https://github.com/mastodon/mastodon/tree/b0555670b3d24d6e4a977a6bc3894daa128123fa) | 946 | 97,859 | **4.0%** | 12.7% | 1.7% | 95 (3/22/70) | 20 | – | 0.3 s | -| [element-hq/element-web](https://github.com/element-hq/element-web/tree/c4b8799e5581a460f1557f130a74972917011f2d) | 2,274 | 329,055 | **1.7%** | 19.0% | 4.4% | 719 (15/96/608) | 20 | – | 2.4 s | -| [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet/tree/0fc01ad1591dad0c92737cf8354376749eafd6dc) | 1,992 | 197,341 | **2.5%** | 6.0% | 1.5% | 85 (6/13/66) | 37 | – | 0.5 s | -| [twentyhq/twenty](https://github.com/twentyhq/twenty/tree/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72) | 11,382 | 698,892 | **3.8%** | 26.5% | 4.9% | 920 (25/108/787) | 397 | – | 3.9 s | -| [makeplane/plane](https://github.com/makeplane/plane/tree/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec) | 1,842 | 160,578 | **13.2%** | – | 7.6% | 269 (17/41/211) | 100 | – | 0.6 s | -| [bluesky-social/social-app](https://github.com/bluesky-social/social-app/tree/1a1a3ceea1e72b62496e954619d7d8715717689c) | 2,005 | 271,951 | **6.2%** | 12.3% | 4.6% | 295 (30/48/217) | 21 | – | 1.1 s | -| [signalapp/Signal-Desktop](https://github.com/signalapp/Signal-Desktop/tree/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7) | 2,684 | 499,021 | **8.9%** | – | 5.2% | 617 (15/95/507) | 50 | – | 1.9 s | -| [grafana/grafana](https://github.com/grafana/grafana/tree/e0555671bcb0a46fe9bd97114ee4700566e6c44a) | 7,164 | 1,056,685 | **3.8%** | 30.2% | 8.3% | 3,202 (127/416/2659) | 429 | – | 12.2 s | -| [getsentry/sentry](https://github.com/getsentry/sentry/tree/2894b630364ed2d1f38db38c9474d6a4a3851b59) | 8,703 | 1,266,660 | **6.3%** | 33.1% | 9.9% | 2,359 (80/298/1981) | 855 | – | 9.3 s | -| [PostHog/posthog](https://github.com/PostHog/posthog/tree/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef) | 6,111 | 1,154,084 | **3.5%** | 16.1% | 3.7% | 1,375 (54/141/1180) | 71 | – | 8.5 s | - -Median cloned production code: **3.9%** (range 1.7–13.2%). +| [excalidraw/excalidraw](https://github.com/excalidraw/excalidraw/tree/14bb42edee3d6fee6be264e3ee78670b3b9cee79) | 665 | 199,543 | **2.2%** | 24.9% | 7.0% | 287 (10/36/241) | 52 | 3/3 | 0.9 s | +| [outline/outline](https://github.com/outline/outline/tree/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1) | 1,276 | 157,366 | **4.3%** | 33.5% | 3.4% | 191 (13/32/146) | 45 | 3/3 | 0.6 s | +| [mastodon/mastodon](https://github.com/mastodon/mastodon/tree/b0555670b3d24d6e4a977a6bc3894daa128123fa) | 946 | 97,859 | **4.0%** | 12.7% | 1.7% | 95 (3/22/70) | 20 | 3/3 | 0.3 s | +| [element-hq/element-web](https://github.com/element-hq/element-web/tree/c4b8799e5581a460f1557f130a74972917011f2d) | 2,274 | 329,055 | **1.7%** | 18.9% | 4.4% | 719 (15/96/608) | 20 | 3/3 | 2.4 s | +| [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet/tree/0fc01ad1591dad0c92737cf8354376749eafd6dc) | 1,992 | 197,341 | **2.5%** | 6.0% | 1.5% | 85 (6/13/66) | 37 | 1/3 | 0.5 s | +| [twentyhq/twenty](https://github.com/twentyhq/twenty/tree/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72) | 11,382 | 698,892 | **3.8%** | 26.5% | 4.9% | 920 (25/108/787) | 397 | 1/3 | 3.8 s | +| [makeplane/plane](https://github.com/makeplane/plane/tree/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec) | 1,842 | 160,578 | **13.2%** | – | 7.6% | 269 (17/41/211) | 100 | 3/3 | 0.6 s | +| [bluesky-social/social-app](https://github.com/bluesky-social/social-app/tree/1a1a3ceea1e72b62496e954619d7d8715717689c) | 2,005 | 271,951 | **6.2%** | 12.3% | 4.6% | 295 (30/48/217) | 21 | 3/3 | 1.0 s | +| [signalapp/Signal-Desktop](https://github.com/signalapp/Signal-Desktop/tree/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7) | 2,684 | 499,021 | **3.3%** | 27.2% | 5.2% | 617 (15/95/507) | 50 | 3/3 | 1.9 s | +| [grafana/grafana](https://github.com/grafana/grafana/tree/e0555671bcb0a46fe9bd97114ee4700566e6c44a) | 7,164 | 1,056,685 | **3.8%** | 30.1% | 8.3% | 3,202 (127/416/2659) | 429 | 2/3 | 12.2 s | +| [getsentry/sentry](https://github.com/getsentry/sentry/tree/2894b630364ed2d1f38db38c9474d6a4a3851b59) | 8,703 | 1,266,660 | **6.3%** | 33.1% | 9.9% | 2,359 (80/298/1981) | 855 | 3/3 | 9.9 s | +| [PostHog/posthog](https://github.com/PostHog/posthog/tree/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef) | 6,111 | 1,154,084 | **3.5%** | 16.1% | 3.7% | 1,375 (54/141/1180) | 71 | 3/3 | 8.1 s | + +Median cloned production code: **3.8%** (range 1.7–13.2%). ### What gets cloned @@ -51,9 +51,9 @@ Clone classes by the kind of unit most of their copies are (heuristic: hooks sta | twenty | 7.2% | 5.7% | 16.7% | 59.7% | 10.8% | | plane | 22.7% | 1.1% | 76.2% | 0.0% | 0.0% | | bluesky | 21.7% | 10.2% | 40.0% | 28.1% | 0.0% | -| signal-desktop | 4.4% | 0.3% | 80.1% | 0.0% | 15.2% | +| signal-desktop | 4.4% | 0.3% | 26.4% | 53.6% | 15.2% | | grafana | 2.5% | 0.3% | 10.7% | 86.4% | 0.0% | | sentry | 5.1% | 1.3% | 16.1% | 75.9% | 1.6% | | posthog | 8.4% | 0.1% | 27.6% | 58.6% | 5.2% | -All apps together: 10,414 clone classes; components 5.9%, hooks 1.3%, other production 23.3%, tests 66.6%, stories 2.9%. Type-1/2/3 split of classes: 3.8% / 12.9% / 83.3%. +All apps together: 10,414 clone classes; components 5.9%, hooks 1.3%, other production 20.1%, tests 69.7%, stories 2.9%. Type-1/2/3 split of classes: 3.8% / 12.9% / 83.3%. diff --git a/study/results/sample.md b/study/results/sample.md index 25e648d..0ed6f5c 100644 --- a/study/results/sample.md +++ b/study/results/sample.md @@ -6,157 +6,157 @@ One pair per clone class, seeded. Links point to the pinned commits; no third-pa Defaults: -1. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L3-L9) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/auth-token.js#L3-L15) · **unlabeled** -2. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029) · **unlabeled** -3. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L249-L295) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L297-L329) · **unlabeled** +1. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L3-L9) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/auth-token.js#L3-L15) · **clone** +2. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029) · **clone** +3. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L249-L295) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/challenge.js#L297-L329) · **clone** No size minimum: -1. Type-3 (82%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L858-L858) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/donation.js#L138-L140) · **unlabeled** -2. Type-3 (95%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L498-L504) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L581-L587) · **unlabeled** -3. Type-3 (95%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/authentication.js#L177-L180) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L86-L94) · **unlabeled** -4. Type-3 (88%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/news.js#L5-L10) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/status.js#L1-L6) · **unlabeled** -5. Type-3 (82%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L4-L8) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L173-L180) · **unlabeled** -6. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029) · **unlabeled** -7. Type-1 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L331-L336) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L502-L507) · **unlabeled** -8. Type-3 (87%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L105-L111) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/user.js#L95-L98) · **unlabeled** -9. Type-3 (91%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/getDynamicPropsForUser.js#L1-L14) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/user-stats.js#L138-L145) · **unlabeled** -10. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L63-L69) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L204-L215) · **unlabeled** -11. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L36-L40) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L61-L65) · **unlabeled** -12. Type-3 (87%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L29-L31) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L36-L38) · **unlabeled** +1. Type-3 (82%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L858-L858) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/donation.js#L138-L140) · **not-clone**: Two one-line promise callbacks. +2. Type-3 (95%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L498-L504) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L581-L587) · **clone** +3. Type-3 (95%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/authentication.js#L177-L180) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L86-L94) · **clone** +4. Type-3 (88%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/news.js#L5-L10) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/status.js#L1-L6) · **not-clone**: Framework router boot files for unrelated routes. +5. Type-3 (82%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/block.js#L4-L8) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L173-L180) · **clone** +6. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L996-L1012) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/common/models/user.js#L1013-L1029) · **clone** +7. Type-1 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L331-L336) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/certificate.js#L502-L507) · **clone** +8. Type-3 (87%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/randomAPIs.js#L105-L111) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/user.js#L95-L98) · **not-clone**: Two tiny unrelated route handlers. +9. Type-3 (91%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/getDynamicPropsForUser.js#L1-L14) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/user-stats.js#L138-L145) · **clone** +10. Type-3 (84%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L63-L69) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/boot/settings.js#L204-L215) · **clone** +11. Type-2 · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L36-L40) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/models/donation.js#L61-L65) · **clone** +12. Type-3 (87%) · [A](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L29-L31) ↔ [B](https://github.com/freeCodeCamp/freeCodeCamp/blob/d5e3979753eb16ac00b8e530e9956eae91126f56/api-server/src/server/utils/rx.js#L36-L38) · **not-clone**: Two different one-line Rx helpers. ## trekhleb/javascript-algorithms Defaults: -1. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L238-L262) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L215-L237) · **unlabeled** -2. Type-3 (82%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L22-L32) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L40-L52) · **unlabeled** -3. Type-3 (96%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectDirectedCycle.js#L38-L62) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectUndirectedCycle.js#L31-L51) · **unlabeled** -4. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L249-L263) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L295-L309) · **unlabeled** -5. Type-3 (94%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/discreteFourierTransform.js#L22-L69) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/inverseDiscreteFourierTransform.js#L16-L58) · **unlabeled** -6. Type-3 (80%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/articulation-points/articulationPoints.js#L59-L103) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/bridges/graphBridges.js#L48-L85) · **unlabeled** -7. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L46-L60) · **unlabeled** -8. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/breadth-first-search/breadthFirstSearch.js#L19-L42) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/depth-first-search/depthFirstSearch.js#L17-L40) · **unlabeled** -9. Type-2 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L86-L109) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L114-L136) · **unlabeled** -10. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125) · **unlabeled** -11. Type-2 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L60-L81) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L141-L162) · **unlabeled** -12. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L90-L99) · **unlabeled** +1. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L238-L262) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L215-L237) · **clone** +2. Type-3 (82%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L22-L32) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/fenwick-tree/FenwickTree.js#L40-L52) · **not-clone**: Fenwick tree update vs. prefix query: shared range guard, different algorithms by design. +3. Type-3 (96%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectDirectedCycle.js#L38-L62) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/detect-cycle/detectUndirectedCycle.js#L31-L51) · **clone** +4. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L249-L263) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/matrix/Matrix.js#L295-L309) · **clone** +5. Type-3 (94%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/discreteFourierTransform.js#L22-L69) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/fourier-transform/inverseDiscreteFourierTransform.js#L16-L58) · **clone** +6. Type-3 (80%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/articulation-points/articulationPoints.js#L59-L103) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/bridges/graphBridges.js#L48-L85) · **clone** +7. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L46-L60) · **clone** +8. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/breadth-first-search/breadthFirstSearch.js#L19-L42) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/graph/depth-first-search/depthFirstSearch.js#L17-L40) · **clone** +9. Type-2 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L86-L109) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L114-L136) · **clone** +10. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125) · **clone** +11. Type-2 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L60-L81) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/tree/avl-tree/AvlTree.js#L141-L162) · **clone** +12. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L90-L99) · **clone** No size minimum: -1. Type-3 (83%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L23-L23) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L26-L26) · **unlabeled** -2. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L81-L87) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L93-L99) · **unlabeled** -3. Type-3 (95%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L9-L12) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedListNode.js#L2-L5) · **unlabeled** -4. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125) · **unlabeled** -5. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L30-L44) · **unlabeled** -6. Type-3 (92%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/KnapsackItem.js#L16-L18) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L28-L34) · **unlabeled** -7. Type-3 (88%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L105-L116) · **unlabeled** -8. Type-3 (84%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L17-L25) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L33-L39) · **unlabeled** -9. Type-3 (88%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L35-L35) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L37-L37) · **unlabeled** -10. Type-3 (96%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js#L21-L23) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/radix-sort/RadixSort.js#L137-L143) · **unlabeled** -11. Type-3 (94%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/SortTester.js#L30-L35) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L16-L22) · **unlabeled** -12. Type-3 (81%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L66-L68) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L125-L129) · **unlabeled** +1. Type-3 (83%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L23-L23) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/tree/depth-first-search/depthFirstSearch.js#L26-L26) · **not-clone**: Two one-line stub callbacks. +2. Type-3 (89%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L81-L87) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L93-L99) · **clone**: Same lookup copied with a different predicate. +3. Type-3 (95%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L9-L12) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedListNode.js#L2-L5) · **not-clone**: Two-field constructors of unrelated classes. +4. Type-1 · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/doubly-linked-list/DoublyLinkedList.js#L129-L151) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/linked-list/LinkedList.js#L103-L125) · **clone** +5. Type-3 (98%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L14-L28) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/Knapsack.js#L30-L44) · **clone** +6. Type-3 (92%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sets/knapsack-problem/KnapsackItem.js#L16-L18) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/uncategorized/n-queens/QueenPosition.js#L28-L34) · **not-clone**: Unrelated one-line getters. +7. Type-3 (88%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L73-L84) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/bloom-filter/BloomFilter.js#L105-L116) · **clone** +8. Type-3 (84%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L17-L25) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/image-processing/utils/imageData.js#L33-L39) · **clone**: Pixel index computation copied between getter and setter. +9. Type-3 (88%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L35-L35) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/math/bits/multiply.js#L37-L37) · **not-clone**: Intentional case split inside one algorithm. +10. Type-3 (96%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js#L21-L23) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/radix-sort/RadixSort.js#L137-L143) · **clone**: Same array-of-buckets idiom in two modules. +11. Type-3 (94%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/algorithms/sorting/SortTester.js#L30-L35) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L16-L22) · **clone**: Comparator copied with a different key. +12. Type-3 (81%) · [A](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L66-L68) ↔ [B](https://github.com/trekhleb/javascript-algorithms/blob/4548296affb227c29ead868309e48667f8280c55/src/data-structures/graph/GraphVertex.js#L125-L129) · **not-clone**: Unrelated one-line methods. ## TheAlgorithms/JavaScript Defaults: -1. Type-3 (98%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/LowerCaseConversion.js#L18-L33) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/UpperCaseConversion.js#L18-L33) · **unlabeled** -2. Type-3 (91%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L3-L14) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L62-L70) · **unlabeled** -3. Type-2 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L106-L141) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L89-L124) · **unlabeled** -4. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L12-L18) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L61-L67) · **unlabeled** -5. Type-3 (86%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L33-L67) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L68-L102) · **unlabeled** -6. Type-3 (94%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L104-L113) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L200-L208) · **unlabeled** -7. Type-3 (99%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L60-L71) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L73-L84) · **unlabeled** -8. Type-3 (84%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L1-L39) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L1-L34) · **unlabeled** -9. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L56-L104) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L42-L87) · **unlabeled** -10. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L67-L88) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L78-L99) · **unlabeled** -11. Type-3 (99%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/SieveOfEratosthenes.js#L1-L19) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/SieveOfEratosthenes.js#L1-L27) · **unlabeled** -12. Type-3 (85%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74) · **unlabeled** +1. Type-3 (98%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/LowerCaseConversion.js#L18-L33) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Conversions/UpperCaseConversion.js#L18-L33) · **clone** +2. Type-3 (91%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L3-L14) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Fibonacci.js#L62-L70) · **clone** +3. Type-2 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L106-L141) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L89-L124) · **clone** +4. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L12-L18) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L61-L67) · **clone** +5. Type-3 (86%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L33-L67) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Search/TernarySearch.js#L68-L102) · **clone** +6. Type-3 (94%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/KruskalMST.js#L104-L113) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L200-L208) · **clone** +7. Type-3 (99%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L60-L71) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Linear-Algebra/src/la_lib.js#L73-L84) · **clone** +8. Type-3 (84%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L1-L39) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchRecursive.js#L1-L34) · **clone** +9. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LFUCache.js#L56-L104) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L42-L87) · **clone** +10. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L67-L88) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L78-L99) · **clone** +11. Type-3 (99%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/SieveOfEratosthenes.js#L1-L19) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/SieveOfEratosthenes.js#L1-L27) · **clone** +12. Type-3 (85%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74) · **clone** No size minimum: -1. Type-3 (82%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L116-L116) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/ReversePolishNotation.js#L5-L5) · **unlabeled** -2. Type-2 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestPalindromicSubsequence.js#L33-L37) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestValidParentheses.js#L37-L41) · **unlabeled** -3. Type-3 (94%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Vectors/Vector2.js#L131-L135) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/KochSnowflake.js#L55-L59) · **unlabeled** -4. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckFlatCase.js#L12-L20) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckKebabCase.js#L10-L18) · **unlabeled** -5. Type-3 (86%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L1-L9) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Trees/BreadthFirstTreeTraversal.js#L6-L12) · **unlabeled** -6. Type-3 (90%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Queue/CircularQueue.js#L71-L75) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Stack/Stack.js#L48-L50) · **unlabeled** -7. Type-3 (95%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L18-L21) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L76-L79) · **unlabeled** -8. Type-3 (85%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74) · **unlabeled** -9. Type-3 (91%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L53-L58) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L88-L93) · **unlabeled** -10. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L12-L18) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L157-L163) · **unlabeled** -11. Type-3 (95%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/ClimbingStairs.js#L19-L23) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FibonacciNumberRecursive.js#L10-L13) · **unlabeled** -12. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L21-L27) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L32-L38) · **unlabeled** +1. Type-3 (82%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L116-L116) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/ReversePolishNotation.js#L5-L5) · **not-clone**: Unrelated one-line arrow functions. +2. Type-2 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestPalindromicSubsequence.js#L33-L37) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/LongestValidParentheses.js#L37-L41) · **clone** +3. Type-3 (94%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Vectors/Vector2.js#L131-L135) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/KochSnowflake.js#L55-L59) · **clone** +4. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckFlatCase.js#L12-L20) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/String/CheckKebabCase.js#L10-L18) · **clone** +5. Type-3 (86%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Cache/LRUCache.js#L1-L9) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Trees/BreadthFirstTreeTraversal.js#L6-L12) · **not-clone**: Constructors of unrelated node classes. +6. Type-3 (90%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Queue/CircularQueue.js#L71-L75) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Data-Structures/Stack/Stack.js#L48-L50) · **not-clone**: Print loops of different data structures. +7. Type-3 (95%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L18-L21) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Area.js#L76-L79) · **clone** +8. Type-3 (85%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L41-L55) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FloodFill.js#L65-L74) · **clone** +9. Type-3 (91%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L53-L58) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Maths/Volume.js#L88-L93) · **clone** +10. Type-3 (89%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/DepthFirstSearchIterative.js#L12-L18) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Graphs/PrimMST.js#L157-L163) · **clone** +11. Type-3 (95%) · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Dynamic-Programming/ClimbingStairs.js#L19-L23) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Recursive/FibonacciNumberRecursive.js#L10-L13) · **not-clone**: Unrelated demo snippets. +12. Type-1 · [A](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA1.js#L21-L27) ↔ [B](https://github.com/TheAlgorithms/JavaScript/blob/ee605b7694f9237574bd8b6ebbe45da253fd05f8/Hashes/SHA256.js#L32-L38) · **clone** ## excalidraw/excalidraw -1. Type-3 (87%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L226-L238) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L386-L400) · **unlabeled** -2. Type-3 (87%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L1990-L2008) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L2014-L2042) · **unlabeled** -3. Type-3 (96%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L59-L76) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L78-L97) · **unlabeled** +1. Type-3 (87%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L226-L238) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/tests/align.test.tsx#L386-L400) · **clone** +2. Type-3 (87%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L1990-L2008) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/element/src/delta.ts#L2014-L2042) · **clone** +3. Type-3 (96%) · [A](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L59-L76) ↔ [B](https://github.com/excalidraw/excalidraw/blob/14bb42edee3d6fee6be264e3ee78670b3b9cee79/packages/excalidraw/tests/charts.test.tsx#L78-L97) · **clone** ## outline/outline -1. Type-3 (93%) · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L64-L74) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L76-L87) · **unlabeled** -2. Type-2 · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L18-L35) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L43-L60) · **unlabeled** -3. Type-3 (82%) · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L192-L204) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L275-L285) · **unlabeled** +1. Type-3 (93%) · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L64-L74) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/helpers/AuthenticationHelper.test.ts#L76-L87) · **clone** +2. Type-2 · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L18-L35) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/shared/editor/commands/codeFence.ts#L43-L60) · **clone** +3. Type-3 (82%) · [A](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L192-L204) ↔ [B](https://github.com/outline/outline/blob/6a2f23c023b952c752dfe025ef0ce2a0083cd0c1/app/components/CommandBar/SearchIndex.test.ts#L275-L285) · **clone**: Copy-adapted test template. ## mastodon/mastodon -1. Type-1 · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_quoted_update.tsx#L20-L31) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_update.tsx#L20-L31) · **unlabeled** -2. Type-3 (80%) · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/announcements.js#L139-L147) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/statuses.js#L325-L333) · **unlabeled** -3. Type-3 (82%) · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/accounts.js#L294-L300) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/trends.js#L85-L89) · **unlabeled** +1. Type-1 · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_quoted_update.tsx#L20-L31) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/features/notifications_v2/components/notification_update.tsx#L20-L31) · **clone** +2. Type-3 (80%) · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/announcements.js#L139-L147) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/statuses.js#L325-L333) · **clone**: Redux thunk template (request/success/fail) reused for another endpoint. +3. Type-3 (82%) · [A](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/accounts.js#L294-L300) ↔ [B](https://github.com/mastodon/mastodon/blob/b0555670b3d24d6e4a977a6bc3894daa128123fa/app/javascript/mastodon/actions/trends.js#L85-L89) · **clone** ## element-hq/element-web -1. Type-3 (90%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L448-L464) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L513-L527) · **unlabeled** -2. Type-3 (93%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L258-L268) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L270-L281) · **unlabeled** -3. Type-3 (83%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L154-L168) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L213-L235) · **unlabeled** +1. Type-3 (90%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L448-L464) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/events/EventTileFactory.tsx#L513-L527) · **clone** +2. Type-3 (93%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L258-L268) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/utils/arrays.test.ts#L270-L281) · **clone** +3. Type-3 (83%) · [A](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L154-L168) ↔ [B](https://github.com/element-hq/element-web/blob/c4b8799e5581a460f1557f130a74972917011f2d/apps/web/src/components/structures/MessagePanel.test.tsx#L213-L235) · **clone** ## jitsi/jitsi-meet -1. Type-3 (86%) · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/calendar-sync/components/CalendarListContent.native.tsx#L60-L71) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/chat/components/web/ChatInput.tsx#L153-L164) · **unlabeled** -2. Type-2 · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L109-L119) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L128-L138) · **unlabeled** -3. Type-3 (84%) · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L73-L85) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L87-L97) · **unlabeled** +1. Type-3 (86%) · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/calendar-sync/components/CalendarListContent.native.tsx#L60-L71) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/chat/components/web/ChatInput.tsx#L153-L164) · **not-clone**: React class constructors binding different handlers: an idiom, not a copy. +2. Type-2 · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L109-L119) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/voice-agents/actions.ts#L128-L138) · **clone** +3. Type-3 (84%) · [A](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L73-L85) ↔ [B](https://github.com/jitsi/jitsi-meet/blob/0fc01ad1591dad0c92737cf8354376749eafd6dc/react/features/welcome/components/Tabs.tsx#L87-L97) · **not-clone**: Tab list and tab panels: complementary renderings, not copies. ## twentyhq/twenty -1. Type-3 (82%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L125-L138) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L230-L245) · **unlabeled** -2. Type-3 (84%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/auth/utils/__tests__/isValidReturnToPath.test.ts#L3-L55) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/utils/__tests__/compareNonEmptyStrings.test.ts#L3-L51) · **unlabeled** -3. Type-3 (80%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/ai/components/__stories__/AiChatInlineBanner.stories.tsx#L34-L42) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/sse-db-event/components/__stories__/SSEProvider.stories.tsx#L128-L141) · **unlabeled** +1. Type-3 (82%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L125-L138) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts#L230-L245) · **clone** +2. Type-3 (84%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/auth/utils/__tests__/isValidReturnToPath.test.ts#L3-L55) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/utils/__tests__/compareNonEmptyStrings.test.ts#L3-L51) · **not-clone**: Tests of unrelated functions with the same table-like layout. +3. Type-3 (80%) · [A](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/ai/components/__stories__/AiChatInlineBanner.stories.tsx#L34-L42) ↔ [B](https://github.com/twentyhq/twenty/blob/ad7f4e9d8bb9d3d7e253a3f4d6f467aed9a96c72/packages/twenty-front/src/modules/sse-db-event/components/__stories__/SSEProvider.stories.tsx#L128-L141) · **not-clone**: Storybook play functions testing unrelated behavior. ## makeplane/plane -1. Type-3 (89%) · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/integrations/github.service.ts#L28-L36) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/issue/issue.service.ts#L378-L390) · **unlabeled** -2. Type-1 · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/core/modals/bulk-delete-issues-modal.tsx#L69-L80) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/inbox/modals/select-duplicate.tsx#L57-L68) · **unlabeled** -3. Type-3 (86%) · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/issues/issue-modal/components/default-properties.tsx#L207-L220) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/project/create/header.tsx#L59-L70) · **unlabeled** +1. Type-3 (89%) · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/integrations/github.service.ts#L28-L36) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/services/issue/issue.service.ts#L378-L390) · **clone**: Service method template reused for another endpoint. +2. Type-1 · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/core/modals/bulk-delete-issues-modal.tsx#L69-L80) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/inbox/modals/select-duplicate.tsx#L57-L68) · **clone** +3. Type-3 (86%) · [A](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/issues/issue-modal/components/default-properties.tsx#L207-L220) ↔ [B](https://github.com/makeplane/plane/blob/a9e70360c5bc5b1beb5f70fe4c2fa765743147ec/apps/web/components/project/create/header.tsx#L59-L70) · **clone**: Form-field render template reused for another widget. ## bluesky-social/social-app -1. Type-3 (97%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L186-L194) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L268-L276) · **unlabeled** -2. Type-3 (96%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/find-contacts.ts#L50-L60) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/messages/join-requests.ts#L71-L82) · **unlabeled** -3. Type-3 (88%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L654-L677) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L720-L742) · **unlabeled** +1. Type-3 (97%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L186-L194) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/lib/appState.test.ts#L268-L276) · **clone** +2. Type-3 (96%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/find-contacts.ts#L50-L60) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/state/queries/messages/join-requests.ts#L71-L82) · **clone** +3. Type-3 (88%) · [A](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L654-L677) ↔ [B](https://github.com/bluesky-social/social-app/blob/1a1a3ceea1e72b62496e954619d7d8715717689c/src/view/shell/Drawer.tsx#L720-L742) · **clone** ## signalapp/Signal-Desktop -1. Type-2 · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L155-L170) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L299-L314) · **unlabeled** -2. Type-3 (95%) · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1166-L1188) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1190-L1212) · **unlabeled** -3. Type-2 · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L67-L82) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L115-L127) · **unlabeled** +1. Type-2 · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L155-L170) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/test-node/sql/migration_920_test.node.ts#L299-L314) · **clone** +2. Type-3 (95%) · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1166-L1188) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/components/LeftPane.dom.stories.tsx#L1190-L1212) · **clone** +3. Type-2 · [A](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L67-L82) ↔ [B](https://github.com/signalapp/Signal-Desktop/blob/17502b9d1a9e34af689f31508c4ac4ccee5b5cb7/ts/util/iterables.std.ts#L115-L127) · **clone** ## grafana/grafana -1. Type-3 (99%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L281-L308) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L538-L564) · **unlabeled** -2. Type-3 (81%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx#L225-L235) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/home/Recommendations/NoDataCard.test.tsx#L35-L42) · **unlabeled** -3. Type-3 (87%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L343-L354) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L2425-L2433) · **unlabeled** +1. Type-3 (99%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L281-L308) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx#L538-L564) · **clone** +2. Type-3 (81%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx#L225-L235) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/home/Recommendations/NoDataCard.test.tsx#L35-L42) · **not-clone**: Render tests of unrelated components. +3. Type-3 (87%) · [A](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L343-L354) ↔ [B](https://github.com/grafana/grafana/blob/e0555671bcb0a46fe9bd97114ee4700566e6c44a/public/app/features/dashboard-scene/mutation-api/commands/layoutCommands.test.ts#L2425-L2433) · **clone** ## getsentry/sentry -1. Type-3 (90%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/issueList/issueViews/renameIssueViewModal.tsx#L72-L81) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/settings/project/projectFilters/customFilterModal.tsx#L954-L966) · **unlabeled** -2. Type-3 (90%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2680-L2701) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2740-L2765) · **unlabeled** -3. Type-3 (81%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-nuxt/feedback.tsx#L33-L68) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-remix/feedback.tsx#L33-L76) · **unlabeled** +1. Type-3 (90%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/issueList/issueViews/renameIssueViewModal.tsx#L72-L81) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/views/settings/project/projectFilters/customFilterModal.tsx#L954-L966) · **clone** +2. Type-3 (90%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2680-L2701) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/components/searchQueryBuilder/index.spec.tsx#L2740-L2765) · **clone** +3. Type-3 (81%) · [A](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-nuxt/feedback.tsx#L33-L68) ↔ [B](https://github.com/getsentry/sentry/blob/2894b630364ed2d1f38db38c9474d6a4a3851b59/static/app/gettingStartedDocs/javascript-remix/feedback.tsx#L33-L76) · **clone** ## PostHog/posthog -1. Type-3 (85%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1369-L1386) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1525-L1545) · **unlabeled** -2. Type-3 (96%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L248-L261) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L276-L287) · **unlabeled** -3. Type-3 (95%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L19-L54) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L56-L95) · **unlabeled** +1. Type-3 (85%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1369-L1386) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/scenes/insights/insightVizDataLogic.test.ts#L1525-L1545) · **clone** +2. Type-3 (96%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L248-L261) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/components/MarkdownNotebook/collaboration.test.ts#L276-L287) · **clone** +3. Type-3 (95%) · [A](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L19-L54) ↔ [B](https://github.com/PostHog/posthog/blob/0ee77d1d3dca8a6f357bebf7dba915e1dcda6cef/frontend/src/lib/monaco/domUtils.ts#L56-L95) · **clone** diff --git a/study/run.ts b/study/run.ts index e7c4d96..9bf7044 100644 --- a/study/run.ts +++ b/study/run.ts @@ -53,7 +53,7 @@ type FileKind = 'production' | 'test' | 'story' type UnitKind = 'component' | 'hook' | 'test' | 'story' | 'other' const TEST_PATH = - /(^|\/)(__tests?__|tests?|spec|specs|__mocks__|mocks?|e2e|fixtures?|testing|test-utils)\/|\.(test|spec)\.[cm]?[jt]sx?$/i + /(^|\/)(__tests?__|tests?|test[-_][\w-]+|spec|specs|__mocks__|mocks?|e2e|fixtures?|testing|test-utils)\/|[._](test|spec)\.[\w.]*[cm]?[jt]sx?$/i const STORY_PATH = /\.(stories|story)\.[cm]?[jt]sx?$/i export function fileKind(file: string): FileKind { diff --git a/study/show.ts b/study/show.ts new file mode 100644 index 0000000..b029357 --- /dev/null +++ b/study/show.ts @@ -0,0 +1,39 @@ +/** + * Prints sampled pairs with their code, from the local cache, for labeling. + * npx tsx study/show.ts [defaults|nomin] [maxLines] + */ +import { readdirSync, readFileSync } from 'node:fs' +import path from 'node:path' +import { CACHE_DIR } from './fetch.js' + +const [id, which = 'defaults', max = '28'] = process.argv.slice(2) +const results = JSON.parse( + readFileSync(path.join(import.meta.dirname, 'results', 'results.json'), 'utf8'), +) +const project = results.find((r: { id: string }) => r.id === id) +const dir = path.join( + CACHE_DIR, + readdirSync(CACHE_DIR).find((d) => d.startsWith(`${id}@`)) as string, +) +const samples = which === 'nomin' ? project.noMinimum.sample : project.sample + +const show = (url: string) => { + const m = /blob\/[0-9a-f]+\/(.+)#L(\d+)-L(\d+)$/.exec(url) as RegExpExecArray + const lines = readFileSync(path.join(dir, m[1] as string), 'utf8') + .split('\n') + .slice(Number(m[2]) - 1, Number(m[3])) + const limit = Number(max) + const body = + lines.length > limit + ? [...lines.slice(0, limit), ` … ${lines.length - limit} more lines`] + : lines + return ` ${m[1]}:${m[2]}\n${body.map((l) => ` ${l}`).join('\n')}` +} + +samples.forEach( + (s: { key: string; type: number; similarity: number; a: string; b: string }, i: number) => { + console.log(`\n### ${i + 1} T${s.type} ${(s.similarity * 100).toFixed(0)}% ${s.key}`) + console.log(show(s.a)) + console.log(show(s.b)) + }, +)