Config: duplication
Find the fallow config keys for duplication, with type, default, allowed values and description.
The config file holds the settings of fallow. How config works explains where fallow finds the file and how files merge.
duplicates
- Type:
object
Configures clone detection: enabled (default true), mode (strict, mild default, weak, semantic, from least to most identifier/literal blinding; strict and mild are equivalent under fallow's AST tokenizer, weak blinds string literals, semantic blinds all identifiers and literals for Type-2 renamed-variable detection), near (false, add bounded function-scoped near-miss detection), minTokens (50), minLines (5), minOccurrences (integer >= 2, deserialization fails below 2), threshold (max duplication percentage, 0 = no limit), ignore globs, ignoredClones (reviewed clone keys to hide until their content or occurrence count changes), ignoreDefaults (true, merge built-in generated-file ignores), skipLocal (only report cross-directory clones), ignoreSymlinks (false, omit clone instances whose path is a symlink or lies under a symlinked directory), crossLanguage (strip TS type annotations to match .ts against .js), ignoreImports (true, strip ES import/re-export/top-level require wiring from the token stream), and normalization (per-flag ignoreIdentifiers/ignoreStringValues/ignoreNumericValues overrides on top of mode, plus consistentIdentifiers, which with ignoreIdentifiers requires a one-to-one name mapping between clone instances). Raise minOccurrences to focus on widespread copy-paste, enable near for gapped structural clones, or set mode to semantic to catch renamed-variable exact clones.
| Key | Type | Default |
|---|---|---|
enabled | boolean | true |
mode | string | "mild" |
near | boolean | false |
minTokens | integer | 50 |
minLines | integer | 5 |
minOccurrences | integer | 2 |
threshold | number | 0 |
ignore | string[] | [] |
ignoredClones | string[] | [] |
ignoreDefaults | boolean | true |
skipLocal | boolean | false |
ignoreSymlinks | boolean | false |
crossLanguage | boolean | false |
ignoreImports | boolean | true |
normalization | object | |
minCorpusSizeForShingleFilter | integer | 1024 |
minCorpusSizeForTokenCache | integer | 5000 |
duplicates.enabled
- Type:
boolean - Default:
true
Whether duplication detection is enabled. false turns off each duplication analysis that a command runs by default: the duplication analysis of the bare fallow command, the duplication sub-analysis of fallow audit, and the duplication measure and penalty of the health score. A command line that names the analysis still runs it: --only dupes, --include-dupes, audit.dupes: true and the fallow dupes command.
duplicates.mode
- Type:
string - Default:
"mild"
Detection mode: strict, mild, weak, or semantic.
Allowed values:
strict: All tokens preserved including identifier names and literal values (Type-1 only).mild: Default mode, equivalent to strict for AST-based tokenization.weak: Blind string literal values (structure-preserving).semantic: Blind all identifiers and literal values for structural (Type-2) detection.
duplicates.near
- Type:
boolean - Default:
false
Detect structurally similar function bodies with small edits.
duplicates.minTokens
- Type:
integer - Default:
50
Minimum number of tokens for a clone.
duplicates.minLines
- Type:
integer - Default:
5
Minimum number of lines for a clone.
duplicates.minOccurrences
- Type:
integer - Default:
2 - Value: at least
2
Minimum number of occurrences (instances of the same clone) before a group is reported. Defaults to 2 (every duplicated pair is reported). Raise this to focus on widespread copy-paste worth refactoring and skip context-sensitive pairs.
duplicates.threshold
- Type:
number - Default:
0
Maximum allowed duplication percentage (0 = no limit).
duplicates.ignore
- Type:
string[] - Default:
[]
Additional ignore patterns for duplication analysis. A single * stays within one path segment; use ** to match across directories.
duplicates.ignoredClones
- Type:
string[] - Default:
[] - Value: matches
^dup:(?:[0-9a-f]{8}|[0-9a-f]{16}(?:-r?[1-9][0-9]*)?):(?:[2-9]|[1-9][0-9]+)$
Reviewed clone groups to omit from duplication results.
Each entry is <fingerprint>:<instance_count>, for example dup:6f12ab34:2. A content or occurrence-count change produces a new key and makes the group reportable again.
duplicates.ignoreDefaults
- Type:
boolean - Default:
true
Merge built-in generated-framework ignore patterns with ignore.
Set to false to use only the user-provided ignore list.
duplicates.skipLocal
- Type:
boolean - Default:
false
Only report cross-directory duplicates.
duplicates.ignoreSymlinks
- Type:
boolean - Default:
false
Omit clone instances whose file path is a symlink, or lies under a symlinked directory, inside the project root.
Defaults to false: symlinked instances stay in the report and carry is_symlink: true in JSON output. Set to true to report only duplication between real files. A clone group with fewer than two remaining instances is not reported. Symlinked files also leave the corpus, so stats (files, lines, tokens and the duplication percentage that threshold checks) count only real files.
duplicates.crossLanguage
- Type:
boolean - Default:
false
Enable cross-language clone detection by stripping type annotations.
When enabled, TypeScript type annotations (parameter types, return types, generics, interfaces, type aliases) are stripped from the token stream, allowing detection of clones between .ts and .js files.
duplicates.ignoreImports
- Type:
boolean - Default:
true
Exclude module-wiring declarations from clone detection.
Defaults to true: token-identical module wiring is a structural property of well-formatted code, not copy-paste, so it should not surface as clone groups. Set to false to count module wiring again. When enabled, ES imports, re-export declarations, and top-level static CommonJS require("...") binding declarations are stripped from the token stream before clone detection. Dynamic imports, side-effect require() calls, nested require() calls, dynamic require arguments, and mixed declarations are still counted.
duplicates.normalization
- Type:
object
Fine-grained normalization overrides on top of the detection mode.
| Key | Type | Default |
|---|---|---|
ignoreIdentifiers | boolean | |
ignoreStringValues | boolean | |
ignoreNumericValues | boolean | |
consistentIdentifiers | boolean |
duplicates.normalization.ignoreIdentifiers
- Type:
boolean(optional)
Blind all identifiers (variable names, function names, etc.) to the same hash. Default in semantic mode.
duplicates.normalization.ignoreStringValues
- Type:
boolean(optional)
Blind string literal values to the same hash. Default in weak and semantic modes.
duplicates.normalization.ignoreNumericValues
- Type:
boolean(optional)
Blind numeric literal values to the same hash. Default in semantic mode.
duplicates.normalization.consistentIdentifiers
- Type:
boolean(optional)
Require a one-to-one mapping between the identifier names of clone instances. Takes effect only when ignoreIdentifiers is on: a = b + c then matches x = y + z, but not x = x + x. A clone that breaks the mapping keeps each maximal part that maps one-to-one. Default: false in every mode.
duplicates.minCorpusSizeForShingleFilter
- Type:
integer - Default:
1024
Minimum tokenized file count before focused duplicate analysis prefilters unchanged files with k-token shingles.
duplicates.minCorpusSizeForTokenCache
- Type:
integer - Default:
5000
Minimum source file count before the persistent duplication token cache activates. Below this threshold the cache load/save overhead exceeds the tokenize savings, so the cache stays disabled even when not running with --no-cache.
similarCode
- Type:
object
Configures the explicit local similar-code candidate workflow: threshold (0.80, model-specific cosine floor), minLines (3), and additional ignore globs. Provider identity, setup, executables, endpoints, credentials, and consent cannot be set by project config.
similarCode.threshold
- Type:
number - Default:
0.8 - Value: at least
0, at most1
Minimum model-specific cosine similarity retained as an unverified candidate. It is not a probability or refactor-safety verdict.
similarCode.minLines
- Type:
integer - Default:
3 - Value: at least
1
Minimum source line count for a function to enter model inference.
similarCode.ignore
- Type:
string[] - Default:
[]
Additional project-root-relative globs excluded only from similar-code extraction. Global ignorePatterns remain authoritative first. A single * stays within one path segment; use ** to match across directories.