Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cyclomatic complexity for Visual Studio 2008

Is there any tool for showing the cyclomatic complexity for Visual Studio in the left hand bar where the debug symbol goes?

I seem to remember there was an addin for Resharper but don't think it works in 4.5

Has anyone seen any similar tools, other than the built in support in VS

like image 420
Kev Hunter Avatar asked May 16 '09 22:05

Kev Hunter


People also ask

What is cyclomatic complexity in Visual Studio?

Cyclomatic Complexity - Measures the structural complexity of the code. It is created by calculating the number of different code paths in the flow of the program. A program that has complex control flow requires more tests to achieve good code coverage and is less maintainable.

What is acceptable cyclomatic complexity?

For most routines, a cyclomatic complexity below 4 is considered good; a cyclomatic complexity between 5 and 7 is considered medium complexity, between 8 and 10 is high complexity, and above that is extreme complexity. We could easily refactor this function to reduce overall cyclomatic complexity.

How does Visual Studio calculate time complexity?

From Visual Studio's menu, select Analyze -> Calculate Code Metrics. Then, either select “For Solution”, if you want check all the projects in the solution, or select the project you want. The results will be displayed in the Output window. Visual Studio shows the cyclomatic complexity for each function and property.

How do you calculate cyclomatic complexity?

Apply formulas in order to compute Cyclomatic complexity. 3) Cyclomatic complexity V(G) = P +1 V (G) = 2 + 1 = 3 Where P is predicate nodes (node 1 and node 2) are predicate nodes because from these nodes only the decision of which path is to be followed is taken. Thus Cyclomatic complexity is 3 for given code.


1 Answers

A standalone tool with lots of metrics (including cc) is ndepend.

like image 161
tanascius Avatar answered Oct 17 '22 09:10

tanascius