warning-suppression: skip vendored/generated files - #188
Merged
Conversation
Since #183 made the check whole-file, it flags markers inside vendored/generated content — a recorded third-party fixture (linguist-vendored) or a machine-written file (linguist-generated) whose markers aren't the project's suppression decisions. A consumer with cached third-party pages gets dozens of false blocking findings with no recourse but a per-repo accept entry. Skip files git marks linguist-vendored / linguist-generated, the same way the check already skips docs, packs/, and checks/test/. Add a lazy ctx.vendored() helper backed by `git check-attr --stdin` (so .gitattributes patterns/precedence are honored natively; paths on stdin so a large repo can't overflow argv), and consume it in the check. Red-first test: markers in a vendored fixture and a generated file are ignored while the project's own file still fires. Refs #187 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019iJfy6YPtnTvvRGPsUYvYY
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.
What
warning-suppressionno longer fires on vendored/generated files — content git markslinguist-vendoredorlinguist-generated.Closes #187
Why
#183 correctly made the check whole-file ("check-the-world"), but that means it scans third-party and machine-written content too. A consumer that records event pages as
linguist-vendoredHTML fixtures gets 24+ blocking findings from those pages' own inlineeslint-disable/@ts-ignoremarkers — none of which are suppression decisions the project made. The only workaround was a per-repoacceptentry, which every consumer with recorded fixtures or generated files would need.A marker inside vendored/generated content isn't the project's code, so it's out of scope — the same reasoning as the existing
.md/packs//checks/test/skips.How
ctx.vendored()inchecks/lib/context.mjs: a lazily-computedSetof the in-scope files git markslinguist-vendored/linguist-generated, viagit check-attr --stdin linguist-vendored linguist-generated— so.gitattributespatterns and precedence are honored natively (no hand-rolled glob matcher), with paths fed on stdin so a large repo can't overflow argv. (shgained aninputoption.)warning-suppressionskipsvendored.has(file).linguist-vendoredfixture and alinguist-generatedfile are ignored, while the project's ownsrc/mine.jsstill fires.Verification
eval) remains — correctly still needing its ownaccept.ctx.vendored()identified all 34 fixtures.🤖 Generated with Claude Code
https://claude.ai/code/session_019iJfy6YPtnTvvRGPsUYvYY
Generated by Claude Code