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-403] change spdx version handling during validation #404

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).

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.

src/validation/creation_info_validator.py Outdated Show resolved Hide resolved
src/validation/relationship_validator.py Show resolved Hide resolved
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants