Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
我使用以下工具:
Checkstyle(LGPL 许可证)- 支持已删除,查看详细信息。这两种工具都支持代码重复检测。但他们都缺乏建议你如何重构代码的能力。
JetBrains IntelliJ IDEA Ultimate 具有良好的静态代码分析和代码重复支持,但它不是免费的。
I use the following tools:
Checkstyle (LGPL License)- support was removed, see details.Both tools have code duplication detection support. But both of them lack the ability to advise you how to refactor your code.
JetBrains IntelliJ IDEA Ultimate has good static code analysis with code duplication support, but it is not free.
维基百科关于重复代码工具的文章中列出的大多数工具都会检测许多不同的重复内容语言,包括 Java。
Most of the tools listed on the Wikipedia article on Duplicate Code Tools will detect duplicates in many different languages, including Java.
SonarQube 可以检测重复代码,但不提供消除重复代码的建议。它是免费的 - 尽管在默认设置下它只能检测词法相同的克隆
SonarQube can detect duplicated codes but does not give recommendation on eliminating them. It is free and - although with the default setup it can only detect lexically identical clones
Simian 或 PMD 的 CPD。前者支持更广泛的语言,但对于商业项目来说不是免费的。
Either Simian or PMD's CPD. The former supports a wider set of languages but is non free for commercial projects.
http://checkstyle.sourceforge.net/ 支持查找重复项
http://checkstyle.sourceforge.net/ has support for finding duplicates
请参阅我们的 SD Java CloneDR,这是一个用于检测精确重复和近似重复重复的工具大型 Java 系统中的代码。
尽管存在空格更改、换行、注释插入删除、常量或标识符修改,甚至在许多情况下,甚至将一个语句替换为另一个语句或语句块,CloneDR 仍会找到代码克隆。
它显示了每组克隆的位置、每个单独的克隆、具有共享共性的克隆的抽象以及抽象的参数化,以显示如何从抽象派生每个克隆实例。
它在大多数 Java 系统中发现 10-20% 的克隆。
See our SD Java CloneDR, a tool for detecting exact and near-miss duplicate code in large Java systems.
The CloneDR will find code clones in spite of whitespace changes, line breaks, comment insertions deletions, modification of constants or identifiers, and in a number of cases, even replacement of one statement by another or a block of statements.
It shows where each set of clones is found, each individual clone, an abstraction of the clones having their shared commonality and parameterization of the abstraction to show how each clone instance can be derived from the abstraction.
It finds 10-20% clones in most Java systems.