New open-source tool treepeat detects duplicate code via Tree-sitter parsing
A developer released treepeat, a Python-installable tool that scans codebases for duplicate and near-duplicate code using Tree-sitter AST analysis and locality-sensitive hashing. It offers three normalization modes ranging from exact duplicate detection to loose structural similarity matching, and currently supports 15 languages including Python, JavaScript, Go, Rust and Java. The creator describes it as a proof of concept and is soliciting community contributions to expand language support.
GoKawiil's interpretation of the reporting above, not reported fact.
By comparing code at the level of meaningful language constructs like functions and classes rather than raw text lines, the tool could catch copy-pasted or lightly modified logic that traditional line-based diff or duplication checkers miss. Its CI-friendly SARIF output suggests it could be integrated into automated code review pipelines, though as an early-stage project its accuracy and language coverage remain limited.
- treepeat uses Tree-sitter AST parsing plus locality-sensitive hashing to find duplicate or similar code blocks.
- Three rulesets (none, default, loose) let users tune sensitivity from exact matches to structurally similar but anonymized code.
- The tool supports 15 languages and is open to community pull requests to add more.
Source: github.com, 2026-09-22
Published there as: “Show HN: Code similarity detection using Tree-sitter”
Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.