Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/review/content-lane/security-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ const PIPED_INSTALL_RE = /\b(?:curl|wget)\b[^\n|]*\|\s*(?:sudo\s+)?(?:sh|bash|zs
function firstLineMatching(text: string, re: RegExp): { n: number; text: string } | null {
const lines = text.split(/\r?\n/);
for (let i = 0; i < lines.length; i += 1) {
if (re.test(lines[i] ?? "")) return { n: i + 1, text: (lines[i] ?? "").trim().slice(0, 160) };
// `?? ""` only exists to satisfy noUncheckedIndexedAccess -- the loop bound above guarantees lines[i] is
// always defined here (`.split()` never produces holes), so the fallback branch is unreachable in practice.
/* v8 ignore next */
const line = lines[i] ?? "";
if (re.test(line)) return { n: i + 1, text: line.trim().slice(0, 160) };
}
return null;
}
Expand Down