Figure 1 shows the results of the analysis.įigure 1. To analyze the entire solution, open the solution in Visual Studio 11, then select Analyze | Analyze Solution For Code Clones from the main menu. One caveat: code clones less than 10 statements long won't be discovered when analyzing the entire solution. Please note: This column was written using the Visual Studio 11 Developer Preview, and as such, certain functionality may be subject to change before the final release.Īnalyzing the entire solution will search through all of its projects, looking for instances of code clones. There are two main ways to use code clone analysis: analyze the entire solution for all potential code clones, or select a section of code and search for that code fragment throughout the solution. This means not only will exact code matches be found, but also sections of code that are similar, but not exact, will also be flagged. In addition, code clone analysis uses heuristic search techniques to discover the duplicate code. While code clone analysis will only work over a single solution, it will search through all the projects contained in that solution. Code clone analysis, by identifying these similar sections of code, makes it easier to refactor them. Unfortunately, this type of code duplication can make changing the code difficult, as the same change must be made in multiple places in the code base. The number one reason is copying and pasting code. These sections, or "code clones", can occur for a variety of reasons. Learn how Visual Studio 11 helps developers find duplicate code throughout their projects and solutions.Ĭode clone analysis is a new feature available in Visual Studio 11 (and currently available in the Visual Studio 11 Developer Preview) that allows for identification of similar code sections. Once Transformer extension is installed, Go to the next steps.Inside TFS Visual Studio 11 Developer Preview: Code Clone Analysis Type “transformer” and Select Transformer extension Go to Extensions icon and Left Side vertical bar Transformer is a custom extension that deletes duplicate lines for an entire file or selection of a file apart from other things such as filtering lines and combining lines’ end and beginning spaces and tabs and deleting comments. ![]() It removes duplicate lines from the file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |