Skip to content

Commit 59bf952

Browse files
committed
fix pr
1 parent 8c8da62 commit 59bf952

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,26 @@ jobs:
6868
CX_TENANT: ${{ secrets.CX_TENANT }}
6969
CX_APIKEY: ${{ secrets.CX_APIKEY }}
7070

71-
- name: Print total coverage percentage
71+
- name: Print filtered coverage percentage
7272
run: |
73-
COVERED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@covered)" target/site/jacoco/jacoco.xml)
74-
MISSED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@missed)" target/site/jacoco/jacoco.xml)
73+
COVERED_LINES=$(xmllint --xpath "sum(//report/package[not(matches(@name, 'com.checkmarx.ast.(results|kicsRealtimeResults|asca|learnMore|predicate|scan|codebashing|remediation|project|tenant)'))]/counter[@type='LINE']/@covered)" target/site/jacoco/jacoco.xml)
74+
MISSED_LINES=$(xmllint --xpath "sum(//report/package[not(matches(@name, 'com.checkmarx.ast.(results|kicsRealtimeResults|asca|learnMore|predicate|scan|codebashing|remediation|project|tenant)'))]/counter[@type='LINE']/@missed)" target/site/jacoco/jacoco.xml)
75+
76+
if [ -z "$COVERED_LINES" ] || [ -z "$MISSED_LINES" ]; then
77+
echo "Error: Could not extract coverage data from jacoco.xml"
78+
exit 1
79+
fi
80+
7581
TOTAL_LINES=$((COVERED_LINES + MISSED_LINES))
76-
COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERED_LINES / $TOTAL_LINES * 100" | bc)
77-
echo "Total coverage percentage: $COVERAGE_PERCENTAGE%"
82+
83+
if [ "$TOTAL_LINES" -eq 0 ]; then
84+
COVERAGE_PERCENTAGE=0
85+
else
86+
COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERED_LINES / $TOTAL_LINES * 100" | bc)
87+
fi
88+
89+
echo "Filtered coverage percentage: $COVERAGE_PERCENTAGE%"
90+
7891

7992
- name: Generate JaCoCo Badge
8093
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0

pom.xml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,22 @@
8080
</goals>
8181
<configuration>
8282
<excludes>
83-
<exclude>**/com/checkmarx/ast/results/**/*.class</exclude>
84-
<exclude>**/com/checkmarx/ast/kicsRealtimeResults/**/*.class</exclude>
85-
<exclude>**/com/checkmarx/ast/asca/**/*.class</exclude>
86-
<exclude>**/com/checkmarx/ast/learnMore/**/*.class</exclude>
87-
<exclude>**/com/checkmarx/ast/predicate/**/*.class</exclude>
88-
<exclude>**/com/checkmarx/ast/scan/**/*.class</exclude>
89-
<exclude>**/com/checkmarx/ast/codebashing/**/*.class</exclude>
90-
<exclude>**/com/checkmarx/ast/remediation/**/*.class</exclude>
91-
<exclude>**/com/checkmarx/ast/project/**/*.class</exclude>
92-
<exclude>**/com/checkmarx/ast/tenant/**/*.class</exclude>
93-
<exclude>**/com/checkmarx/ast/wrapper/Execution**/*.class</exclude>
83+
<exclude>com/checkmarx/ast/results/**</exclude>
84+
<exclude>com/checkmarx/ast/results/result/**</exclude>
85+
<exclude>com/checkmarx/ast/kicsRealtimeResults/**</exclude>
86+
<exclude>com/checkmarx/ast/kicsRealtimeResults/ast/kicsRealtimeResult/**</exclude>
87+
<exclude>com/checkmarx/ast/asca/**</exclude>
88+
<exclude>com/checkmarx/ast/learnMore/**</exclude>
89+
<exclude>com/checkmarx/ast/predicate/**</exclude>
90+
<exclude>com/checkmarx/ast/scan/**</exclude>
91+
<exclude>com/checkmarx/ast/codebashing/**</exclude>
92+
<exclude>com/checkmarx/ast/remediation/**</exclude>
93+
<exclude>com/checkmarx/ast/project/**</exclude>
94+
<exclude>com/checkmarx/ast/tenant/**</exclude>
95+
<exclude>com/checkmarx/ast/wrapper/Execution**</exclude>
9496
</excludes>
9597

98+
9699
</configuration>
97100
</execution>
98101
</executions>

0 commit comments

Comments
 (0)