-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[issue-788] fix tag-value parser to allow NONE and NOASSERTION for pa… #816
Conversation
d761116
to
a81b3aa
Compare
based this PR on #814 to (hopefully) have a successful CI |
475412d
to
140998d
Compare
@@ -180,7 +180,7 @@ def p_current_element_error(self, p): | |||
"file_comment : FILE_COMMENT text_or_line\n " | |||
"file_license_concluded : FILE_LICENSE_CONCLUDED license_or_no_assertion_or_none\n " | |||
"package_name : PKG_NAME LINE\n description : PKG_DESCRIPTION text_or_line\n " | |||
"summary : PKG_SUMMARY text_or_line\n source_info : PKG_SOURCE_INFO text_or_line\n " | |||
"summary : PKG_SUMMARY text_or_line\n source_info : PKG_SOURCE_INFO text_or_line_including_no_assertion\n " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem at hand can also occur for other text_or_line
fields apart from source_info
. Basically all properties that use text_or_line
. So I would believe that the whole text_or_line
property has to be adapted, not only for the source information case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the same problem will arise when somebody uses NONE
. So best solve this one here, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I changed the behaviour such that text_or_line
parses NOASSERTION and NONE as regular strings and for fields that allow NOASSERTION or NONE, like the license fields these strings will be serialized as the corresponding SpdxNoAssertion
and SpdxNone
objects
2423d41
to
422e6e0
Compare
@@ -83,6 +83,26 @@ def test_parse_package(): | |||
assert package.valid_until_date == datetime(2022, 1, 1, 12) | |||
|
|||
|
|||
def test_parse_package_with_no_assertion_as_source_info(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, this test should include all fields that can sport text only, all filled with either NONE or NOASSERTION. Might be bit overkill, though.
However, at least a field filled with NONE should be present, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding all cases would be overkill imho but I added a field that contains NONE and is parsed as text.
@@ -83,6 +83,26 @@ def test_parse_package(): | |||
assert package.valid_until_date == datetime(2022, 1, 1, 12) | |||
|
|||
|
|||
def test_parse_package_with_no_assertion_as_source_info(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to rename this to test_parse_none_and_no_assertion_as_text
or something. Otherwise we emphasize the source info despite it not being a special case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I also moved the test to the test_tag_valu_parser.py
module as it is not specific to packages.
43fde85
to
1ab91dd
Compare
…ckage source info as they are valid strings Signed-off-by: Meret Behrens <[email protected]> # fixes 788
Signed-off-by: Meret Behrens <[email protected]>
…ckage source info as they are valid strings Signed-off-by: Meret Behrens <[email protected]>
Signed-off-by: Meret Behrens <[email protected]>
1ab91dd
to
cd676e3
Compare
@meretp & @armintaenzertng : can this be merged? |
…ckage source info as they are valid strings
fixes 788
Signed-off-by: Meret Behrens [email protected]