Archive

Posts Tagged ‘Duplication’

Duplicate Detection in CodeRush versus Code Clone Analysis in Visual Studio 2011

December 20th, 2011 Comments off

CodeRush Duplicate Code Detection (DDC) analysis runs in the background while you work in the Visual Studio IDE. Visual Studio 2011 Developer Preview has a similar feature called Code Clone Analysis (CCA). Both features find code duplications, so it is possible to undertake a brief overview of each feature and compare them. Please note that this article was written using the Visual Studio 11 Developer Preview, and as such, certain functionality may be subject to change before the final release. The version of the IDE Tools/CodeRush used for comparison is 11.2, which is certainly subject to change.

Read more…

Duplicate Detection analysis options

December 20th, 2011 Comments off

Duplicate Code Detection options are available at the Editor | Code Analysis | Duplicate Code options page in the Options Dialog. Duplicate code options specify when detection analysis is activated and the analysis level. Here’s what this page looks like:

Read more…

Duplicate Consolidation inside Visual Studio

December 20th, 2011 Comments off

The process of removing duplicate code is called code consolidation. The result of code consolidation is a single code block that replaces a specific duplicated code in several locations (different files or projects). The resulting consolidated code block is functionally absolutely the same as all duplicated code blocks it replaces.

Read more…

Duplicate Detection using the Stand-alone Application

December 20th, 2011 Comments off

CodeRush ships two standalone programs that do not require the Visual Studio IDE to be running for duplicate code detection analysis:

  • Duplicate Code Analysis windows app
  • Duplicate Code Analysis console app

Both applications can be used outside of the IDE to find duplicate code inside a specified solution. These applications are located inside the Plug-ins folder of your IDE Tools installation. You can find the windows application in the Start menu as well:

Read more…

Duplicate Detection Visual Studio tool window

December 20th, 2011 Comments off

The Duplicate Code tool window allows you to review the duplicate code found in your entire solution. The tool window is available via the DevExpress | Tool Windows | Duplicate code menu item.

If the duplicate code analysis has been started, you will see the analysis results in the Clusters list on the left, otherwise, you can click the “Run duplicate code analysis” button to perform the duplicate code search. This is what it looks like:

CodeRush Duplicate Code Tool Window results

Read more…

Duplicate Real-time detection in Visual Studio

December 20th, 2011 Comments off

CodeRush Duplicate detection runs automatically inside Visual Studio IDE in a background thread. To enable it, go to the Duplicate Code options page in the Options Dialog and toggle its availability. Note that you should also have the Code Issues Analysis feature enabled. Once you enable detection, it starts scanning your solution for code duplication. You will see an animated icon in the lower right corner visually indicating the progress of duplicate code analysis:

CodeRush Duplicate Code editor icon

Read more…

Duplicate Detection and Consolidation overview

December 20th, 2011 Comments off

This is a blog series overview of the Duplicate Detection and Consolidation (DDC) feature shipped in DevExpress CodeRush Pro productivity tool for the Visual Studio IDE.

Background

Duplicate code, or sometimes referred to as a clone, is a program source code fragment that is very similar to another code fragment. A code clone may occur more than twice, either within a single program or across different programs owned or maintained by the same group of developers. Code duplication is considered an expensive practice that should be avoided because it complicates the maintenance and evolution of the software.

Read more…

Intelligent code lines enhancement and modification using the Duplicate Line feature

April 19th, 2011 Comments off

The Duplicate Line CodeRush feature intelligently creates a copy of an existing line of code, allowing you to easily modify it. If the code line is recognized as a predefined pattern, the line is copied and a portion of it is selected for further modification. Note that some code line bits can be modified automatically for you as well.

The predefined duplication patterns are configurable. They are stored and presented as regular expressions that contain one or several DXCore built-in reg-ex aliases for easy understanding. If the line doesn’t match any of the existing patterns – nothing happens, by default. However, there an option to copy-paste the entire line of the text if no matches are found when the feature is performed. All available options are listed later.

Read more…