Archive

Archive for the ‘Code Analysis’ Category

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…

Code Issues for Switch (Select) and Case statements

December 14th, 2011 Comments off

A switch statement executes logic, dependent on the value of a given expression (parameter). The types of values a switch statement operates on can be boolean, enum, integral types, and strings. Each switch statement can contain any number of case statements, but no two case constants within the same switch statement can have the same value. Each case statement defines a value to compare against the original expression. You may also include a default label following all other case statements. If none of the other choices match, then the default choice is taken and its statements are executed. If there is no default label, control is transferred outside the switch.

Read more…

Code Issues – Member is not implemented

October 31st, 2011 Comments off

Cause:

The Member is not implemented code issue of the warning type is shown for the members that do not provide an implementation. Not providing an implementation may be a sign of incomplete code.

The code issue is shown for non-interface, non-abstract, non-virtual, non-extern members – both methods and properties. It is not shown for constructors and destructors of a class.

Read more…

Code Issues for anonymous methods and lambda expressions

October 31st, 2011 Comments off

We already reviewed the refactorings for anonymous methods and lambda expressions and know how to deal with these language structures. Now its time to review what Code Issues for anonymous methods and lambda expressions CodeRush Pro provides.

Read more…