Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
config: |
paths-ignore:
- dist/**
- scripts/**
- uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
with:
category: "/language:javascript-typescript"
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39061,7 +39061,10 @@ function stringifyCell(v) {
/** Escape + truncate a value to fit inside a markdown table cell. */
function cell(v, maxLen = CELL_MAX) {
let s = stringifyCell(v);
s = s.replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
s = s
.replace(/\\/g, "\\\\")
.replace(/\|/g, "\\|")
.replace(/[\r\n]+/g, " ");
if (s.length > maxLen)
s = s.slice(0, maxLen - 1) + "…";
return s || "—";
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@

/** Escape + truncate a value to fit inside a markdown table cell. */
function cell(v: unknown, maxLen = CELL_MAX): string {
let s = stringifyCell(v);
s = s.replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
s = s
.replace(/\\/g, "\\\\")
.replace(/\|/g, "\\|")
.replace(/[\r\n]+/g, " ");
if (s.length > maxLen) s = s.slice(0, maxLen - 1) + "…";
return s || "—";

Check warning on line 113 in src/comment.ts

View check run for this annotation

Claude / Claude Code Review

Truncation can leave dangling backslash before ellipsis

In `cell()` (src/comment.ts:107-113), escaping is applied before length-based truncation, so `s.slice(0, maxLen - 1)` can split a two-character escape sequence (`\\\\` or `\\|`), leaving a dangling backslash before the appended `…`. This PR's new `\\` → `\\\\` rule widens the surface area (literal backslashes near the boundary now also trigger it). Cosmetic only — tables don't structurally break — but rendered cells show a stray `\\` before the ellipsis. Fix by truncating before escaping (then r
Comment thread
wochinge marked this conversation as resolved.
Outdated
}

function formatScore(v: NormalizedExperimentResult["runEvaluations"][number]["value"]): string {
Expand Down
Loading