Abhishek
Abhishek

Reputation: 1779

Duplicate code: How to find and remove with tools

I am managing a group of three interns working on a php project. They seem to be not good at refactoring and are using duplicate code in multiple places. I am looking for a tool which I can use to find this duplicate code so I can show them.

This would make my job easier, and the project more elegant and less prone to errors. Any leads?

Upvotes: 7

Views: 6117

Answers (3)

Anantha Sharma
Anantha Sharma

Reputation: 10108

PMD is a good tool to find code duplication. Here is a link to the site.

Upvotes: 8

reinierpost
reinierpost

Reputation: 8611

I like CCFinderX a lot, but it is abandonware.

Upvotes: 0

Ira Baxter
Ira Baxter

Reputation: 95400

See our CloneDR tool. It finds duplicate code across large software systems, using compiler-accurate parsing to find matches guided by the language syntax (AST matching), ignoring changes in whitespace and linebreaks. It will find exact duplicates, and near-miss duplicates. For near-duplicates, its reports the differences in the near-misses as parameters; it almost tells you how to code a replacement subroutine for the clones.

CloneDR operates on a variety of languages: C, C++, C#, COBOL, EGL, Java, JavaScript, PHP, Python and many more. Example detection reports for each of these can be found at the link.

Upvotes: 0

Related Questions