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

BugFix : Removing case sensitivity of licenseIds #784

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def validate_license_expression(
)

validation_messages = []
license_ref_ids: List[str] = [license_ref.license_id for license_ref in document.extracted_licensing_info]
license_ref_ids: List[str] = [license_ref.license_id.lower() for license_ref in document.extracted_licensing_info]
Copy link
Member

Choose a reason for hiding this comment

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

going to .lower() feels wrong, as the upper case is the default for most licenses?

Copy link
Author

Choose a reason for hiding this comment

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

Should I take any other approach to make licenseIds case insensitive.(we have couple of other methods other than .lower())

Or keeping them case sensitive is just fine:(

Well, what are your thoughts?

Copy link
Author

@puneeth072003 puneeth072003 Jan 2, 2024

Choose a reason for hiding this comment

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

Sorry, I'm new to licenses and stuff.

It would be great to have your opinion

Copy link
Member

Choose a reason for hiding this comment

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

I think uppercase would be more consistent


for non_spdx_token in spdx_licensing.validate(license_expression).invalid_symbols:
if ":" in non_spdx_token:
Expand Down Expand Up @@ -72,7 +72,7 @@ def validate_license_expression(
)
)

elif non_spdx_token not in license_ref_ids:
elif non_spdx_token.lower() not in license_ref_ids:
validation_messages.append(
ValidationMessage(
f"Unrecognized license reference: {non_spdx_token}. license_expression must only use IDs from the "
Expand Down