Get rid of absolute paths from a coverage.xml report created with cover.py

Is there a way to get the relative paths given in cover.xml (or abort the prefix) using cover.py?

+6
source share
1 answer

I managed to cope only with console output. The bash code below will expand "../myrootmodule" and remove it from the output of the coverage. It will also adjust spaces to maintain column alignment. You must configure the myrootmodule path (first line only).

prefix="$$(readlink -e $$(dirname $$(pwd)))/myrootmodule/"; \ coverage report \ | sed "s|$$prefix||" \ | sed "s/^-\{$${#prefix}\}//" \ | sed "s/^Name \{$${#prefix}\}/Name/" \ | sed "s/^TOTAL \{$${#prefix}\}/TOTAL/" 

How big it is, I include it in test / Makefile.

0
source

Source: https://habr.com/ru/post/957590/


All Articles