Skip to content

Commit 354faa6

Browse files
[issue-374, review] more descriptive comments, remove unused LICENSE from Enum
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
1 parent e428de0 commit 354faa6

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/spdx/validation/license_expression_validator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def validate_license_expression(license_expression: Optional[
3838
if license_expression in [SpdxNoAssertion(), SpdxNone(), None]:
3939
return []
4040

41-
if context is None:
41+
if not context:
4242
context = ValidationContext(parent_id=parent_id, element_type=SpdxElementType.LICENSE_EXPRESSION, full_element=license_expression)
4343

4444
validation_messages = []
@@ -55,14 +55,16 @@ def validate_license_expression(license_expression: Optional[
5555
try:
5656
get_spdx_licensing().parse(str(license_expression), validate=True, strict=True)
5757
except ExpressionParseError as err:
58+
# This error is raised when an exception symbol is used as a license symbol and vice versa.
59+
# So far, it only catches the first such error in the provided string.
5860
validation_messages.append(
5961
ValidationMessage(
6062
f"{err}. for license_expression: {license_expression}",
6163
context)
6264
)
6365
except ExpressionError:
64-
# This happens for invalid symbols but the error provides only a string of these. On the other hand,
65-
# get_spdx_licensing().validate() gives an actual list of invalid symbols, so this is handled above.
66+
# This error is raised for invalid symbols within the license_expression, but it provides only a string of these.
67+
# On the other hand, get_spdx_licensing().validate() gives an actual list of invalid symbols, so this is handled above.
6668
pass
6769

6870
return validation_messages

src/spdx/validation/validation_message.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class SpdxElementType(Enum):
2626
PACKAGE = auto()
2727
FILE = auto()
2828
SNIPPET = auto()
29-
LICENSE = auto()
3029
ANNOTATION = auto()
3130
RELATIONSHIP = auto()
3231
EXTRACTED_LICENSING_INFO = auto()

0 commit comments

Comments
 (0)