Repository navigation
diff: report declared license changes - #314
Merged
andrew merged 5 commits intoAug 10, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds declared-license change detection to git pkgs diff-file and Git textconv output, enabling license additions/removals/changes to be surfaced alongside existing dependency diffs and in structured JSON.
Changes:
- Extend diff results and text output to include declared license changes (
license_changesin JSON + “Declared licenses:” section in text). - Parse and compare declared licenses in
diff-file, with sorting/deduplication for deterministic output. - Emit deterministic
license: ...lines fromdiff-driverand add targeted regression tests + documentation update.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents that diff-file also reports declared license changes for manifests. |
| cmd/diff.go | Adds license_changes to diff result JSON schema and prints declared-license changes in text output. |
| cmd/diff_file.go | Parses licenses from manifests and emits DeclaredLicenseChange entries when licenses differ. |
| cmd/diff_file_test.go | Adds unit test coverage for license sorting/deduplication helper. |
| cmd/diff_driver.go | Emits deterministic license: ... lines to support textconv diffs for license changes. |
| cmd/diff_driver_test.go | Adds tests ensuring license lines are emitted and raw content is not emitted after license removal. |
| cmd/analysis_test.go | Adds integration tests for diff-file declared-license output (text and JSON). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
andrew
requested changes
Aug 8, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
Two changes are still needed:
- Sanitize declared license values before cmd/diff.go writes them to terminal output. manifests.Parse returns these values verbatim, so control sequences currently pass straight through. Add a regression test for control characters.
- Split the added cmd/diff_driver_test.go subtests into separate test functions. They raise TestDiffDriver cognitive complexity from below the limit to 39, above the configured limit of 30.
Contributor
Author
|
Fixed both requested changes.
|
andrew
approved these changes
Aug 10, 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.
Closes #304
Summary
git pkgs diff-file.license_changesfield to JSON diff output with manifest path and before/after license lists.license: ...lines fromdiff-driverso Git textconv can display license changes.Verification
go build ./...go test -race ./... -count=1go mod tidy -diffgo tool golangci-lint run ./...git diff --check