Skip to content

fix(lint): run buildifier's linter in format-check; drop the empty aspect - #1256

Merged
bpalermo merged 2 commits into
fix/1244-format-build-filesfrom
fix/1245-buildifier-lint
Oct 5, 2026
Merged

bpalermo merged 2 commits into
fix/1244-format-build-filesfrom
fix/1245-buildifier-lint

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Top of a 2-PR stack: stacked on #1255, which must merge first because it lets the formatter see the BUILD files at all.

Finding: confirmed

rules_lint 2.9.1's lint_buildifier_aspect only visits bzl_library / bzl_library_rule targets and filegroups tagged starlark or lint-with-buildifier. bazel query 'kind(bzl_library, //...) + attr(tags, "starlark|lint-with-buildifier", //...)' returns empty for this repository.

Probe: a throwaway bazel/lint/probe_dirty.bzl with an unused load and no module docstring. Not committed.

  • Before: bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //... exit 0. bazel aquery --config=lint //... --output=summary shows AspectRulesLintBuf: 12, AspectRulesLintShellCheck: 26 and no Buildifier mnemonic. Run directly, buildifier flags both warnings with exit 4.
  • After: bazel run //:format.check exit 1, reporting probe_dirty.bzl:1: module-docstring and probe_dirty.bzl:1: load. The same probe under proxy/bazel/ is caught too, without building the proxy workspace.

Change

  • Wiring. Lint rides the Starlark formatter through format_multirun's starlark_check_args / starlark_fix_args, so it runs in a gate CI already requires and no CI job is added:
    • make format-check (ci.yaml's format job and proxy.yml's format step) runs buildifier -mode=check -lint=warn -warnings=default over every Starlark file git lists, proxy/ included.
    • make format adds -lint=fix. That applies the mechanical fixes and still exits 0 on what it cannot fix; the check then reports those.
  • Removed the vacuous aspect. I dropped the buildifier aspect from --config=lint and bazel/lint/linters.bzl so no gate claims a check it does not run. With no bzl_library targets, and BUILD files unable to be srcs of a target in another package, there was no idiomatic way to make it visit them.
  • scripts/lint-proxy.sh is ShellCheck-only. Its buildifier half ran a second warning set (all) on one subtree; proxy/ Starlark now gets the same check as everything else.
  • CI changes (comments and messages only). In .github/workflows/ci.yaml and proxy.yml, the comments and step names that described lint-proxy's buildifier run are updated, and the format-failure message now mentions lint findings. No job, trigger or command changed.
  • Makefile, README, AGENTS.md, CLAUDE.md and docs/runbook.md now say where Starlark lint runs.

Warning set: buildifier default

Counts over all 171 Starlark files git lists (root + proxy):

category default all decision
unsorted-dict-items n/a (opt-in) 11 in 5 files off: chart per-template expectations, amd64-then-arm64 select()s and an aspect's attrs are ordered by component on purpose. The reason is recorded in bazel/format/BUILD.bazel
module-docstring 1 1 fixed
function-docstring-args 1 1 fixed
make-location 1 1 fixed

These are the only categories with findings, so all adds nothing besides unsorted-dict-items.

Fixes

Each is in its own commit:

  • bazel/img/go_multi_arch_image.bzl: added a module docstring. The docstring's Parameters: block was not recognised and also documented a non-existent tars, so it is now an Args: block covering every argument. Docstring only.
  • charts/aether/BUILD.bazel: $(location Chart.yaml) is now $(execpath Chart.yaml) in :chart_commit_yaml. The expansion is identical for a source file. Chart 2.4.6 -> 2.4.7, because the chart-version-bump gate counts any change under charts/aether/.

Verification

  • make format-check: exit 0, all 4 languages
  • bazel run //:format (fix mode): no further changes
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: passes
  • scripts/lint-proxy.sh: clean (4 shell files)
  • scripts/check-chart-version-bump.sh origin/main: passes
  • bazel test //bazel/... //charts/... //website:site_test: 74/74 pass

Closes #1245

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

@bpalermo
bpalermo added this pull request to stack #1257 October 5, 2026 14:09
@bpalermo bpalermo changed the title fix/1245 buildifier lint fix(lint): run buildifier's linter in format-check; drop the empty aspect Oct 5, 2026
@bpalermo
bpalermo marked this pull request as ready for review October 5, 2026 14:10
@bpalermo
bpalermo force-pushed the fix/1245-buildifier-lint branch from 68a8136 to cdf7b8f Compare October 5, 2026 14:40
bpalermo and others added 2 commits October 5, 2026 12:08
…pect

rules_lint's buildifier aspect only visits bzl_library targets and
filegroups tagged "starlark"; this repository has neither, so under
--config=lint it created zero AspectRulesLintBuildifier actions (aquery:
Buf 12, ShellCheck 26, Buildifier 0) and a lint-dirty .bzl (unused load,
no module docstring) passed `bazel build --config=lint
--@aspect_rules_lint//lint:fail_on_violation //...`.

Lint rides the Starlark formatter instead, via format_multirun's
starlark_check_args / starlark_fix_args: `make format-check` (the ci.yaml
`format` job and proxy.yml's format step, both already required) now
runs `buildifier -mode=check -lint=warn -warnings=default` over every
Starlark file git lists, proxy/ included without building that
workspace; `make format` adds `-lint=fix`, which applies the mechanical
fixes and stays exit 0 on what it cannot fix.

Warning set: buildifier's `default`. `all` only adds opt-in categories,
and the only one with findings is unsorted-dict-items (11 in 5 files,
deliberately component-ordered dicts), kept off with the reason spelled
out in bazel/format/BUILD.bazel.

- Remove the vacuous buildifier aspect from --config=lint and
  linters.bzl, so no gate claims a check it does not run.
- scripts/lint-proxy.sh drops its buildifier half (-warnings=all, a
  second warning set for one subtree) and is ShellCheck-only; comments,
  step names and the format-failure hint in ci.yaml/proxy.yml, the
  Makefile and the docs follow.

Refs #1245

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
The three findings the newly-wired linter reports on main:

- bazel/img/go_multi_arch_image.bzl: module-docstring (none) and
  function-docstring-args (the "Parameters:" block is not recognised,
  documented a non-existent `tars`, and omitted container_test_configs
  and tars_layer). Docstring-only; no action changes.
- charts/aether/BUILD.bazel: make-location in :chart_commit_yaml —
  $(location Chart.yaml) -> $(execpath Chart.yaml), identical expansion
  for a source file in a genrule cmd. Chart 2.4.6 -> 2.4.7 (the
  chart-version-bump gate counts any change under charts/aether/).

Closes #1245

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the fix/1245-buildifier-lint branch from cdf7b8f to 4735e34 Compare October 5, 2026 15:08
@bpalermo
bpalermo merged commit 42b4e65 into main Oct 5, 2026
49 checks passed
@bpalermo
bpalermo deleted the fix/1245-buildifier-lint branch October 5, 2026 15:30
bpalermo added a commit that referenced this pull request Oct 5, 2026
…gets; pin cloud-provider-kind

- e2e/soak/harness_test.sh (#1265, 34 offline cases) ran nowhere: it needed
  jq from the host. It is now //e2e/soak:harness_test, an sh_test with the
  Bazel-pinned jq (jq.bzl) put on PATH, so it runs in bazel test //... and in
  ci.yaml's test leg whenever the soak harness changes.
- The shell jobs in ci.yaml and proxy.yml warmed @buildifier_prebuilt
  //:buildifier, which nothing in either job runs since scripts/lint-proxy.sh
  stopped running buildifier (#1256); --config=lint's aspects are buf,
  shellcheck and gocognit, and proxy.yml's //:format.check warm-up already
  covers the formatter's buildifier.
- e2e.yaml installed sigs.k8s.io/cloud-provider-kind@latest (then run under
  sudo): pinned to v0.12.0, what @latest resolves to today.
- Stale comments: ci.yaml's shell job ("17 source files" -> 70) and
  main.yaml's test job ("the proxy-ready linkage guard" -> five guards).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Oct 5, 2026
…gets; pin cloud-provider-kind (#1279)

- e2e/soak/harness_test.sh (#1265, 34 offline cases) ran nowhere: it needed
  jq from the host. It is now //e2e/soak:harness_test, an sh_test with the
  Bazel-pinned jq (jq.bzl) put on PATH, so it runs in bazel test //... and in
  ci.yaml's test leg whenever the soak harness changes.
- The shell jobs in ci.yaml and proxy.yml warmed @buildifier_prebuilt
  //:buildifier, which nothing in either job runs since scripts/lint-proxy.sh
  stopped running buildifier (#1256); --config=lint's aspects are buf,
  shellcheck and gocognit, and proxy.yml's //:format.check warm-up already
  covers the formatter's buildifier.
- e2e.yaml installed sigs.k8s.io/cloud-provider-kind@latest (then run under
  sudo): pinned to v0.12.0, what @latest resolves to today.
- Stale comments: ci.yaml's shell job ("17 source files" -> 70) and
  main.yaml's test job ("the proxy-ready linkage guard" -> five guards).


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
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.

lint: the root buildifier lint aspect checks no Starlark

1 participant