Find-dup-defs – find duplicated Python code at the speed of light
Find-dup-defs is a tool designed to identify duplicated Python code quickly and efficiently. It analyzes code for duplicate definitions and suggests which ones to refactor first, using a unique scoring system. The tool has shown a significant increase in copy-pasted lines in codebases, highlighting the need for better code management practices.
- ▪Find-dup-defs can identify duplicate functions, methods, classes, and constants at a speed 2-12 times faster than existing tools.
- ▪The tool ranks duplicates by a normalized Thickness score and provides auto-suggested filters for project-specific noise.
- ▪A report from GitClear indicated that copy-pasted lines in code have increased from 8.3% to 12.3% between 2021 and 2024.
Hacker News (Newest) files mainly under programming. We currently carry 5,257 of its stories.
Opening excerpt (first ~120 words) tap to expand
find-dup-defs Find the copy-pasted code your linter can't — and tell you which copies to refactor first. Duplicate & near-duplicate definitions — functions, methods, classes, constants, type aliases — clustered by structural AST canonicalization, ranked by a normalized Thickness score, graded ERROR / WARNING / INFO, with auto-suggested project-specific noise filters out of the box. 2-12× faster than PMD CPD / jscpd. Calibrates itself on first run. Why now GitClear's 2025 report (211M lines of code analyzed): copy-pasted lines grew from 8.3% to 12.3% of all changes 2021→2024, while refactored lines dropped from 25% to under 10%. For the first time in measurable history, copy/paste exceeded code reuse. AI assistants don't know your project's _helper.py — they emit the copy.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.