|
64 | 64 | } |
65 | 65 | console.log(`Posting report for PR #${prNumber}`); |
66 | 66 |
|
67 | | - const { parseJacocoXml, pct, zeroCov } = require('./.github/scripts/parse-jacoco.js'); |
| 67 | + const { parseJacocoXml, pct, zeroCov, isRegression } = require('./.github/scripts/parse-jacoco.js'); |
68 | 68 |
|
69 | 69 | const versions = ['java11', 'java17', 'java21', 'java25', 'jcstress']; |
70 | 70 | const zeroTest = { total: 0, passed: 0, failed: 0, errors: 0, skipped: 0 }; |
@@ -232,20 +232,25 @@ jobs: |
232 | 232 | return result.replace(/\$/g, '<br>\\$'); |
233 | 233 | } |
234 | 234 |
|
235 | | - function fmtClassDelta(delta) { |
236 | | - return fmtPctDelta(delta, 0); |
| 235 | + function fmtClassDelta(delta, currMissed, baseMissed) { |
| 236 | + if (Math.abs(delta) < 0.05) return '±0.0%'; |
| 237 | + const str = delta > 0 ? `+${delta.toFixed(1)}%` : `${delta.toFixed(1)}%`; |
| 238 | + if (delta > 0) return str + ' 🟢'; |
| 239 | + // Negative delta: use hybrid check — only 🔴 if missed count also increased |
| 240 | + if (currMissed !== undefined && baseMissed !== undefined && currMissed <= baseMissed) { |
| 241 | + return str + ' 🟡'; |
| 242 | + } |
| 243 | + return str + ' 🔴'; |
237 | 244 | } |
238 | 245 |
|
239 | 246 | // Build a method-level detail block for classes with coverage decreases. |
240 | 247 | // Uses method name+desc as a stable key to match between baseline and current. |
241 | 248 | function buildMethodDetails(c) { |
242 | 249 | if (c.removed) return ''; |
243 | | - // Use the same hybrid check as the coverage gate: percentage |
244 | | - // dropped AND absolute missed count increased. This avoids |
245 | | - // showing details for classes where code was merely extracted/moved. |
246 | | - const lineRegressed = c.lineDelta < -0.05 && c.currMissed.line > c.baseMissed.line; |
247 | | - const branchRegressed = c.branchDelta < -0.05 && c.currMissed.branch > c.baseMissed.branch; |
248 | | - const methodRegressed = c.methodDelta < -0.05 && c.currMissed.method > c.baseMissed.method; |
| 250 | + // Only show method details for true regressions (hybrid check) |
| 251 | + const lineRegressed = isRegression(c.linePct, c.linePct - c.lineDelta, c.currMissed.line, c.baseMissed.line); |
| 252 | + const branchRegressed = isRegression(c.branchPct, c.branchPct - c.branchDelta, c.currMissed.branch, c.baseMissed.branch); |
| 253 | + const methodRegressed = isRegression(c.methodPct, c.methodPct - c.methodDelta, c.currMissed.method, c.baseMissed.method); |
249 | 254 | if (!lineRegressed && !branchRegressed && !methodRegressed) return ''; |
250 | 255 |
|
251 | 256 | const currMethods = c.currMethods || []; |
@@ -328,7 +333,7 @@ jobs: |
328 | 333 | if (c.removed) { |
329 | 334 | body += `| ${shortenClass(c.name)} | *removed* | *removed* | *removed* |\n`; |
330 | 335 | } else { |
331 | | - body += `| ${shortenClass(c.name)} | ${fmtClassDelta(c.lineDelta)} | ${fmtClassDelta(c.branchDelta)} | ${fmtClassDelta(c.methodDelta)} |\n`; |
| 336 | + body += `| ${shortenClass(c.name)} | ${fmtClassDelta(c.lineDelta, c.currMissed.line, c.baseMissed.line)} | ${fmtClassDelta(c.branchDelta, c.currMissed.branch, c.baseMissed.branch)} | ${fmtClassDelta(c.methodDelta, c.currMissed.method, c.baseMissed.method)} |\n`; |
332 | 337 | } |
333 | 338 | } |
334 | 339 | body += '\n'; |
|
0 commit comments