是否有一个自动工具可以检测代码库的干燥程度?
I am a strong advocate of the DRY principle:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
Are there any tools that can test a code base for the amount of DRYness and both quantify and pinpoint specific examples for correction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Simian
Simian
PMD 的复制过去检测器 (CPD)
您可以通过命令行运行它,有一个 ANT 任务和一个 Eclipse 插件。
PMD's Copy Past Detector (CPD)
You can run it commandline, there is an ANT task, and an Eclipse plugin.
Visual Studio 克隆侦探
Clone Detective for Visual Studio
请参阅我们的 CloneDR 工具,该工具使用计算机语言结构作为指导来查找精确的和几乎未命中的重复代码集。除了检测克隆之外,它还将向您展示粗略的抽象和解释克隆实例之间差异的参数绑定。
它具有多种语言的实例化:C、C++、C#、Java、JavaScript、PHP、COBOL、Python、PLSQL...它往往会在任何规模较大的系统(例如 100K SLOC)中发现 10-15% 的重复代码及以上)。该网站上有多种语言的示例报告,您可以下载试用版。
See our CloneDR tool, which finds exact and near miss sets of duplicated code using computer langauge structure as guide. As well as detecting clones, it will show you a rough abstraction and the parameter bindings that explain the differences between the clone instances.
It has instantiations for many lanuages: C, C++, C#, Java, JavaScript, PHP, COBOL, Python, PLSQL, ... It tends to find 10-15% duplicated code across systems that have any serious size (e.g, 100K SLOC and above). There are sample reports for many languages at the web site, and you can download a trial copy.