DCSIMG
Code Analysis in VS 2008 - Maor's Blog

Code Analysis in VS 2008

VS 2005 introduced internal static analysis tools. This helps you to write secure and quality code.

Visual Studio 2008 has new Code Analysis features:

  • Code Metrics - This gives you the ability to dig deep to find those un-maintainable and complex hotspots. Code Metrics will ship with five metrics - Cyclomatic Complexity, Depth of Inheritance, Class Coupling, Lines of Code and Maintainability Index.
  • Analysis improvements:
    • Support for analyzing anonymous methods and lambda expressions
    • Reduced noise in existing analysis and the ability to skip over tool generated code
    • New analysis, including additional rules around security, globalization, maintainability and spelling.

 

To generate code metrics, simply do the following:In Solution Explorer, right-click on your solution/project and choose Generate Code Metrics

runCM

After generation you'll get the Code Metrics Results window and a tooltip on every column that explain the result. The Maintainability Index column includes a maintainability indicator light that changes based on the maintainability of the code. Green indicates good maintainability, yellow indicates moderate maintainability, and red indicates poor maintainability.

cmResults

 

Technorati Tags: ,
Published 27 October 2007 12:24 AM by Maor David-Pur

Comments

# savitha said on 13 December, 2007 09:14 AM

Want Details about the Code analysis and Code metric

# Duane Fields said on 21 December, 2007 08:18 AM

For those who don't have the Team System, Exact Magic Software has a free add in to Visual Studio called "Studio Tools" that has Code Metrics built in as well. It's pretty much the same thing as the one in the Team Edition. You can download it from http://www.exactmagic.com

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above:

Search

Go

This Blog

News

    RSS

     

    Connect with Me

    Maor's Facebook profile  Follow Maor on Twitter  Maor's profile on Linkedin  Maor in FriendFeed 
           

Syndication