8000 [issue-403] change spdx version handling during validation by armintaenzertng · Pull Request #404 · spdx/tools-python · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[issue-403] change spdx version handling during validation #404

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

Conversation

armintaenzertng
Copy link
Collaborator

fixes #403

Signed-off-by: Armin Tänzer armin.taenzer@tngtech.com

validation_messages: List[ValidationMessage] = []

validation_messages.extend(validate_creation_info(document.creation_info))
if not spdx_version:
spdx_version = document.creation_info.spdx_version
Copy link
Member

Choose a reason for hiding this comment

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

instead of setting the version here, I think it would be cleaner to make the version optional in the validation_messages.extend(validate_creation_info( call and only assert on it, if it is set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that it should be optional in validate_creation_info(), but we have to set the version here, nevertheless, as it is a mandatory field for other validations like validate_relationships() (and more to come later).

8000 Copy link
Member

Choose a reason for hiding this comment

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

you could still move the spdx version validation up, to have it cleaner

Copy link
Member

Choose a reason for hiding this comment

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

Its just a minor improvement, but:

Suggested change
spdx_version = document.creation_info.spdx_version
validation_messages.extend(validate_creation_info(document.creation_info, spdx_version))
if not spdx_version:
spdx_version = document.creation_info.spdx_version

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have extracted the version validation to be handled before everything else, now.

Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
@armintaenzertng armintaenzertng force-pushed the validationVersionFromDoc branch from f78e2af to c3f78a1 Compare January 5, 2023 11:04
@armintaenzertng armintaenzertng merged commit e455066 into spdx:refactor-python-tools Jan 5, 2023
@armintaenzertng armintaenzertng deleted the validationVersionFromDoc branch January 5, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment 5D7B
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0