Skip to content

feat(lint): add buildifier linting for Starlark files - #1271

Open
LittleHuba wants to merge 3 commits into
mainfrom
split/1-lint-infra
Open

LittleHuba wants to merge 3 commits into
mainfrom
split/1-lint-infra

Conversation

@LittleHuba

Copy link
Copy Markdown
Contributor

Adds buildifier linting infrastructure (lint aspect, SARIF conversion, CI integration) and bumps action versions in the linter workflow. Split out of #1255; contains no BUILD/bzl fixes.


import io
import json
import unittest
@LittleHuba

Copy link
Copy Markdown
Contributor Author

Can only be merged once #1272, #1273, #1274, #1275 are merged.
Given that we already have proposed fixes for all findings I will not try to work out a hold-the-line concept.

@LittleHuba
LittleHuba changed the base branch from main to split/5-remaining-fixes October 21, 2026 11:25
@LittleHuba
LittleHuba added this pull request to stack #1421 October 21, 2026 11:26
Base automatically changed from split/5-remaining-fixes to main October 21, 2026 11:39
LittleHuba and others added 3 commits October 21, 2026 13:39
Add //:buildifier.check and //:buildifier.fix, which accept Bazel-style
package patterns (including `-` exclusions) like the other linters, and a
gating //:buildifier_test. A dedicated CI job converts the findings to SARIF
(//tools/lint:buildifier_sarif), uploads them to Code Scanning and fails on
findings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With --format=json buildifier exits 0 and flags syntax errors (valid=false)
and unformatted files (formatted=false) without any warning entry, so they
were missing from the SARIF output and could not fail the job. Report them
as syntax-error/reformat results and treat all findings as errors, as
buildifier has no severity levels.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread CI.md
We chose ruff because it is fast, and it has a good set of default checks.
Runs the [ruff checks](./.ruff.toml) for the host.

#### Linting for Bazel files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this can be removed because it should already be covered by https://github.com/eclipse-score/communication/blob/main/CI.md#formatting-and-linting-of-bazel-files

if: inputs.fetch-only != 'true'
run: |
bazel run --config=ci --ui_event_filters=-info,-stdout --noshow_progress \
//tools/lint:buildifier_sarif > buildifier.sarif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Write to file, @LittleHuba know what that means :-)

Comment thread quality/quality.md
> **Note:** Violations without an automatic fix are still reported in the terminal but leave no
> patch file, same as Clang-Tidy.

### Buildifier

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants