MCPcopy
hub / github.com/openai/codex-plugin-cc / normalizeReviewFinding

Function normalizeReviewFinding

plugins/codex/scripts/lib/render.mjs:43–60  ·  view source on GitHub ↗
(finding, index)

Source from the content-addressed store, hash-verified

41}
42
43function normalizeReviewFinding(finding, index) {
44 const source = finding && typeof finding === "object" && !Array.isArray(finding) ? finding : {};
45 const lineStart = Number.isInteger(source.line_start) && source.line_start > 0 ? source.line_start : null;
46 const lineEnd =
47 Number.isInteger(source.line_end) && source.line_end > 0 && (!lineStart || source.line_end >= lineStart)
48 ? source.line_end
49 : lineStart;
50
51 return {
52 severity: typeof source.severity === "string" && source.severity.trim() ? source.severity.trim() : "low",
53 title: typeof source.title === "string" && source.title.trim() ? source.title.trim() : `Finding ${index + 1}`,
54 body: typeof source.body === "string" && source.body.trim() ? source.body.trim() : "No details provided.",
55 file: typeof source.file === "string" && source.file.trim() ? source.file.trim() : "unknown",
56 line_start: lineStart,
57 line_end: lineEnd,
58 recommendation: typeof source.recommendation === "string" ? source.recommendation.trim() : ""
59 };
60}
61
62function normalizeReviewResultData(data) {
63 return {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected