)]}'
{
  "commit": "82285db8e1af42013d863701e44735b1e07bdefe",
  "tree": "82f5efdab38f1f91162dcdcd0ada1b5981c349da",
  "parents": [
    "f8f588752d5c23f5d288efa92b505082752eb9f7"
  ],
  "author": {
    "name": "Ulrich Huber",
    "email": "ulrich@huberulrich.de",
    "time": "Wed Oct 28 11:53:11 2026 +0100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Oct 28 11:53:11 2026 +0100"
  },
  "message": "buildifier: add SARIF output (--format\u003dsarif) (#1529)\n\nAdds SARIF 2.1.0 as a third diagnostics format next to `text` and\n`json`. SARIF is understood by many CI, IDE and code-quality tools.\nFixes #1528.\n\n## Usage\n\n```\nbuildifier --mode\u003dcheck --lint\u003dwarn --format\u003dsarif -r . \u003e buildifier.sarif\n```\n\nAs with `json`, `--format\u003dsarif` only works with `--mode\u003dcheck`, and\n`-v` indents the output.\n\n## Mapping\n\n- Each lint warning becomes a result at level `warning`. Its `ruleId` is\nthe warning category, `helpUri` is the WARNINGS.md link, and the region\nis the start and end line and column.\n- A file that needs reformatting becomes a file-level result (no region)\nwith rule `format`, level `warning`.\n- A file that can\u0027t be parsed becomes a file-level result with rule\n`parse-error`, level `error`.\n- Rules are deduplicated per category.\n- With no findings, the output is still a valid log with empty `rules`\nand `results`.\n\n## Design notes\n\n- The serializer is a small in-tree struct set, so it adds no\ndependency.\n- Findings carry no severity today (only `actionable`, which `warn.go`\nalways sets to `true`). So every lint finding is a `warning`.\n- `autoFixable` is not mapped. It would need SARIF `fixes` with\nreplacement text, which can come in a follow-up.\n- A `format` finding has no region, because buildifier doesn\u0027t track\nwhere the formatting differs.\n- `artifactLocation.uri` is the path as passed on the command line, so\nrun from the repo root with relative paths for repo-relative URIs.\n\n## Commits\n\n1. Serializer (`utils/sarif.go`), unit tests, and the `Format` hook-up.\n2. Accept `--format\u003dsarif` in `--mode\u003dcheck` and update the help text.\n3. README section.\n4. Integration tests with goldens, covering many files, a single file,\nstdin and an invalid file.\n\n## Additional testing\n\n- Sample outputs validate against the official OASIS SARIF 2.1.0 schema.\n\n---------\n\nCo-authored-by: Copilot \u003c223556219+Copilot@users.noreply.github.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "875058e38276a599c9b81b5d16abe99324ca57ec",
      "old_mode": 33188,
      "old_path": "buildifier/README.md",
      "new_id": "b3a3a7c9316d53e3169acab00a15ab5346aa7198",
      "new_mode": 33188,
      "new_path": "buildifier/README.md"
    },
    {
      "type": "modify",
      "old_id": "7b90929a25310a285b0ec3c57912284dec389adf",
      "old_mode": 33188,
      "old_path": "buildifier/config/config.go",
      "new_id": "4efa1914db280e01ae084467b019037cec2a4a6a",
      "new_mode": 33188,
      "new_path": "buildifier/config/config.go"
    },
    {
      "type": "modify",
      "old_id": "a9b0877c46a5720e1b94f066c3507a47ae3c1f85",
      "old_mode": 33188,
      "old_path": "buildifier/config/config_test.go",
      "new_id": "c7364333882167659c7f4a6571cd3e566c8c1a6d",
      "new_mode": 33188,
      "new_path": "buildifier/config/config_test.go"
    },
    {
      "type": "modify",
      "old_id": "509be21a81c52056eb6f701889473a3c9ea1a177",
      "old_mode": 33188,
      "old_path": "buildifier/config/validation.go",
      "new_id": "eb3bdb76e1fbe8775aee175d5d8a8e8d0bcf4607",
      "new_mode": 33188,
      "new_path": "buildifier/config/validation.go"
    },
    {
      "type": "modify",
      "old_id": "d4cc28901c64934f1a3a4af40b37fe261811cb61",
      "old_mode": 33261,
      "old_path": "buildifier/integration_test.sh",
      "new_id": "e7ae2e764bb8a2afd01cdfdea67bf83be0199083",
      "new_mode": 33261,
      "new_path": "buildifier/integration_test.sh"
    },
    {
      "type": "modify",
      "old_id": "ec6aab9c8d5ce1135d382ba15a91b4ad12415365",
      "old_mode": 33188,
      "old_path": "buildifier/utils/BUILD.bazel",
      "new_id": "c406ec686630ca6d5cf3c44a05d56d8a6d623e4e",
      "new_mode": 33188,
      "new_path": "buildifier/utils/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "8de8534f9c149e91282518f5e3a2fc0fae4d44f7",
      "old_mode": 33188,
      "old_path": "buildifier/utils/diagnostics.go",
      "new_id": "412bd459207690de5b24848cd96137e60938db2d",
      "new_mode": 33188,
      "new_path": "buildifier/utils/diagnostics.go"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "d8803411c2fb07bc07e6c354fc9b4fbd3a56e191",
      "new_mode": 33188,
      "new_path": "buildifier/utils/sarif.go"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "16d2bc0cdab9bac4c153ad3601b12b322673145f",
      "new_mode": 33188,
      "new_path": "buildifier/utils/sarif_test.go"
    }
  ]
}
