Reputation: 60514
Is there a simple way to count how many functions, methods and/or classes there are in a library? And how many are documented? Maybe through Doxygen output?
When I try to Google a solution all I get is algorithms to count things... :)
Upvotes: 3
Views: 992
Reputation: 1180
There is a tool named Coverxygen which requires XML output from Doxygen.
Install it by:
pip install coverxygen
Bonus: If you use Sphinx and Doxygen (and Breathe) to generate documentations, you can use DocsCov to make a badge showing documentation coverage to show on your README.
Upvotes: 1
Reputation: 60514
As Xin Huang pointed out in a comment above, there is a useful tool called doxy-coverage.py
at https://github.com/alobbs/doxy-coverage. It prints, for each file documented with Doxygen, it prints how many entities it has (namespaces, free functions, classes, member functions, enums, #defines, etc) and how many of those are documented. It lists each of the non-documented entities. At the bottom it gives a summary of the documentation coverage (percent entities that are documented). It uses the XML output of Doxygen to do so.
I replaced the line
print("%d%% API documentation coverage" %(total_per))
by
print ('%3d%% API documentation coverage (%d of %d)'%(total_per, total_yes, total_all))
To add the total number of entities and total number of documented entities in the project.
It seems possible to modify the tool to distinguish entities by type. If I ever do this, I'll post the resulting code here.
Upvotes: 0