refactor(domain): bound a first batch of constant-maximum slices with boundedList (#11296)

* refactor(domain): bound a first batch of constant-maximum slices with boundedList

* fix(domain): describe a bounded list with nothing retained without a leading separator

* refactor(domain): bound eleven counted list samples through boundedList (#11421)

Desktop state differences, guidance subsection pointers, native output contract issues, APK v1 duplicate-name samples, environment write refusals, desktop build action logs and credential-named saved-value pointers already reported a count or a cut beside a sliced list; the slice and the count now come from one boundedList. constant-maximum-slice: 54 -> 43.
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 04:24:58 +08:00
1 parent 66ec6a7261
commit 673050f7bc
18 files changed
+130 -86

No files matched your search

@@ -1,3 +1,4 @@
import { boundedList } from "../../domain/boundedList.js";
import { createHash } from "node:crypto";
import { posix } from "node:path";
@@ -725,10 +726,13 @@ export const htmlInlineScriptLimitation = ({
script_count: count,
scripts,
}: JavaScriptHtmlInlineScriptsObservation): string => {
const lines = scripts
.slice(0, HTML_INLINE_SCRIPT_LIMITATION_LINES)
.map(({ location }) => String(location.start.line));
const unnamed = count - lines.length;
const listed = boundedList(
scripts.map(({ location }) => String(location.start.line)),
HTML_INLINE_SCRIPT_LIMITATION_LINES,
count - scripts.length,
);
const lines = listed.items;
const unnamed = listed.omitted;
const one = count === 1;
return `${path} has ${String(count)} inline JavaScript ${one ? "body" : "bodies"} starting at line${one ? "" : "s"} ${lines.join(", ")}${unnamed > 0 ? ` and ${String(unnamed)} more` : ""} that ${one ? "was" : "were"} not analyzed; endpoints, storage, imports and other facts in ${one ? "it" : "them"} are absent from the evidence.`;
};