基于 Tree-sitter 的代码相似度检测工具
问题概述
开发者需要在大型代码库中识别重复或结构相似的代码块,尤其是在 AI 生成代码导致的重复函数增多时。现有工具往往只能匹配行文本,缺乏对抽象语法树的支持,导致性能问题或误报。
痛点标签
- 大型代码库中的重复代码检测
- 需要 AST‑级别的相似度检测以忽略标识符、字符串等
- 现有向量搜索工具在大规模代码库中性能不佳
待验证问题
- 在您的项目中,重复代码是否成为主要问题?
- 您更倾向于使用基于 AST 的相似度检测而非纯文本匹配?
- 您是否愿意尝试并可能在实际工作流中使用此类工具?
证据
原话
This is what I wanted to help with duplicate code detection, which is now a real problem with agentic programming since the agent tends to duplicate helper functions a lot in bigger codebases. I ended up writing my own tool [1] that uses vector search, which works but can be unusably slow in large codebases. I will give this a shot.
原话
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.
原话
Nice approach. AST-level similarity seems much more useful than simple text matching.
免责声明:本卡片由 AI 从社区讨论中提炼,属于「痛点证据」,是需求分析与验证的起点,不等同于「已验证的市场需求」。AI 存在分析局限,关键决策前请打开上方原始讨论人工复核。