How to compute metrics of C++ project using CCCC
CCCC (C and C++ Code Counter) is a little command-line tool that generates metrics from the source code of a C or C++ project. The output of the tool is a simple HTML website with information about all your sources.
CCCC generates not only information about the number of lines of codes for each of your modules, but also complexity metrics like the McCabe Cyclomatic Complexity level of your modules and functions, design metrics like the coupling between the modules or object oriented metrics like the depth of inheritance tree for each of your classes, ...
Installation
On some Linux systems, cccc is already packaged, so you just have to use your favourite package manager to install it. On Ubuntu, I used :
sudo apt-get install cccc
to install it. If the tool is not packaged for your system, you can download it here. Then, you have run the build script :
sh build_posixgcc.sh
and you will find a cccc executable in the cccc folder. You can just put the executable in your path or use it using the absolute path.
Usage
The usage of the tool is really easy. You just have to invoke it passing all the sources files you want to parse as arguments. For example:
cccc src/*.cpp include/*.hpp
And the site will be generated in a .cccc folder in the current folder. You can also specify the output directory using the --outdir=folder option.
The main entry of the HTML generated website is the cccc.html file. You can find plenty of information in this generated website about the verified project.
You can find more information about the tool on the official website : http://cccc.sourceforge.net/
Comments
Comments powered by Disqus