MCPcopy Create free account
hub / github.com/openai/plugins / _code_evidence_lines

Function _code_evidence_lines

plugins/codex-security/scripts/report_projection.py:174–191  ·  view source on GitHub ↗
(evidence: list[dict[str, Any]])

Source from the content-addressed store, hash-verified

172
173
174def _code_evidence_lines(evidence: list[dict[str, Any]]) -> list[str]:
175 lines: list[str] = []
176 for index, item in enumerate(evidence):
177 label = _text(item.get("label"), f"Code evidence {index + 1}")
178 location = _text(_code_evidence_location(item), "")
179 explanation = _text(item.get("explanation"), "")
180 language = item.get("language") if isinstance(item.get("language"), str) else ""
181 language = language if re.fullmatch(r"[A-Za-z0-9_+.-]*", language) else ""
182 code = item["code"]
183 fence = _code_fence(code)
184 heading = f"**{label}**"
185 if location:
186 heading += f" — `{location}`"
187 lines.extend(["", heading])
188 if explanation:
189 lines.extend(["", explanation])
190 lines.extend(["", f"{fence}{language}", code, fence])
191 return lines
192
193
194def _severity_mix(findings: list[dict[str, Any]]) -> str:

Callers 1

_finding_sectionFunction · 0.85

Calls 5

_textFunction · 0.85
_code_evidence_locationFunction · 0.85
_code_fenceFunction · 0.85
extendMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected