Skip to content
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-650] raise ParsingError if elements don't have an SPDXID #652

Merged
merged 1 commit into from
May 15, 2023

Conversation

meretp
Copy link
Collaborator

@meretp meretp commented May 12, 2023

fixes #650

Copy link
Collaborator

@armintaenzertng armintaenzertng left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, I have a couple of questions, though.

tests/spdx/parser/rdf/test_file_parser.py Outdated Show resolved Hide resolved
@@ -140,7 +140,7 @@ def get_value_from_graph(
# this is a helper method to cast some rdf types from graph.value() to be compatible with the
# code that follows
value = graph.value(subject=subject, predicate=predicate, object=_object, default=default, any=_any)
if value and not isinstance(value, (URIRef, Literal, BNode)):
if value != _any and value and not isinstance(value, (URIRef, Literal, BNode)):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't get the value != _any part here. _any is a bool, why should it be equal to value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, sorry, mixed the values here. This needs to be value != default. While working on this I noticed that an error about wrong types would be logged if a package has no files_analyzed field. This is as the changes you commented below not related to the origin issue and rather a fix for the wrapper methods introduced with #563. Shall I create a separate PR for these changes?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, please do :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#653
The PR should be merged first as the test in this PR fails without these changes.

src/spdx_tools/spdx/parser/rdf/package_parser.py Outdated Show resolved Hide resolved
@meretp meretp force-pushed the issue_650_fix_rdf_parser branch from 492af03 to ecdd0d1 Compare May 12, 2023 12:47
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
@meretp meretp force-pushed the issue_650_fix_rdf_parser branch from ecdd0d1 to 0f41ee0 Compare May 15, 2023 06:54
Copy link
Collaborator

@armintaenzertng armintaenzertng left a comment

Choose a reason for hiding this comment

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

Thanks! :)

@meretp meretp merged commit acf56a0 into spdx:main May 15, 2023
@meretp meretp deleted the issue_650_fix_rdf_parser branch May 15, 2023 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RDF-parser raises no error if an element has no SPDXID
2 participants