fix(lint): exempt ERB-templated Rails fixtures from yamllint - #60
Merged
Conversation
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>
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.
ERB templates are not YAML documents
campfire'stest/fixtures/*.ymlare ERB templates.users.ymlopens withand 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-basedignore.Plus the worst hazard found so far, documented
A file with a
.mdextension that is not Markdown gets silently corrupted.mzizi-registryshipscomponents/registry/n8-assurance/accessibility-audit.md, which is SQL, installed into consumers as documentation. Its/* … */banner parses as Markdown emphasis, soprettier --writerewrites/*→/_— 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