Skip to main content
Detect copy-pasted code blocks across your entire codebase using suffix-array analysis.
Start with the default mild mode. Use semantic when you want to catch clones with renamed variables.
fallow dupes

Options

Detection

FlagDescription
--mode <MODE>Detection mode: strict, mild (default), weak, semantic
--min-tokens <N>Minimum tokens per clone (default: 50)
--min-lines <N>Minimum lines per clone (default: 5)
--skip-localOnly report cross-directory duplicates
--cross-languageStrip TS types for TS to JS matching

Output

FlagDescription
-f, --format <FORMAT>Output format: human (default), json, sarif, compact
--quietSuppress progress output
--threshold <N>Fail if duplication exceeds N%

Incremental

FlagDescription
--baselineCompare against saved baseline
--save-baselineSave current duplication as baseline

Debugging

FlagDescription
--trace <FILE:LINE>Show all clones of code at a specific location
--performanceShow pipeline timing breakdown

Detection modes

Each mode progressively normalizes more syntax before comparing, trading precision for recall.
ModeWhat it normalizesBest for
strictNothing: exact token matchFinding verbatim copies
mildWhitespace, semicolons, trailing commasGeneral-purpose detection (default)
weak+ string literal valuesCatching copies with different messages
semantic+ variable names and numeric valuesFinding structural clones after renaming
As you move from strict to semantic, you’ll find more clones but also more potential false positives. Start with mild and increase sensitivity as needed.

Examples

# Mild mode (default)
fallow dupes

Example output

$ fallow dupes --threshold 25
Clone group 1 (42 lines, 3 instances)
├─ src/features/forecasting/server/procedures/analytics.ts:141-181
├─ src/features/forecasting/server/procedures/cashflow.ts:153-194
└─ src/features/forecasting/server/procedures/income.ts:590-631

Clone group 2 (57 lines, 2 instances)
├─ src/components/Calendar/CalendarMonth.stories.tsx:597-653
└─ src/components/Calendar/CalendarYear.stories.tsx:818-874

Duplication: 19.4% (27,255 duplicated lines across 398 files, below 25% threshold)
Found 1,184 clone groups, 2,959 instances (0.23s) ✓
$ fallow dupes --threshold 15
Clone group 1 (42 lines, 3 instances)
├─ src/features/forecasting/server/procedures/analytics.ts:141-181
├─ src/features/forecasting/server/procedures/cashflow.ts:153-194
└─ src/features/forecasting/server/procedures/income.ts:590-631

Duplication: 19.4% (27,255 duplicated lines across 398 files, exceeds 15% threshold)
Found 1,184 clone groups, 2,959 instances (0.23s) ✗

See also

Duplication analysis

How fallow’s detection engine works.

Configuration

Set default modes and thresholds in your config.

Migrating from jscpd

Coming from jscpd? See the migration guide.