Wednesday, April 6, 2011

What tool to find code duplicates in C# projects?

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

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

    Greg : I couldn't get it to work either.
    rafek : Clone Detective is evil. It broke my VS and I couldn't uninstall this peace of c**p. :>
  • 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.

    rafek : I know, TC's tool is all right - but I need sth standalone or which integrates with VS
    madgnome : We work with simian in our company, it works great.
  • If you are not afraid of command line tools, Duplo is a free small application for detecting code duplicates

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

  • There is also CCFinder.

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

    Kudos goes to Richard

  • 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).

  • 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.

  • 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.

  • 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.

0 comments:

Post a Comment