From 557983d247fa3823ed541057b0b20c307e0a699d Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Tue, 6 Oct 2026 03:24:36 +0200 Subject: [PATCH] feat(qa): file sonar issues most valuable first (bugs before style findings) Co-Authored-By: Claude Sonnet 5.5 --- scripts/sonar_triage.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/sonar_triage.mjs b/scripts/sonar_triage.mjs index 68e572e..d6e9783 100644 --- a/scripts/sonar_triage.mjs +++ b/scripts/sonar_triage.mjs @@ -91,6 +91,12 @@ export function groupIssues(items, size = MAX_LOCATIONS) { title: `[sonar] ${rule}: ${(is[0].message || '').slice(0, 60).replace(/\s+/g, ' ')} in ${files} file(s)${tag}`.slice(0, 200) }); } } + // Most valuable first, so a capped run files bugs before style findings. + const TYPE_RANK = { BUG: 0, VULNERABILITY: 1, CODE_SMELL: 2 }; + const SEV_RANK = { BLOCKER: 0, CRITICAL: 1, MAJOR: 2, MINOR: 3, INFO: 4 }; + const NOISY = new Set(['javascript:S3358', 'python:S1192', 'python:S8415', 'javascript:S5850', 'python:S5850', 'javascript:S2189']); // triage: low value or probable false positive, file last + const rank = (g) => [NOISY.has(g.rule) ? 1 : 0, Math.min(...g.issues.map((i) => TYPE_RANK[i.type] ?? 3)), Math.min(...g.issues.map((i) => SEV_RANK[i.severity] ?? 5))]; + out.sort((a, b) => { const x = rank(a), y = rank(b); return x[0] - y[0] || x[1] - y[1] || x[2] - y[2] || a.rule.localeCompare(b.rule) || a.part - b.part; }); return out; }