Skip to content

feat(reporter): merge external SARIF runs#511

Open
macayu17 wants to merge 3 commits into
Boeing:mainfrom
macayu17:feature/sarif-merge-reports
Open

feat(reporter): merge external SARIF runs#511
macayu17 wants to merge 3 commits into
Boeing:mainfrom
macayu17:feature/sarif-merge-reports

Conversation

@macayu17
Copy link
Copy Markdown
Contributor

Fixes #460.

Summary

Adds SARIF aggregation for the SARIF reporter.

  • --merge-sarif can be repeated to append external SARIF files
  • --merge-sarif-dir appends .sarif and .sarif.json files from a directory
  • external SARIF runs are preserved as additional runs, including tool metadata, rules, and results

No new dependencies.

Verification

  • go test ./cmd/validator -run 'Test_getFlags|TestScript/sarif_merge' -count=1
  • go test ./pkg/reporter -count=1
  • Linux Docker Go pipeline passed:
    • go vet ./...
    • nested justfile go vet ./...
    • gofmt checks
    • go generate ./pkg/filetype/... with clean generated-file diff
    • static Linux build
    • go test -cover -coverprofile coverage.out ./...
    • total coverage: 92.4%
    • nested justfile go test -count=1 ./...
  • golangci-lint run ./... --timeout=10m
  • golangci-lint run ./... --timeout=10m in pkg/validator/justfile
  • npm ci
  • npm run build

Copilot AI review requested due to automatic review settings May 28, 2026 03:11
@macayu17 macayu17 requested a review from a team as a code owner May 28, 2026 03:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for merging external SARIF files into the validator's SARIF output via two new CLI flags.

Changes:

  • New --merge-sarif (repeatable) and --merge-sarif-dir flags with validation that they require --reporter=sarif.
  • SARIF reporter extended to load external SARIF files/directories and append their runs to the report (preserving the raw run JSON).
  • Documentation, changelog, and tests (unit + txtar) for the new merge behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
cmd/validator/validator.go Adds merge flags, validation, and threads merge config into SARIF reporter construction.
cmd/validator/validator_test.go Adds test cases for new flags and their validation.
cmd/validator/testdata/sarif_merge.txtar New integration test for SARIF merge behavior.
pkg/reporter/sarif_reporter.go Adds external SARIF loading and run-appending logic with raw-JSON passthrough.
pkg/reporter/reporter_test.go Adds unit test verifying merged external run is preserved in output.
website/docs/reference/cli-flags.md Documents the two new flags.
website/docs/guides/output-reporters.md Adds SARIF merge usage examples.
CHANGELOG.md Notes the new merge flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/reporter/sarif_reporter.go
Comment thread cmd/validator/validator.go
Comment thread pkg/reporter/sarif_reporter.go Outdated
Comment thread cmd/validator/validator.go Outdated
Comment thread cmd/validator/validator.go Outdated
Comment thread pkg/reporter/sarif_reporter.go Outdated
Comment thread pkg/reporter/sarif_reporter.go Outdated
@kehoecj kehoecj added OSS Community Contribution Contributions from the OSS Community waiting-on-maintainer-review PR is waiting to be reviewed and functionally tested by the maintainers labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OSS Community Contribution Contributions from the OSS Community waiting-on-maintainer-review PR is waiting to be reviewed and functionally tested by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SARIF aggregation: merge results from external tools into a unified report

3 participants