次の方法で共有


Visual Studio Code Metrics

The new Code Metrics feature for Visual Studio ‘Orcas’! Available in Visual Studio Team Developer and Team Suite, this new feature allows users to generate code metrics for projects and solutions and displays the results in the Code Metrics Results tool window. An example Code metrics Results window is shown below

This feature can generate five different metrics:  Maintainability Index, Cyclomatic Complexity, Depth of Inheritance, Class Coupling, and Lines of Code.

Maintainability Index - Measures ease of code Maintanance and higher values for this is better

Cyclomatic Complexity - Measures the number of branches and lower values for this is better

Depth of Inheritance - This measures the lenght of object inheritance hierarchy and lower values for this is better

Class Coupling - Measures number of classes that are referenced and lower values are better

Lines of Code - Measures lines of executable code and lower values are better

 All metrics are averaged at the type, namespace, and assembly levels with the exception of Class Coupling. The Class Coupling metric displays the total number of distinct types referenced at the method and type levels rather than the total number of type references.

As you can see in the figure Visual Studio gives Red or Green icon for the index based on which you can change your code to improve code quality.

Users will are able to sort the results in the window by column. For example, above the results are sorted by the Maintainability Index column. Note that the proper hierarchy is maintained after sorting

Users can also filter the results from a particular metric for values between a specified minimum and maximum value. As you can see in below the results of filtering out any results with a Maintainability Index greater than 100 are displayed.

Users can also export these results into Excel where they can perform their own calculations and transformations.

To generate code metrics, simply do the following:

  1. In Solution Explorer, right-click on your solution/project and choose Generate Code Metrics

Download Orcas and try it out !!!

Comments

  • Anonymous
    May 14, 2007
    Paul Hacker on Source Only Process Template. Grant Holliday on TFS Installation Error 28805. The SRL...

  • Anonymous
    May 14, 2007
    How is maintainability calculated?  Is there a list of how much complexity an inline var or a comment adds?