fix: skip generated git-tracked files during linting#301
Closed
zeitlinger wants to merge 4 commits into
Closed
Conversation
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
0747642 to
12f3ab7
Compare
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Skips git-tracked files marked linguist-generated in .gitattributes during Flint's generic lint filtering, by invoking git check-attr from filter_names. Documentation in the README, CLI reference, and agent design notes is updated to recommend .gitattributes over Flint-only excludes for generated files.
Changes:
- Add
generated_pathshelper insrc/files.rsthat pipes tracked names throughgit check-attr --stdin -z linguist-generatedand excludes any path with the attribute set, plus a new unit test that initializes a temp git repo with a.gitattributesfile. - Propagate
Resultfromfilter_namesto callers (changed,all_files) so check-attr failures surface as errors. - Update README,
docs/cli.md, and.github/agents/knowledge/design.mdto document the new behavior and recommend.gitattributesfor shared generated-file metadata.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/files.rs | Adds generated_paths using git check-attr, threads it through filter_names, and adds a test for linguist-generated exclusion. |
| README.md | Clarifies tracked-files scope and adds an FAQ recommending .gitattributes for exclusions. |
| docs/cli.md | Updates the changed-file/baseline runs section to mention tracked-file scoping and linguist-generated skipping. |
| .github/agents/knowledge/design.md | Updates internal design notes for the two classes of excluded files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
martincostello
left a comment
There was a problem hiding this comment.
LGTM except for the Copilot comment about deadlocks.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
martincostello
approved these changes
May 18, 2026
Member
Author
|
close in favor of #305 - cla assistant not working |
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
.gitattributesinstead of Flint-only config when possibleWhy
Generated files should not be part of ordinary lint runs, and storing that intent in git attributes lets GitHub and other tooling reuse the same metadata.
Root cause
Flint already limited full runs to
git ls-files, but generic lint filtering did not consult git attributes for generated files, so tracked generated files could still be linted unless they were excluded in Flint-specific config.Validation
cargo testmise run lint:fix