MCPcopy Index your code
hub / github.com/github/awesome-copilot / normalizeFinding

Function normalizeFinding

extensions/java-modernization-studio/scan.mjs:108–126  ·  view source on GitHub ↗
(f, idx)

Source from the content-addressed store, hash-verified

106 return SEVERITY_ALIASES[sev.trim().toLowerCase()] || "P3";
107}
108function 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}
127function normalizeReport(raw) {
128 if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
129 const findingsIn = Array.isArray(raw.findings) ? raw.findings : [];

Callers 1

normalizeReportFunction · 0.85

Calls 1

normalizeSeverityFunction · 0.85

Tested by

no test coverage detected