code-coveragegcovgcovr

No colours in gcovr 5.0 --html-details report


I've been using the gcovr module for monthly report generation. I work on docker, so each time I used to download the gcovr module using pip3 command on my Linux container. Recently, after downloading the module, I realized that the version of the gcovr has been upgraded from 4.2 to 5.0 and the earlier commands were not working properly.

Earlier command used for report generation:

gcovr -g --keep --html-details --html-title "TITLE" --html-medium-threshold 60 --html-high-threshold 80 --gcov-ignore-parse-errors >> report.html

With gcovr 5.0, usage of the above command threw below error:

(ERROR) a named output must be given,if the option --html-details is used

Then, as per the suggestions from the above error, I used the command below:

gcovr -g --keep --html-details -o report.html --html-title "TITLE" --html-medium-threshold 60 --html-high-threshold 80 --gcov-ignore-parse-errors

But, I believe the above command is not fully correct and with the above command, the format of the report generated is not correct and also there are a lot of unwanted *.css files getting generated in the respective folders.

As you can see from the image below, the colour is not getting highlighted as per the percentage defined in "Legend":

gcovr 5.0 report:


Solution

  • The --html-details report format generates one HTML file per source file, and an index file. Since gcovr 5.0, their shared CSS is stored as a separate file. This is important for the security configuration of some web servers.

    Additional remarks: