Skip to content

fix(lint): exempt ERB-templated Rails fixtures from yamllint - #60

Merged
bryanfawcett merged 1 commit into
mainfrom
ci/erb-fixtures
Sep 11, 2026
Merged

fix(lint): exempt ERB-templated Rails fixtures from yamllint#60
bryanfawcett merged 1 commit into
mainfrom
ci/erb-fixtures

Conversation

@bryanfawcett

Copy link
Copy Markdown
Contributor

ERB templates are not YAML documents

campfire's test/fixtures/*.yml are ERB templates. users.yml opens with

<% password_digest = BCrypt::Password.create("secret123456") %>

and only becomes valid YAML after Rails renders it, so yamllint reports a hard syntax error and always will. There is no version of that file that is both a working fixture and parseable YAML. Seven files in that repo are ERB-templated YAML; the rest only parse because their ERB happens to sit inside quoted scalars — luck, not correctness.

The ActionText fixtures alongside them are HTML blobs that tests assert on byte-for-byte, so rewrapping their 300-char lines would be a test change disguised as a formatting change.

Same class as the lockfile exemption: content that is generated or templated rather than authored. This recurs in every Rails repo, and the narrower rule — skip any YAML containing <% — cannot be expressed in yamllint's path-based ignore.

Plus the worst hazard found so far, documented

A file with a .md extension that is not Markdown gets silently corrupted. mzizi-registry ships components/registry/n8-assurance/accessibility-audit.md, which is SQL, installed into consumers as documentation. Its /* … */ banner parses as Markdown emphasis, so prettier --write rewrites /*/_ — turning a shipped artifact into invalid SQL and then passing the gate.

Unlike every other trap recorded here, this one does not fail loudly. It changes your file and goes green. Now in ADOPTING-LINT.md with the fix (wrap the body in a fenced code block — byte-for-byte unchanged, satisfies both tools, renders as code).

Unblocks nyuchi/campfire#1.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

campfire's test/fixtures/*.yml are ERB TEMPLATES, not YAML documents.
users.yml opens with

  <% password_digest = BCrypt::Password.create("secret123456") %>

and only becomes valid YAML after Rails renders it, so yamllint reports a
hard syntax error and always will - there is no version of that file that
is both a working fixture and parseable YAML. Seven files in that repo
are ERB-templated YAML; the rest only parse because their ERB happens to
sit inside quoted scalars, which is luck rather than correctness.

The ActionText fixtures alongside them are HTML blobs that tests assert
on byte-for-byte, so rewrapping their 300-char lines would be a test
change disguised as a formatting change.

Same class as the lockfile exemption: content that is generated or
templated rather than authored. This will recur in every Rails repo, and
the narrower rule - skip any YAML containing `<%` - cannot be expressed
in yamllint's path-based ignore.

Also records the worst hazard found so far in ADOPTING-LINT.md: a file
with a .md extension that is not Markdown gets SILENTLY CORRUPTED.
mzizi-registry ships components/registry/n8-assurance/accessibility-
audit.md, which is SQL, installed into consumers as documentation. Its
`/* ... */` banner parses as Markdown emphasis, so `prettier --write`
rewrites `/*` to `/_` - turning a shipped artifact into invalid SQL and
then PASSING the gate. Unlike every other trap here, this one does not
fail loudly; it changes your file and goes green.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bryanfawcett
bryanfawcett merged commit 1eeca52 into main Sep 11, 2026
7 checks passed
@bryanfawcett
bryanfawcett deleted the ci/erb-fixtures branch September 11, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant