Sunday 20 October 2019

Code metrics tools for C++

This issue makes me somewhat annoyed when I think about it. Visual Studio doesn't have code metrics for "unmanaged" code which is C and C++ in particular. The reason must be that Microsoft doesn't really care about C++. They have to keep it for the vast amount of programs still written in C++ including game development, but there is less effort to include tools like metrics.

As far as I have searched there isn't a simple, free metrics plugin for Visual Studio, so there is that, too. There are some external metrics tools, but they seem like total overkill for what I'm looking for. I just would like to know how many lines of code the project has without running some external program. Visual Studio already knows how many lines an individual file has and how many classes etc. are in the project. It would be quite simple to collect that information and display it.

Programming a code metrics tool isn't impossible, but it takes some time and parsing C++ can be difficult sometimes, if you want to extract anything else than physical lines of code. I have written a parser that can find classes from a C++ file, so it would be a start. Maybe if I already didn't have tons of more important projects to do.

How about writing a plugin for Visual Studio? I don't know anything about it. How it's done etc. It can't be too easy, otherwise there would be a plugin to display C++ metrics I guess. Then again, maybe this is a non-issue in a sense that why would you want to know about the metrics of the project?

No comments: