Clone Detective is a Visual Studio integration that allows you to analyze C# projects for source code that is duplicated somewhere else. Having duplicates can easily lead to inconsistencies and often is an indicator for poorly factored code.
You’ll get 3 new windowsÂ (available from the View menu).
- The Clone Explorer is where you initiate clone detection, and see results.
- 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.
At this time it appears to be only for C#, sorry VB guys.
Clone Detective is available via CodePlex and is free. Download it here.