Triage new SonarQube issues on a PR before review
何時使用: A PR has 15 new Sonar findings. You want a 30-second summary: what's must-fix vs nitpick.
前置條件
- Sonar token with Execute Analysis + Browse — Sonar UI → Account → Security → Generate token
- Project key — Sonar project URL: /dashboard?id=<key>
步驟
-
Pull new-code issues for the branchList issues for project <key>, branch <pr-branch>, sinceLeakPeriod=true. Group by severity.✓ 已複製→ New findings grouped
-
Classify fix-worthinessFor each BLOCKER/CRITICAL, show the file:line and rule. Mark which look like real bugs vs noise.✓ 已複製→ Triage list
-
Draft fix suggestionsFor the real bugs, fetch the source snippet via the filesystem MCP and propose a minimal patch for each.✓ 已複製→ Per-issue diff suggestions
結果: A 1-screen PR triage with exactly the 3 things the reviewer should care about.
注意事項
- Low-severity 'smells' drown out real bugs — Always filter severities to BLOCKER,CRITICAL,MAJOR for triage; MINOR/INFO in a separate batch