psycofdj / coverxygen

Generate doxygen's documentation coverage report
GNU General Public License v3.0
49 stars 11 forks source link

How to ignore `#pragma once` from report #21

Closed zchrissirhcz closed 2 years ago

zchrissirhcz commented 2 years ago

Hi, coverxygen developers

I'm using doxygen together with coverxygen, lcov to generate document coverage report, for a very naive C++ header file. It confuse me by considering #pragma once as function, thus make wrong coverage percentage (25%, instead of expected 33%)

图片

图片

The source code I'm using is :

hello.h:

#pragma once

void nice();

void hello(const char* name);

/// @brief the int data version
void hello(int data);

The doxygen configuration file I'm using is

PROJECT_NAME = "MyProject"
EXTRACT_ALL = YES
HTML_TIMESTAMP = YES
RECURSIVE = YES

GENERATE_XML=YES
GENERATE_HTML=YES
GENERATE_LATEX=NO

GENERATE_LEGEND        = YES
INPUT = /home/zz/work/test/doxygen_example3/src/hello.h

The commands to generate document coverage report is:

#!/bin/bash
doxygen Doxyfile.in
python -m coverxygen --xml-dir ./xml --src-dir ../src --output doc-coverage.info --kind function
rm doc-coverage.info
lcov --summary doc-coverage.info
genhtml --no-function-coverage --no-branch-coverage doc-coverage.info -o .
echo "python -m http.server 7088"
zchrissirhcz commented 2 years ago

OK, figured out that I'm using the wrong order in the bash script. I should delete doc-coverage.info first, then generate it via coverxygen. i.e. use the corrected one:

#!/bin/bash
doxygen Doxyfile.in
rm doc-coverage.info
python -m coverxygen --xml-dir ./xml --src-dir ../src --output doc-coverage.info --kind function
lcov --summary doc-coverage.info
genhtml --no-function-coverage --no-branch-coverage doc-coverage.info -o .
echo "python -m http.server 7088"