>

Articles → .NET → Cyclomatic complexity using Visual Studio

Cyclomatic complexity using Visual Studio






What is cyclomatic complexity?






int x = Convert.ToInt32(Console.ReadLine());
if (x % 2 == 0)	
   Console.WriteLine("Even");
else
   Console.WriteLine("Odd");




Picture showing the execution workflow of the code

Click to Enlarge




Significance of cyclomatic complexity




Cyclomatic ComplexityRisk Evaluation
1 to 10A simple program, without much risk
11 to 20More complex, moderate risk
21 to 50Complex, high-risk program
Greater than 50Untestable program (very high risk)



How to calculate cyclomatic complexity using visual studio








Picture showing the option of calculating the cyclomatic complexity in visual studio

Click to Enlarge



Picture showing the result of cyclomatic complexity in visual studio

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Sunday, February 7, 2016

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250