Skip to content

psycofdj/coverxygen

Repository files navigation

Table of Contents

Coverxygen

Continuous Integration Coverage Status

How to

First, run doxygen with XML output on your project, Coverxygen will read generated file and produce an lcov compatible output. Finally, run lcov or genhtml to produce the coverage output.

Alternatively, Coverxygen can also calculate the coverage and print a summary table when given the option --format summary.

Prerequisites

Coverxygen relies on doxygen to generate the documentation information.

sudo apt-get install doxygen

Additionally, if you want to generate coverage reports using lcov, this needs to be installed as well:

sudo apt-get install lcov

Installation

From pip

pip3 install coverxygen

From PPA Packages

link : https://launchpad.net/~psycofdj/+archive/ubuntu/coverxygen

sudo add-apt-repository ppa:psycofdj/coverxygen
sudo apt-get update
sudo apt-get install python3-coverxygen

Configure doxygen

Tell doxygen to generate an XML version of your doxyfile.cfg configuration

GENERATE_XML = YES

Then run doxygen

doxygen <path_to_your_doxygen.cfg>

Run Coverxygen

python3 -m coverxygen --xml-dir <path_to_doxygen_xml_dir> --src-dir <path_to_root_source_dir> --output doc-coverage.info

Full usage :

usage: coverxygen [-h] [--version] [--verbose] [--json] [--format FORMAT] [--prefix PREFIX] [--exclude EXCLUDE] [--include INCLUDE]
                  [--excludesymbols EXCLUDESYMBOLS] [--scope SCOPE] [--kind KIND] --xml-dir XML_DIR --output OUTPUT --src-dir SRC_DIR

required arguments:
  --xml-dir XML_DIR     path to generated doxygen XML directory
  --output OUTPUT       destination output file (- for stdout)
  --src-dir SRC_DIR     root source directory used to match prefix for relative path generated files

optional arguments:
  -h, --help            show this help message and exit
  --version             print version and exit
  --verbose             enabled verbose output
  --json                (deprecated) same as --format json-legacy
  --format FORMAT       output file format :
                        lcov             : lcov compatible format (default)
                        json-v3          : json format which includes summary information
                        json-v2          : simpler json format
                        json-v1          : legacy json format
                        json             : (deprecated) same as json-v2
                        json-legacy      : (deprecated) same as json-v1
                        json-summary     : summary in json format
                        markdown-summary : summary in markdown table format
                        summary          : textual summary table format
  --prefix PREFIX       keep only file matching given path prefix
  --exclude EXCLUDE     exclude files whose absolute path matches the given regular expression <EXLUDE>;
                        this option can be given multiple times
  --include INCLUDE     include files whose absolute path matches the given regular expression <INCLUDE>
                        even if they also match an exclude filter (see --exclude) or if they
                        are not matching the patch prefix (see --prefix);
                        this option can be given multiple times
  --excludesymbols EXCLUDESYMBOLS
                        exclude symbols which match the given regular expression <EXCLUDESYMBOLS>
                        note that symbols are only matched against their fully qualified name if such is
                        used in the regex. Also, Doxygen uses the "ref with var" convention (`int &a`);
                        this option can be given multiple times
  --scope SCOPE         comma-separated list of item scopes to include :
                         - public    : public member and global elements
                         - protected : protected member elements
                         - private   : private member elements
                         - all       : all above
  --kind KIND           comma-separated list of item types to include : 
                         - enum      : enum definitions
                         - enumvalue : enum value definitions
                                       Note: a single undocumented enum value will mark
                                       the containing enum as undocumented
                         - friend    : friend declarations
                         - typedef   : type definitions
                         - variable  : variable definitions
                         - function  : function definitions
                         - signal    : Qt signal definitions
                         - slot      : Qt slot definitions
                         - class     : class definitions
                         - struct    : struct definitions
                         - union     : union definitions
                         - define    : define definitions
                         - file      : files
                         - namespace : namespace definitions
                         - page      : documentation pages
                         - all       : all above

Run lcov or genhtml

lcov can be used to generate a simple console output based on documented lines :

lcov --summary doc-coverage.info

More interesting, produce a html-browsable coverage detail :

genhtml --no-function-coverage --no-branch-coverage doc-coverage.info -o .
# browse results in index.html

Results

summary Format

Classes    :  90.5% (38/42)
Defines    :   0.0% (0/2)
Enum Values:  12.3% (8/65)
Enums      :  75.0% (3/4)
Files      :   8.3% (2/24)
Functions  :  64.8% (175/270)
Namespaces :  75.0% (6/8)
Pages      : 100.0% (7/7)
Signals    :  83.3% (5/6)
Slots      :  28.6% (2/7)
Structs    :  80.0% (4/5)
Typedefs   :  39.1% (9/23)
Variables  :  20.0% (8/40)
-----------------------------------
Total      :  53.1% (267/503)

lcov

Overview

Summary

Details

Details

Credits

Special thanks to Alvaro Lopez Ortega <alvaro@gnu.org> who found a smart and efficient solution to retrieve doxygen informations from the generated xml.

You can find his work at alobbs/doxy-coverage

Hall of Fame

Project status

Unstable but usable. PyPI version

About

Generate doxygen's documentation coverage report

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 9

Languages