Define SLOC and the complexity of C # and C ++ from .NET.

I have been using SourceMonitor in my project for a couple of years to keep track of the complexity of the source code and the underlying SLOC (including comments) for the C # and C ++ components. They are used for external reporting to our customers, so I can not affirm their strengths or weaknesses.

I am working on a repository analysis tool that can give me an instant view of a project any day / time. The next step I want to add is caching metrics for the specified file and revision.

I know that SourceMonitor can be a script so that I can provide files for testing and capture metrics from a CSV or XML result file.

Is there a built-in library in .NET that I could use to perform the same action - for example, avoid the appearance of an external process and analysis of the results.

I really only need the following indicators:

  • SLOC
  • Number of comment lines
  • The complexity of the most complex method
  • Name of the most complex method

I need to run this C # code and normal C ++ code .

Edit: since I already have a tool that provides the graphical interface and reports that I want, metrics should be written or generated using the library / API without manual steps. Ideally, I want to get metrics for the specified file / version (and not the whole project), which my utility automatically drags from version control.

NOTE. I created generosity for this and was on vacation when it expired ... NDepends answer DOES NOT satisfy me, because it does not look at the source code, but the assembly itself !!!

+4
source share
5 answers

While I never found a .NET product that can parse C # and C ++ the same way, I managed to find an easy-to-use product, CODECOUNT , which supports these languages ​​and many others.

It has a simple command line, unlike SourceMonitor, which was used in my project until CODECOUNT replaced it.

0
source
+2
source
+2
source

Reliable command line tool for calculating SLOC Cloc . It supports many languages, including C # and C ++. Supported output formats: xml, csv and sql.

+1
source

This will not give you complexities with functions and is not a script (what I know), but SlickEdit Gadgets for VS has an excellent SLOC reporting tool and you can use it from the solution explorer and you will get a detailed report at the file, project or solution level.

You can get it here: http://www.slickedit.com/content/view/441

0
source

Source: https://habr.com/ru/post/1277167/


All Articles