Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: stop omitting redundantly parenthesized licenses in CDX formatter #3517

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

willmurphyscode
Copy link
Contributor

@willmurphyscode willmurphyscode commented Dec 10, 2024

Previously, a bug in the formatter would cause SPDX expressions that were surrounded in redundant parentheses to be dropped instead of normalized.

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

@willmurphyscode willmurphyscode self-assigned this Dec 10, 2024
@willmurphyscode willmurphyscode marked this pull request as draft December 10, 2024 22:06
@willmurphyscode willmurphyscode marked this pull request as ready for review December 11, 2024 12:38
@willmurphyscode
Copy link
Contributor Author

I think there might still be issues with the generated expressions. Back to draft for now.

Previously, a bug in the formatter would cause SPDX expressions that
were surrounded in redundant parentheses to be dropped instead of
normalized.

Signed-off-by: Will Murphy <willmurphyscode@users.noreply.github.com>
@willmurphyscode willmurphyscode force-pushed the fix-redundant-parens-in-spdx-license branch from d2e29bd to 092c374 Compare December 11, 2024 14:27
@@ -20,6 +20,11 @@ func TestParseExpression(t *testing.T) {
expression: "MIT OR Apache-2.0",
want: "MIT OR Apache-2.0",
},
{
name: "accept redundant parentheses",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test case was never failing on main, but it was the first place I looked, so adding it seems worthwhile to me.

@willmurphyscode willmurphyscode merged commit 4451428 into main Dec 11, 2024
12 checks passed
@willmurphyscode willmurphyscode deleted the fix-redundant-parens-in-spdx-license branch December 11, 2024 15:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

SPDX expressions are lost from CycloneDX if they contain extra parenthesis
2 participants