0

Calculate Cyclomatic Complexity using c# code. I am developing an application, that will take solution name from user and will show cyclomatic complexity of that solution in c#. please help me. I am taking solution name from the user and i have to show the cyclomatic complexity list to the user. how can i do this?

Priya Rani
  • 17
  • 1
  • 6
  • You search for an application you intend to write? That doesn't make sense. – PMF Apr 16 '21 at 07:58
  • Questions asking for recommendations for certain software are off-topic, but I can tell you that there already exist visual studio extensions for that purpose. – PMF Apr 16 '21 at 07:59
  • i know that there is visual studio extensons for this purpose, but i have to do it using code. if you can help ? – Priya Rani Apr 16 '21 at 08:12
  • like if any how i can write some code that will pass the solution name as input and open that tool, and then by going through the report generated, i can show the list of functions and classes that are having more than 5 cyclomatic complexity. this is my task. – Priya Rani Apr 16 '21 at 08:15
  • Which part do you need to write? The calculation of the complexity or displaying the results in VS? Please be more specific. Nobody will write a whole application for you here. – PMF Apr 16 '21 at 08:49
  • calculation of complexity – Priya Rani Apr 19 '21 at 03:55

1 Answers1

0

Microsoft.CodeAnalysis.Metrics NuGet package could provide many useful metrics including CyclomaticComplexity.

Moni
  • 16
  • 2
  • Welcome to Sstackoverflow, please search the site before asking a question, Someone may have asked this or a similar question before you. – isaeid Apr 16 '21 at 09:07
  • Thanks, this worked, but i did it using Metrics.exe https://learn.microsoft.com/en-us/visualstudio/code-quality/how-to-generate-code-metrics-data?view=vs-2019 through command line. and it was successful. – Priya Rani Apr 21 '21 at 04:07