Repository navigation
fix(format): stop .gitattributes hiding every BUILD file from buildifier - #1255
Merged
Merged
Conversation
bpalermo
marked this pull request as ready for review
October 5, 2026 14:10
bpalermo
force-pushed
the
fix/1244-format-build-files
branch
from
October 5, 2026 14:40
62ef2f4 to
2caef93
Compare
rules_lint's format multirun drops any file whose linguist-generated, gitlab-generated or rules-lint-ignored attribute is set. The unanchored `BUILD.bazel linguist-generated=true` / `BUILD ...` lines matched the basename at every depth, so 151 of the 158 tracked BUILD files (all outside proxy/, which re-unmarked its own) were never formatted or checked: a deliberately mis-formatted //:BUILD.bazel and //bazel/format:BUILD.bazel both passed `make format-check`. BUILD files are not generated: Gazelle writes the Go rules in some of them, but every one carries hand-written rules, comments and directives that belong in review, and buildifier is idempotent on Gazelle output. Drop both lines (and the proxy/ re-unmarks they required), and anchor the remaining true generated entries (the two MODULE.bazel.lock files, go.sum) with a leading `/`. Refs #1244 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
`bazel run //:format` output only, no hand edits: the one BUILD file that had drifted while the formatter skipped it (sorted `data` list in //website:site_test). Closes #1244 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
fix/1244-format-build-files
branch
from
October 5, 2026 15:08
2caef93 to
d4e0504
Compare
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.
Bottom of a 2-PR stack (this, then #1256).
Finding: confirmed, and wider than reported
The issue said the root BUILD-level files were skipped. It is every BUILD file outside
proxy/..gitattributeshad the unanchored linesBUILD.bazel linguist-generated=trueandBUILD linguist-generated=true. Without a leading/, a gitattributes pattern matches the basename at any depth. rules_lint'sformat.shdrops any file withrules-lint-ignored,linguist-generatedorgitlab-generatedset (git check-attr ... | ": set"/": true"). Onlyproxy/**/BUILD*was re-unmarked (#1229).git check-attrover all 1160 tracked files lists the excluded files:BUILD.bazel# keeps; buildifier is idempotent on Gazelle outputBUILDMODULE.bazel.lockMODULE.bazel.lock,proxy/MODULE.bazel.lockgo.sumgo.sumMODULE.bazeland*.bzlwere never excluded.Probe
I deliberately mis-formatted
//:BUILD.bazel(unsortedexports_files, broken indentation) and//bazel/format:BUILD.bazel(go="..."). Not committed.bazel run //:format.checkexit 0,Formatted Starlarkwith nothing reported.BUILD.bazel # reformatandbazel/format/BUILD.bazel # reformat, plus one real drift,website/BUILD.bazel # reformat.Change
.gitattributes: drop theBUILD.bazel/BUILDmarkers and theproxy/re-unmarks they required. Anchor the remaining true-generated entries (/MODULE.bazel.lock,/proxy/MODULE.bazel.lock,/go.sum). The comment says why the patterns must be anchored. Side effect: GitHub no longer collapses BUILD diffs, which this change intends.bazel run //:format. Onlywebsite/BUILD.bazelhad drifted:site_test'sdatalist is now sorted.Verification
make format-check: exit 0, all 4 languages ranbazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: passesbazel test //bazel/... //website:site_test: 7/7 passCloses #1244
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr