Find duplicate code
ProprietaryDetect duplicate and likely-duplicate code across the codebase by AST-subtree fingerprinting and MinHash/LSH method alignment (zero AI). Reports Type-1 (exact), Type-2 (renamed), and Type-3 (gapped: inserted/removed/edited statements) clone groups ranked by the volume of code that would collapse if the duplication were refactored away.
io. moderne. prethink. quality. FindDuplicateCodeOptional
Minimum number of AST nodes a subtree must contain to be considered for exact (Type-1) duplication. Larger values reduce noise. Defaults to 75.
Minimum number of AST nodes a subtree must contain to be considered for renamed (Type-2) duplication. Should be at least the Type-1 minimum because anonymization is noisier. Defaults to 110.
Minimum number of occurrences for a fragment to be reported as a clone group. Defaults to 2.
Whether to detect renamed (Type-2) clones in addition to exact (Type-1) clones. Defaults to true.
Whether to include test sources (paths under src/test). Defaults to false.
Cap on the number of individual occurrences reported per clone group. The true count is always reported; only the enumerated locations/rows are capped. Defaults to 200.
Maximum number of lines of the representative fragment to include in the snippet. Defaults to 40.
Minimum number of consecutive statements that must match to seed a statement-sequence clone. Defaults to 5.
Maximum number of statement edits (insertions, deletions, or substitutions) tolerated inside a statement-sequence clone (Type-3). 0 detects only exact/renamed runs; 1 (the default) also catches copy-paste-then-edit/insert/remove-one-statement. Higher values catch more divergent copies.
Whether to detect duplicated runs of consecutive statements (in addition to whole-subtree clones). Defaults to true.
Whether to structurally suppress low-value boilerplate: getters/setters, equals/hashCode/toString, runs or blocks composed entirely of trivial data statements (constant declarations, map/collection population), and subtrees dominated by a large string-literal concatenation (embedded doc/JSON/prompt blobs). Suppressed fragments are still descended into, so genuine clones nested inside them are still found. Defaults to true.
Whether to also detect gapped (Type-3) clones between whole methods that share no long run of identical statements, by aligning MinHash/LSH-similar method pairs. Catches copy-edited methods the statement-run detector misses because it needs a run of identical statements to anchor. Defaults to true.
mod run . --recipe= io. moderne. prethink. quality. FindDuplicateCodeInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.