Hi,
Today we will see an interesting option for the analysis of code which has been incorporated into Visual Studio 11. In this case it’s the ability to find code sections duplicate within a solution.
We all know that in the rush of every day, many times we skip all the good practices and instead of giving her a bit of the thinking machine, use the copy & paste as patron of implementation of code. In the long run we will bring more problems than solutions, but… well not I want to tell something they already know.
If you are working and you find yourself with a piece of code that “gives you a bad smell”, now have the ability to select it, display the contextual menu and select the option “”Find Matching Clones in Solution“.”
As I wanted to do a test on a good code base and good, so I decided to analyze the source code of Enterprise Library 5.And after a while of searching I found duplicate portions of code, add a new class in which “I commissioned to force the error”.
When you end the search for duplicate sections, you will see that, in the results window, we can see the selected code and its clones.
If on the other hand select a portion of code that is repeated more than once, because we can see the different results in the results window. These results may be “exact copy”, or even partial implementations of the code that analyzes, cool
Greetings @ Home
The Bruno