Skip to content
Fallow home
All docs pages

Docs home

Code duplication

What a code-duplication finding of fallow dupes means, why it matters and how to fix it.

What it reports

Duplicated code block.

Duplication explains how fallow finds it.

Why it matters

A bug fix in one copy does not reach the other copies. The copies drift apart, and each copy needs its own review and tests.

Example

Two files contain the same normalized token sequence across a multi-line block.

Fix

Extract the shared logic when the duplicated behavior should evolve together. Leave it duplicated when the similarity is accidental and likely to diverge. To keep one intended copy out of the report, suppress it with // fallow-ignore-next-line code-duplication. To make a new copy fail fallow audit, set the introduced-clone-group rule to error.

Facts

FactValue
Issue typecode-duplication
Rule id in SARIF outputfallow/code-duplication
Commandfallow dupes
Suppression comment// fallow-ignore-next-line code-duplication
Fixable with fallow fixNo

Note. Reported by fallow dupes (and bare fallow / fallow audit).