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

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>
This commit is contained in:
William Murphy
2024-12-11 10:06:08 -05:00
committed by GitHub
parent 561ed50c2d
commit 445142886e
3 changed files with 53 additions and 24 deletions
+5
View File
@@ -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",
expression: "(MIT OR Apache-2.0)",
want: "(MIT OR Apache-2.0)",
},
{
name: "Invalid SPDX expression returns error",
expression: "MIT OR Apache-2.0 OR invalid",