Skip to content

Add SPDX identifier rewriting - #23

Merged
andrew merged 2 commits into
mainfrom
feature/strict-expression-map
Jul 30, 2026
Merged

Add SPDX identifier rewriting#23
andrew merged 2 commits into
mainfrom
feature/strict-expression-map

Conversation

@andrew

@andrew andrew commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Adds RewriteIdentifiers for replacing license IDs, exception IDs, and license references in a parsed SPDX expression while preserving operator precedence. Documents the API and adds focused coverage plus a benchmark.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new public API to rewrite identifiers within a parsed SPDX expression (licenses, exceptions, and license references) while preserving expression structure/precedence, along with documentation, tests, and a benchmark.

Changes:

  • Introduces RewriteIdentifiers and an internal AST-rewrite helper to apply an identifier mapping without re-parsing.
  • Adds focused unit tests for rewrite ordering/immutability and special values, plus a benchmark.
  • Documents the new API in the README with an example.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
rewrite.go Adds the identifier-rewriting API and recursive AST traversal.
rewrite_test.go Adds unit tests and a benchmark for the new rewriting behavior.
README.md Documents how to use RewriteIdentifiers with an example.

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

Comment thread rewrite.go Outdated
Comment thread rewrite_test.go Outdated
@andrew
andrew merged commit d392f44 into main Jul 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants