Repository navigation
buildifier: add SARIF output (--format=sarif) - #1529
Merged
Merged
Conversation
LittleHuba
marked this pull request as ready for review
October 27, 2026 10:59
fmeum
approved these changes
Oct 27, 2026
fmeum
left a comment
Member
There was a problem hiding this comment.
Thanks, this is really useful!
Just a nit and I will merge and release this.
LittleHuba
force-pushed
the
buildifier-sarif
branch
from
October 27, 2026 12:08
779d9fe to
1e48c4c
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LittleHuba
force-pushed
the
buildifier-sarif
branch
from
October 27, 2026 12:11
1e48c4c to
1620e52
Compare
fmeum
reviewed
Oct 27, 2026
fmeum
left a comment
Member
There was a problem hiding this comment.
Follow-up review: two small SARIF 2.1.0 conformance gaps and two test nits. The suggestions can be applied as one batch. With all of them applied, go test ./buildifier/utils passes and gofmt is clean. The integration goldens still need the columnKind line, as described in the first comment.
Member
|
I also asked Claude for a review and it found a few things worth fixing regarding sarif compat. |
- Set run.columnKind, which is required when results are present
(SARIF 3.14.27).
- Escape '{' and '}' in message text (3.11.5).
- Emit artifact locations as RFC 3986 URI references: percent-encode
special characters and use file:// URIs for absolute paths (3.4.3).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Pipe an unformatted file in the stdin integration test so the stdin filename appears in the report. - Add the license header to sarif_test.go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Resolved all findings. Found in addition one more hole with escaping curly braces. |
fmeum
approved these changes
Oct 28, 2026
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.
Adds SARIF 2.1.0 as a third diagnostics format next to
textandjson. SARIF is understood by many CI, IDE and code-quality tools. Fixes #1528.Usage
As with
json,--format=sarifonly works with--mode=check, and-vindents the output.Mapping
warning. ItsruleIdis the warning category,helpUriis the WARNINGS.md link, and the region is the start and end line and column.format, levelwarning.parse-error, levelerror.rulesandresults.Design notes
actionable, whichwarn.goalways sets totrue). So every lint finding is awarning.autoFixableis not mapped. It would need SARIFfixeswith replacement text, which can come in a follow-up.formatfinding has no region, because buildifier doesn't track where the formatting differs.artifactLocation.uriis the path as passed on the command line, so run from the repo root with relative paths for repo-relative URIs.Commits
utils/sarif.go), unit tests, and theFormathook-up.--format=sarifin--mode=checkand update the help text.Additional testing