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 !!!
source share