* Baseline diff (the PVS-Studio "only flag NEW code" idea). Given the diagnostics * that existed BEFORE the agent touched anything (`baseline`) and the ones present * now (`current`), return only the genuinely NEW ones. Matched by file+code+message * (NOT line number, which shifts when the agent
(d: Diagnostic)
| 74 | * it worse" — exactly what you want from an automated gate. |
| 75 | */ |
| 76 | function diagSignature(d: Diagnostic): string { |
| 77 | return `${d.file}|${d.code ?? ''}|${d.message.trim().toLowerCase()}`; |
| 78 | } |
| 79 | export function diffDiagnostics(baseline: Diagnostic[], current: Diagnostic[]): Diagnostic[] { |
| 80 | const counts = new Map<string, number>(); |
| 81 | for (const d of baseline) { |