📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -44,8 +44,12 @@ const EMOJI_SEVERITY = { "🔴": "critical", "🟡": "warning", "🟢": "suggest
|
||||
// A path with a directory separator, or a bare filename with a known source
|
||||
// extension — optionally followed by `:line`. The extension allowlist keeps
|
||||
// prose like "e.g." or "i.e." from being mistaken for a file reference.
|
||||
// Within a shared prefix the longer extension must come first (`exs` before
|
||||
// `ex`, `cljs` before `clj`) so JS alternation doesn't stop at the short one;
|
||||
// the newer extensions lead the list so a bare `c`/`h`/`m` can't shadow `cr`/
|
||||
// `hs`/`ml`.
|
||||
const LOCATION_RE =
|
||||
/([\w.-]*\/[\w./-]*\.\w+|[\w.-]+\.(?:ts|tsx|js|jsx|mjs|cjs|py|java|go|rb|rs|cc|cpp|cxx|c|h|hpp|cs|php|kt|kts|swift|scala|vue|sql|rsx|m|mm))(?::(\d+))?/;
|
||||
/([\w.-]*\/[\w./-]*\.\w+|[\w.-]+\.(?:astro|cljc|cljs|clj|cr|dart|elm|erl|exs|ex|fsx|fs|gradle|groovy|hs|jl|lua|mli|ml|nim|pl|pm|proto|sol|svelte|tf|zig|ts|tsx|js|jsx|mjs|cjs|py|java|go|rb|rs|cc|cpp|cxx|c|h|hpp|cs|php|kt|kts|swift|scala|vue|sql|rsx|m|mm))(?::(\d+))?/;
|
||||
|
||||
function splitTitle(bold) {
|
||||
// Dash is the template separator; a colon is a common LLM variant. `.match`
|
||||
|
||||
@@ -659,6 +659,21 @@ test("does not mistake prose for a file reference", () => {
|
||||
assert.deepEqual(extractLocation("see line 3 (i.e. nowhere)"), { file: null, line: null });
|
||||
});
|
||||
|
||||
// Bare filenames (no `/`) exercise the extension allowlist; a path with a
|
||||
// slash would match the first branch's generic `.\w+` regardless of the list.
|
||||
test("captures newer-language extensions from bare filenames", () => {
|
||||
assert.deepEqual(extractLocation("bug in user.ex:42"), { file: "user.ex", line: 42 });
|
||||
assert.deepEqual(extractLocation("see main.dart"), { file: "main.dart", line: null });
|
||||
assert.deepEqual(extractLocation("main.tf drifts"), { file: "main.tf", line: null });
|
||||
});
|
||||
|
||||
test("prefers the longer of two prefix-sharing extensions", () => {
|
||||
// A bare `ex`/`clj`/`ml` must not truncate `.exs`/`.cljs`/`.mli`.
|
||||
assert.equal(extractLocation("runtime.exs boots the app").file, "runtime.exs");
|
||||
assert.equal(extractLocation("core.cljs mounts").file, "core.cljs");
|
||||
assert.equal(extractLocation("parser.mli exports").file, "parser.mli");
|
||||
});
|
||||
|
||||
// ── sarif: reportToSarif ───────────────────────────────────────────────────
|
||||
|
||||
console.log("\nreportToSarif");
|
||||
|
||||
Reference in New Issue
Block a user