(f, idx)
| 106 | return SEVERITY_ALIASES[sev.trim().toLowerCase()] || "P3"; |
| 107 | } |
| 108 | function normalizeFinding(f, idx) { |
| 109 | if (!f || typeof f !== "object" || Array.isArray(f)) return null; |
| 110 | let files = []; |
| 111 | if (typeof f.files === "string") files = f.files ? [f.files] : []; |
| 112 | else if (Array.isArray(f.files)) files = f.files.filter((x) => typeof x === "string"); |
| 113 | const title = |
| 114 | (typeof f.title === "string" && f.title.trim()) || |
| 115 | (typeof f.id === "string" && f.id.trim()) || |
| 116 | "Untitled finding"; |
| 117 | const out = { |
| 118 | id: typeof f.id === "string" && f.id ? f.id : "finding-" + (idx + 1), |
| 119 | severity: normalizeSeverity(f.severity), |
| 120 | title, |
| 121 | detail: typeof f.detail === "string" ? f.detail : "", |
| 122 | files, |
| 123 | }; |
| 124 | if (f.action && typeof f.action === "object" && !Array.isArray(f.action)) out.action = f.action; |
| 125 | return out; |
| 126 | } |
| 127 | function normalizeReport(raw) { |
| 128 | if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null; |
| 129 | const findingsIn = Array.isArray(raw.findings) ? raw.findings : []; |
no test coverage detected