Clone Detective for Visual Studio 2008

I just ran across a new project on CodePlex today called Clone Detective for Visual Studio from Immo Landwerth (also responsible for NQuery) and I've got to say that it's really quite cool.  I've blogged previously about detecting code clones with CCFinder but CCFinder is an external tool and a bit cumbersome to set up and use.

Clone Detective for VS may not be quite as powerful but it is incorporated into VS and is so much easier to use that it will probably become my tool of choice as a result.  It's so much better if you can detect your copy & paste development efforts in the same tool that you can fix them in.

Here's a quick screenshot of what it looks like:

image

We get 3 new windows we can look at (available from the View menu).

The Clone Explorer is where you initiate clone detection, and see results.  E.g. the AlternateTaxRules.cs file has 2 cloned sections.

The Clone Intersections looks at a file and shows you all the other files that share clones with it.  The different colours represent the different clones sections.

The Clone Results shows you an individual cloned piece of code and where it resides throughout the application (i.e. all the different files where  that same code occurs).

When you look at a file with clones you'll see a purple line next to the cloned lines (shown in the image).  By default visual studio just shows a single source file in the main window, however by dragging the tab with the filename in it to the right you can get to a side-by-side view which makes it so much easier to compare the clones before deciding it you should refactor or not.

From first impressions it looks to be a handy little tool and definitely one to keep in my VS toolbox.

 

Reader Comments

Post a Comment



Welcome

As you might have guessed, this is a tech blog. I normally write about development and things that can help us do it better, specifically in the .NET space, and occasionally i'll throw in a post about whatever happens to be in my head at the time. Enjoy your visit!
And in case you were wondering, I'm a Principal Consultant for Readify, I run the Sydney Alt.Net group and I play a bit of LOTRO in my spare time (feel free to look me up)


 

My Open Source Projects

Labels

Blog Archive