From the course: Visual Studio Developer Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Find duplicate code with the code clone analysis tool

Find duplicate code with the code clone analysis tool - Visual Studio Tutorial

From the course: Visual Studio Developer Tips

Find duplicate code with the code clone analysis tool

- [Instructor] This tip looks at one of the code analysis tools that is included in Visual Studio Enterprise Edition. It's called the code clone tool. This is not a tool for making copies of your code. Instead, it's a tool for finding potential duplicate sections of code in your solution. I'll start by looking at how to analyze a single line of code. Select the line of code. Then right click and choose this menu item, Finding Matching Clones in the Solution. If you do not see this menu item, make sure you're using Visual Studio Enterprise Edition. That brings up the code clone search results window, and I see that there's one line of code somewhere in the solution that matches the line of code I analyzed. Now in a real world application that's a common scenario. It's not uncommon to have lines of code that are exact matches, so this is not a very interesting use of this tool yet. Let's do another search. This time in the search results window I see that there is a medium match, so…

Contents