Sunday, April 3, 2011

Deriving Cyclomatic Complexity in .NET

I know that I can access the cyclomatic complexity to my code in Visual Studio 2008 Team Explorer by right clicking and selecting "Calculate Code Metrics". I would like to expose this data for a web application to display it. Does anybody know of any way of accessing this data through an API?

Thanks for your help!

From stackoverflow
  • I use NDepend for stuff like that. You can create CQL queries in NDepend and execute them.
    Example:

    SELECT METHODS  WHERE CC > 8
    

    returns the methods with a cyclomatic complexity greater than 8.

  • I don't -- does Visual Studio have any APIs of that sort? -- but computing cyclomatic complexity is reasonably easy. Gendarme might be your answer.

    Paco : Is Gendarme be good replacement for fxcop?

0 comments:

Post a Comment