code clone detection in visual studio 2012
TRANSCRIPT
Code Clone Detection in Visual Studio 2012
MSc. IT University of Moratuwa
Batch 8
IN 5210 – System Analysis and design
Members
Suren Gamage
Suhail Jamaldeen
Sivasithamparam Rajivkanth
Prasith Premachandra
Agenda
What is code clone?
What is found?
What is not found?
To exclude specific files or methods from the analysis
Benefits
What is code clone?
Code clones are separate fragments of code that are very similar.
The code clone analyzer searches for duplicate code in Visual C# and Visual Basic.
Available in Visual Studio Ultimate or Visual Studio Premium.
Analyzed find code clones in a particular code fragment
throughout the solution.
What Is Not Found?
Type declarations are not compared
Code less than 10 statements long.
Fragments with more than 40% changed tokens.
If a project contains a .codeclonesettings file, code elements that are defined in that project will not be searched if they are named in the Exclusions section of the .codeclonesettings file.
Some kinds of generated code are excluded: *.designer.cs, *.designer.vb
· InitializeComponent methods
To exclude specific files or methods from the analysis
Add a new XML file to the Visual Studio project in which the methods that you want to exclude are defined.
It does not matter whether the file is part of the project. It must be in the top directory of the project.
Change the file name extension to .codeclonesettings
Benefits
Checking for similar issues before check-in
Reference information for code review
Architecture refactoring
Code clean up
Bug fixing
Bug investigation
Reference http://msdn.microsoft.com/en-us/library/hh205279.aspx