Repository navigation
feat(rules): add content/placeholder-text, template leftovers in visible copy - #214
Merged
Merged
Conversation
This was referenced Sep 6, 2026
nc9
force-pushed
the
feat/1350-content-placeholder-text
branch
from
September 6, 2026 03:59
f410bd6 to
9f83168
Compare
…ble copy
Six families of "never meant to be read": lorem ipsum, theme boilerplate,
unrendered template syntax ({{ }}, {% %}, <% %>, ${ }, [[ ]]), [object X],
stringified JavaScript values, and TODO/FIXME/XXX markers.
Every family is also a legitimate thing for a page to QUOTE, so precision does
the work:
- prose only, via a new getRenderedProseText that drops script/style/noscript,
code/pre/samp/kbd, <template>, and the container classes of in-page code
editors (CodeMirror and Monaco render no <pre> or <code> at all)
- text is read with a line break at every block boundary, so a value alone in a
table cell is seen as alone on its line
- undefined/null/NaN must sit where a VALUE sits: alone on its line, or after a
label such as ":" or ">". A comma is not a label, so "Accepts a string, null,
or undefined" is prose; neither is a pipe, so a TypeScript union is prose
- lorem needs three distinct markers or "dolor sit amet". The bigram alone is
never enough, or every "Lorem ipsum explained" heading would fire
- boilerplate matches whole-word phrases only, and drops "placeholder text" and
"example text", which are the ordinary way to name the subject
- TODO/FIXME in annotation form; XXX needs a comment sigil, because "Super Bowl
XXX:" fits annotation form exactly
Severity follows certainty: lorem, template syntax and [object X] fail, because
nothing legitimate produces them. The bare words warn, because an API reference
whose defaults column reads null is ordinary and text alone cannot tell it from
a value that failed to render.
collectTextExcluding gains an optional isBoundary predicate (default off, no
existing caller affected). Golden findings 98221 -> 98721 (+500, one passing
page check per fixture page) and perRuleTally 279 -> 280.
Smoked against vuejs.org, handlebarsjs.com, shopify.dev's Liquid reference,
jinja, astro, tailwind, MDN and Wikipedia: all clean except pages whose subject
IS one of these values, which warn, and the Lorem ipsum article itself.
Refs squirrelscan/repo#1350
Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
feat/1350-content-placeholder-text
branch
from
September 6, 2026 23:08
9f83168 to
f807949
Compare
nc9
pushed a commit
that referenced
this pull request
Sep 6, 2026
Rebase onto content/placeholder-text (#214). Three things needed a decision rather than a mechanical resolution. Both branches bumped the published counts 279 -> 280 with byte-identical edits, so git merged them as one change and no conflict was raised. The live loader now returns 281 rules and 20 content rules while every literal still said 280 and 19. Corrected across README, docs/index.mdx, docs/rules/index.mdx, docs/rules/seo/index.mdx and docs/agent-setup/index.mdx; both per-category tables and all four score-group card sets now sum to 281. Both branches also added the SAME optional isBoundary parameter to collectTextExcluding, independently. #214's version emits the separator on entering a matching element only, on the reasoning that the next block's own entry closes the previous one. That holds between two blocks, which is all placeholder-text needs, but not when a block is followed by inline content: `<h3>Price *</h3><a>terms* apply</a>` still reads back as `*terms*`, emphasis present in neither element. Kept the symmetric version, which satisfies both rules, and merged the two test suites into one describe block. That makes the extracted text carry a closing separator as well, so three exact-string expectations in placeholder-text.test.ts moved. Only the strings: each test still asserts what its name says, and every rule-outcome assertion in that suite is untouched and green. The golden gate now pins 99221 findings and 281 tally keys, both rules contributing 500 passing page checks to the 518-page fixture. Verified: packages/rules content suites 177 pass, packages/parser 41 pass, audit-engine golden 15 pass across six files, tsgo clean in parser, rules, audit-engine and apps/cli, root lint clean, docs check clean. Refs squirrelscan/repo#1352 Signed-off-by: Nik Cubrilovic <[email protected]>
Merged
3 tasks done
nc9
pushed a commit
that referenced
this pull request
Sep 6, 2026
Rebase onto content/placeholder-text (#214). Three things needed a decision rather than a mechanical resolution. Both branches bumped the published counts 279 -> 280 with byte-identical edits, so git merged them as one change and no conflict was raised. The live loader now returns 281 rules and 20 content rules while every literal still said 280 and 19. Corrected across README, docs/index.mdx, docs/rules/index.mdx, docs/rules/seo/index.mdx and docs/agent-setup/index.mdx; both per-category tables and all four score-group card sets now sum to 281. Both branches also added the SAME optional isBoundary parameter to collectTextExcluding, independently. #214's version emits the separator on entering a matching element only, on the reasoning that the next block's own entry closes the previous one. That holds between two blocks, which is all placeholder-text needs, but not when a block is followed by inline content: `<h3>Price *</h3><a>terms* apply</a>` still reads back as `*terms*`, emphasis present in neither element. Kept the symmetric version, which satisfies both rules, and merged the two test suites into one describe block. That makes the extracted text carry a closing separator as well, so three exact-string expectations in placeholder-text.test.ts moved. Only the strings: each test still asserts what its name says, and every rule-outcome assertion in that suite is untouched and green. The golden gate now pins 99221 findings and 281 tally keys, both rules contributing 500 passing page checks to the 518-page fixture. Verified: packages/rules content suites 177 pass, packages/parser 41 pass, audit-engine golden 15 pass across six files, tsgo clean in parser, rules, audit-engine and apps/cli, root lint clean, docs check clean. Refs squirrelscan/repo#1352 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
added a commit
that referenced
this pull request
Sep 6, 2026
…ed HTML in rendered copy (#217) * feat(rules): add content/unrendered-markup for leaked markdown and escaped HTML Detects literal markdown (emphasis, links, headings, fences) and visible escaped HTML or double-encoded entities in the text a visitor actually reads. Reads prose from the DOM with script-like AND code-like subtrees excluded, so a docs page displaying markdown source stays clean. That exclusion is the rule, not a refinement: <code>, <pre>, <samp>, <kbd>, <textarea>, plus whole-token syntax-highlighter classes and the data-language family. Precision work, measured against 88 real pages (1 residual, w3schools' HTML tutorial, which displays source in a bespoke div): - emphasis requires CommonMark flanking, so CLOUDFLARE_API_TOKEN, 2 * 3 and some_file_name.ts are not emphasis; the underscore form also requires a space inside, which silences __init__ and __main__ - a markdown link needs a URL-shaped target, so array[i](arg) is not a link - escaped tags must be lowercase (<Article> is a component name) and at least one must carry a closing form or a valued attribute (<meta name> in a sentence is documentation) - entities match a curated list, so Johnson&Johnson; is not an entity - visible backticks corroborate but never accuse on their own Regexes are kept linear with bounded, non-adjacent quantifiers and covered by adversarial 64 KB timing tests. Refs squirrelscan/repo#1352 Signed-off-by: Nik Cubrilovic <[email protected]> * fix(rules): address review of content/unrendered-markup Six findings from a fresh-eyes pass, in descending order of severity. The heading and fence families were effectively dead on any real page. collectTextExcluding emits its separator only for EXCLUDED subtrees, so sibling blocks concatenate with nothing between them and a /m ^ anchor matched only at offset 0 — which, on a page with a header, is never. Adds an optional isBoundary predicate to collectTextExcluding (default undefined, so no existing caller moves) and passes a block-tag predicate. Verified: <p>## Pricing</p> behind a nav went from silent to reported, as did adjacent list items sharing emphasis. `rest.includes("=")` called any prose equals sign an attribute, so `if a<b then c=1>0 holds` was reported at fail. Replaced with a recognised attribute-name allowlist, the same shape that already keeps Johnson&Johnson; from reading as an entity. A path in angle brackets is no longer a closing tag. The reported count, kind list and example included markdown-inline-code, which the threshold excludes: a page with one bold phrase and five backtick spans announced six occurrences at warn, and showed a backtick span as the example. The headline now reports only the evidence that decided the status. Also: the tag-name bound is derived from the tag sets rather than a literal {0,9} that blockquote and figcaption already sat exactly on; the emphasis family honours one match budget instead of one per pattern; a vouching tag past the cap no longer drops the whole family; isCodeLikeElement makes one pass over attributes rather than five (19.8ms -> 1.9ms per extraction on a 10k-element DOM); bare "pre" is gone from the highlighter class tokens. Tests: the eight "adversarial" fixtures carried a single trigger character each and could not detect backtracking at all — a deliberately bad link pattern measured 0.1ms on the old fixture and 5.2s on a dense one. Replaced with 18 dense-trigger fixtures at a 400ms budget, plus assertions that the scan cap truncates rather than merely finishing fast. The golden pin now checks the per-rule tally directly instead of inferring "all 500 are passes" from an unmoved health score. Re-smoked against 75 reachable real pages: 74 clean. The residual is w3schools' HTML tutorial, which displays source in a bespoke div. One new false positive the boundary work introduced (MDN renders a URL fragment on its own line) is fixed by rejecting slug-shaped headings. Two rule-count literals the first commit missed: README's per-category table and the duplicate content card in docs/rules/seo. Both category tables now sum to 280. Refs squirrelscan/repo#1352 Signed-off-by: Nik Cubrilovic <[email protected]> * fix(rules): close the closing-edge of the block boundary, and four more Second review pass. Every finding reproduced before it was fixed. The boundary was emitted on ENTER only, which moved the gluing bug to the other edge rather than fixing it: `<h3>Price *</h3><a>terms* apply</a>` still read back as `*terms*`, emphasis present in neither element, and a split escaped tag reached `fail` on the same basis. collectTextExcluding now pushes a stack marker before a boundary element's children so the separator closes after them, and the escaped-tag pattern no longer accepts a newline inside an attribute list, which was the second way two blocks could assemble one tag. Making every block start a line gave the number sign a line start too, so `<th># of seats</th>` warned as a leaked heading. A single `#` now needs a capitalised word after it; `##` and deeper have no second reading and are taken as written, which also restores `## my-package` and `## getting-started` that the previous slug guard was silencing. The attribute allowlist had no legacy presentational names, so escaped table and email HTML - no closing tags, `align`/`bgcolor`/`valign` only - had nothing to vouch for it and passed clean. Added those, deliberately without single-letter SVG names, which would resurrect the `a<b then d=1>0` false positive. Also: sibling `<option>`s glued like `<li>`s, so option/optgroup/caption/legend/ menu join the block tags; the escaped-tag sample now leads with the tag that actually vouched rather than whichever bare mention came first, moved by index because moving it by value would delete its duplicates and undercount; and the `closing` helper moved above its callers, since a const arrow is not hoisted and packages/* is not linted. Tests: two of five boundary fixtures passed with the boundary deleted because they sat at the body's first byte. Replaced with fixtures that all follow chrome, plus five gluing fixtures that must stay clean and one proving a tag whole within a single block is still reported. Re-smoked against 85 real pages, all reachable: 83 clean, worst rule time 10ms. Both residuals are w3schools tutorials displaying HTML source in a bespoke div, the known and documented case. MDN's element pages are now clean. Refs squirrelscan/repo#1352 Signed-off-by: Nik Cubrilovic <[email protected]> * docs(rules): drop the em-dash from the unrendered-markup solution copy Rule solutions render in reports and on the docs site, so they are public copy, where the house style is a colon rather than an em-dash. Also corrects two comments that described the previous implementation: the attribute read is one pass now, and the escaped-tag sample is the vouching tag rather than the first. Refs squirrelscan/repo#1352 Signed-off-by: Nik Cubrilovic <[email protected]> * fix(rules): reconcile the rule counts and the shared boundary with #214 Rebase onto content/placeholder-text (#214). Three things needed a decision rather than a mechanical resolution. Both branches bumped the published counts 279 -> 280 with byte-identical edits, so git merged them as one change and no conflict was raised. The live loader now returns 281 rules and 20 content rules while every literal still said 280 and 19. Corrected across README, docs/index.mdx, docs/rules/index.mdx, docs/rules/seo/index.mdx and docs/agent-setup/index.mdx; both per-category tables and all four score-group card sets now sum to 281. Both branches also added the SAME optional isBoundary parameter to collectTextExcluding, independently. #214's version emits the separator on entering a matching element only, on the reasoning that the next block's own entry closes the previous one. That holds between two blocks, which is all placeholder-text needs, but not when a block is followed by inline content: `<h3>Price *</h3><a>terms* apply</a>` still reads back as `*terms*`, emphasis present in neither element. Kept the symmetric version, which satisfies both rules, and merged the two test suites into one describe block. That makes the extracted text carry a closing separator as well, so three exact-string expectations in placeholder-text.test.ts moved. Only the strings: each test still asserts what its name says, and every rule-outcome assertion in that suite is untouched and green. The golden gate now pins 99221 findings and 281 tally keys, both rules contributing 500 passing page checks to the 518-page fixture. Verified: packages/rules content suites 177 pass, packages/parser 41 pass, audit-engine golden 15 pass across six files, tsgo clean in parser, rules, audit-engine and apps/cli, root lint clean, docs check clean. Refs squirrelscan/repo#1352 Signed-off-by: Nik Cubrilovic <[email protected]> --------- Signed-off-by: Nik Cubrilovic <[email protected]> Co-authored-by: Nik Cubrilovic <[email protected]>
7 tasks done
nc9
added a commit
that referenced
this pull request
Oct 17, 2026
… prose #215 #216 (#885) Closes #215 Closes #216 Two content-rule follow-ups from #214, in one PR because they touch the same prose helpers and docs. ## #215: the title Ownership decision: `content/placeholder-text` owns this, because it already has the stringified-value logic and its docs-page guards. `core/meta-title` judges presence and length only. Both docs pages say so. The rule adds a `placeholder-title` check, emitted only when there is a finding. A pass row on every page would dilute the body check's score on the pages that have one. - `[object X]` anywhere in the title: fail, the same as the body family. - `undefined`, `null` or `NaN` as a whole separator-delimited segment (` | `, ` - `, ` – `, ` — `, ` · `, ` • `, ` » `, ` › `, ` / `, ` :: `, at either end too): warn, the same as the body family. - The page is about the word when its `<h1>` or a `<code>` element is exactly that word, so MDN's `undefined - JavaScript | MDN` is not reported. Each value is judged on its own, so `undefined | null | Acme` on the MDN page still reports `null`. - A broken page whose `<h1>` is also `undefined` is reported by the existing body check, which is the same rule, so the title never adds a second rule. ## #216: mojibake reads rendered prose `content/mojibake` switches from `getProseTextExcludingCode` to `getRenderedProseText`, the helper placeholder-text uses. That excludes `<template>` and code-editor/highlighter containers and puts a break at every block boundary. Ordinary prose reports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new per-page audit rule
content/placeholder-text: template leftovers and filler copy that reached production. Six families, all judged against visible prose:lorem-ipsumLorem ipsum dolor sit ametunrendered-template{{ user.name }},{% for x in y %},<%= title %>,${total},[[slug]]stringified-object[object Object]boilerplate-copyYour Company Name,Insert text herejs-artifactRating: NaN, a table cell readingundefinedtodo-markerTODO: write this,FIXME(alice)Severity follows certainty. The three failing families are machine-generated and nothing legitimate produces them. The bare words
undefined,nullandNaNonly warn, because an API reference whose defaults column readsnullis ordinary and text alone cannot tell it from a value that failed to render.Every family is also a legitimate thing for a page to quote, so most of the work here is precision:
getRenderedProseTextdropsscript/style/noscript,code/pre/samp/kbd,<template>(linkedom keeps its children inchildNodes, so every Vue and Handlebars page reads as full of unrendered syntax without this), and the container classes of in-page code editors. CodeMirror and Monaco render no<pre>or<code>anywhere, which is why shopify.dev's Liquid reference fired before that exclusion..textContentjoins<td>Author</td><td>undefined</td>into one word that no word-boundary pattern can see.:or>. A comma is not a label, soAccepts a string, null, or undefinedis prose. Neither is a pipe, so a TypeScript union is prose.dolor sit amet. The bigram alone is never enough, or everyLorem ipsum explainedheading would fire.placeholder textandexample text, which are the ordinary way to name this subject.XXXneeds a comment sigil, becauseSuper Bowl XXX: the box scorefits annotation form exactly. A bareTODOis left alone too: it is the name of a column on every task board ever shipped.collectTextExcludinginpackages/parsergains an optionalisBoundarypredicate. It is guarded by bothseparator &&and?., and every existing caller passes three arguments or fewer, so no existing behaviour changes.Refs squirrelscan/repo#1350
Verification
Rule and helper tests, 62 cases:
Neighbours and the shared walk:
Full audit-engine golden set green, including the canonical 518-page merge gate. Its two pinned counts move as expected for a page-scoped rule that always speaks: findings
98221 -> 98721(+500, one passing check per fixture page) andperRuleTally 279 -> 280.healthScore.overallis unmoved at 48, so all 500 checks pass.tsgo --noEmitclean inpackages/rules,packages/parser,packages/audit-engineandapps/cli.make validateclean indocs/.Smoked through the real CLI against a local fixture page, which reports all six families with the right severities and leaves the
<code>,<pre>and<template>content alone.Smoked against real sites, which is what drove most of the precision work above:
The two warnings are the documented known limit: a page whose subject IS one of these values looks exactly like a page whose values failed to render.
Checklist
Signed-off-byline (git commit -s).