language-agnosticrefactoringdrycode-reuse

Does it exist: Repeated Code Finder?


In the near future, I will be inheriting a somewhat large project. I've been making some small updates to it recently, and noticed that parts of it could use some refactoring, since there are methods that perform the same operation with a small difference.

I was wondering if there is a tool that will take a bunch of source code and find similar blocks of code so that they could be identified for possible refactoring. It would be great if there was fuzzy searching present, so that it could identify similar operation (other than just chucks of code repeated verbatim).

I don't expect the program to refactor the code itself, just identify potential repetition.

My platform is C#, but any solution would be helpful


Solution

  • http://www.codeplex.com/CloneDetectiveVS

    "Clone Detective is a Visual Studio integration that allows you to analyze C# projects for source code that is duplicated somewhere else."

    There's a lot going on, visually, when you throw it at a project with a lot of code duplication. If that combines with your using Clone Detective for the first time, it can be a bit overwhelming at first.

    I really recommend this tool. It is excellent.