You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The validate function checks whether the given string is a valid SPDX expression (simple or compound expression) and checks the license values against license_expression module's license database (including SPDX list identifiers and LicenseRef-scancode-* values).
# the throw happens when internals crash due to unexpected input characters.
returnFalse
return0==len(res.errors)
To check for solely a valid compound expression, it has to be:
fromlicense_expressionimportget_spdx_licensing, OR, AND
...
try:
expression=__SPDX_EXPRESSION_LICENSING.parse(value, validate=True)
returntype(expression) in [OR, AND]
exceptException:
...
...
The class TestSpdxIsCompoundExpression test cases do not consider tests with a single valid SPDX ID from official license list or LicenseRef-scancode-* ID from license-expression's internal database.
With the definition
VALID_COMPOUND_EXPRESSIONS= {
# for valid test data see the spec: https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/'(MIT AND Apache-2.0)',
'BSD-2-Clause OR Apache-2.0',
'MIT',
'LicenseRef-scancode-3com-microcode'
}
all cases succeed, even the cases with simple expression.
According to the name and description of is_compound_expression a simple expression license parameter must reult into a failure.
The text was updated successfully, but these errors were encountered:
The function call
res = __SPDX_EXPRESSION_LICENSING.validate(value)
in spdx.py's
is_compound_expression
functionis not checking for a compound expression.
The validate function checks whether the given string is a valid SPDX expression (simple or compound expression) and checks the license values against license_expression module's license database (including SPDX list identifiers and LicenseRef-scancode-* values).
currently
cyclonedx-python-lib/cyclonedx/spdx.py
Lines 62 to 77 in b8cbb59
To check for solely a valid compound expression, it has to be:
The class TestSpdxIsCompoundExpression test cases do not consider tests with a single valid SPDX ID from official license list or LicenseRef-scancode-* ID from license-expression's internal database.
With the definition
all cases succeed, even the cases with simple expression.
According to the name and description of
is_compound_expression
a simple expression license parameter must reult into a failure.The text was updated successfully, but these errors were encountered: