Skip to content

fix: skip generated git-tracked files during linting#301

Closed
zeitlinger wants to merge 4 commits into
mainfrom
codex/skip-generated-git-tracked-files
Closed

fix: skip generated git-tracked files during linting#301
zeitlinger wants to merge 4 commits into
mainfrom
codex/skip-generated-git-tracked-files

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

Summary

  • skip lint targets that are marked as generated in git attributes
  • keep Flint scoped to tracked files and preserve Flint-managed built-in excludes
  • document that generated files should be marked in .gitattributes instead of Flint-only config when possible

Why

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 test
  • mise run lint:fix

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger force-pushed the codex/skip-generated-git-tracked-files branch from 0747642 to 12f3ab7 Compare May 18, 2026 07:34
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger marked this pull request as ready for review May 18, 2026 07:45
@zeitlinger zeitlinger requested a review from a team as a code owner May 18, 2026 07:45
Copilot AI review requested due to automatic review settings May 18, 2026 07:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_paths helper in src/files.rs that pipes tracked names through git check-attr --stdin -z linguist-generated and excludes any path with the attribute set, plus a new unit test that initializes a temp git repo with a .gitattributes file.
  • Propagate Result from filter_names to callers (changed, all_files) so check-attr failures surface as errors.
  • Update README, docs/cli.md, and .github/agents/knowledge/design.md to document the new behavior and recommend .gitattributes for 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.

Comment thread src/files.rs Outdated
Copy link
Copy Markdown
Member

@martincostello martincostello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for the Copilot comment about deadlocks.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Comment thread README.md Outdated
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger closed this May 21, 2026
@zeitlinger zeitlinger reopened this May 21, 2026
@zeitlinger zeitlinger closed this May 26, 2026
@zeitlinger zeitlinger reopened this May 26, 2026
@zeitlinger
Copy link
Copy Markdown
Member Author

close in favor of #305 - cla assistant not working

@zeitlinger zeitlinger closed this May 26, 2026
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.

3 participants