feat(reporter): merge external SARIF runs#511
Open
macayu17 wants to merge 3 commits into
Open
Conversation
…-reports # Conflicts: # pkg/reporter/reporter_test.go
There was a problem hiding this comment.
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-dirflags 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.
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.
Fixes #460.
Summary
Adds SARIF aggregation for the SARIF reporter.
--merge-sarifcan be repeated to append external SARIF files--merge-sarif-dirappends.sarifand.sarif.jsonfiles from a directoryNo new dependencies.
Verification
go test ./cmd/validator -run 'Test_getFlags|TestScript/sarif_merge' -count=1go test ./pkg/reporter -count=1go vet ./...go vet ./...go generate ./pkg/filetype/...with clean generated-file diffgo test -cover -coverprofile coverage.out ./...go test -count=1 ./...golangci-lint run ./... --timeout=10mgolangci-lint run ./... --timeout=10minpkg/validator/justfilenpm cinpm run build