Remix.run Logo
▲ Show HN: Treepeat – Code similarity detection using Tree-sitter(github.com)
26 points by 91awebsi 2 days ago | 1 comments

treepeat is a tool that finds similarities in your codebase.

Find duplicate code blocks meaningful to the language (classes/functions), not just lines.

Find near-duplicates: ignore whitespace, strings, high level AST nodes such as function and names.

Find structurally similar code: anonymize identifiers, constants, etc.

Pull requests welcome: This is very much an proof of concept - I'm happy with it, but I haven't supported very many languages at present.

Languages supported: astro, bash, css, go, html, javascript, lua, markdown (plus codeblocks), python, sql, typescript, java, kotlin, rust, yaml

▲bradleyy 6 minutes ago | parent [-]

Thanks for posting this; I'm very interested in finding similar chunks of code in an AST-ish fashion, and using tree-sitter seems perfect.