mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 12:40:44 +00:00
manual rewrite of jacoco summary reporting shell lines
This commit is contained in:
11
pom.xml
11
pom.xml
@ -251,22 +251,19 @@ echo "------------------------------------------------------------"
|
||||
|
||||
# Parse Jacoco HTML coverage summary using grep and sed
|
||||
if [ -f target/site/jacoco/index.html ]; then
|
||||
echo "Element\nInstructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$.headers
|
||||
echo -e "Instructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$headers
|
||||
# Extract values from the footer row of the coverage table
|
||||
grep -A 12 '<tfoot>' target/site/jacoco/index.html | grep '<td>' | sed 's/<td>\([^<]*\)<\/td>/\1/' | tr '\n' '\t' | sed 's/\t$/\n/' > /tmp/$$.values
|
||||
sed 's/<\/\w\+>/&\n/g' target/site/jacoco/index.html | grep -A 12 '<tfoot>' | grep '<td' | sed 's/<td class="\w\+\d*">\([^<]*\)<\/td>/\1/' | grep -v Total > /tmp/$$.values
|
||||
paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}'
|
||||
rm /tmp/$$.headers /tmp/$$.values
|
||||
else
|
||||
echo "Jacoco coverage summary could not be parsed...";
|
||||
echo "Jacoco coverage summary was not found.";
|
||||
fi
|
||||
|
||||
echo "Untested classes, per Jacoco:"
|
||||
echo "-----------------------------"
|
||||
# Parse Jacoco XML reports directly to find classes with 0% coverage
|
||||
find target/site/jacoco -name "jacoco.xml" -exec grep -l '<counter type="LINE" missed="[1-9]' {} \; | while read xmlfile; do
|
||||
# Extract class names from XML files that have missed lines
|
||||
grep -A 1 '<class name=' "$xmlfile" | grep -B 1 '<counter type="LINE" missed="[1-9]' | grep '<class name=' | sed 's/.*name="\([^"]*\)".*/\1/' | sort -u
|
||||
done | sort -u
|
||||
sed 's/<classs .*\?>/&\n/g;s/<\/class>/&\n/g' target/site/jacoco/jacoco.xml | grep -v 'counter type="CLASS" missed="0"' | sed 's/>.*//;s/.*\///;s/".*//'
|
||||
echo
|
||||
|
||||
]]>
|
||||
|
Reference in New Issue
Block a user