views:

2597

answers:

8

What tool would you recommend for finding code duplicates in C# code?

+2  A: 

Clone Detective for Visual Studio looks promising, although I have had troubles getting it installed.

Mark Heath
I couldn't get it to work either.
Greg
Clone Detective is evil. It broke my VS and I couldn't uninstall this peace of c**p. :>
rafek
+8  A: 

I know of tool called Simian but I have never actually had a chance to use it. I remember that CruiseControl.NET can display reports from Simian.

Also, Team City continuous integration server from JetBrains seems to have duplicate detection functionality.

Marcin Hoppe
I know, TC's tool is all right - but I need sth standalone or which integrates with VS
rafek
We work with simian in our company, it works great.
madgnome
+3  A: 

If you are not afraid of command line tools, Duplo is a free small application for detecting code duplicates

http://sourceforge.net/projects/duplo/

Aleris
+7  A: 

There is also CCFinder.

I found out about it via Richard Banks Blog Detecting Duplicate Code

Kudos goes to Richard

tdyen
A: 

Our CloneDR is an industrial-strength tool for finding clones across large source code bases, driven by the syntax of the programming langauge. It can find clones in many languages, including C#, Java, C++ and PHP. There are examples of clone detection runs at the link, including one on the C# version of Hibernate (NHibernate).

Ira Baxter
A: 

You can also check-out the Source Code Duplication Detector (SolidSDD). It detects similar code in C#, Java and C/C++. It is a commercial tool mainly intended for industrial use and addresses not only developers, but also architects and managers. The licenses are not that cheap, but open source projects and educational institutions can use it for free.

Lucian Voinea
+4  A: 

I've been working on a Resharper plugin for dealing with code clones. It scans your code, searching for sections that can be replaced by an existing method call. A section can be a whole method or just a part of a method. When it finds one, the lightbulb pops up and offers to replace said section with a call to the existing method.

http://landofjosh.com/wp-content/uploads/2009/08/identicalmethodsquickfix-cropped.png

I call it AgentRalph. At this point it's not ready for production use, but I've been making a lot of progress and hope to make a release soon.

Josh Buedel
+1  A: 

I tried Atomiq (http://getatomiq.com/) and it works pretty well. It has a Visualization Wheel that represents results in the form of a wheel showing dependencies. It's cheap ($30) as well.

Sai Gudigundla