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

Wrong input should result into an exception #766

Open
Joerki opened this issue Jan 28, 2025 · 2 comments
Open

Wrong input should result into an exception #766

Joerki opened this issue Jan 28, 2025 · 2 comments

Comments

@Joerki
Copy link

Joerki commented Jan 28, 2025

The code in spdx.py function is_compound_expression may run into an exception for several cases, and this results into a return False.

This is semantically overloaded.
In case of False we cannot distinguish between

  • the value cannot be interpreted at all (invalid characters)
  • it is a compound expression, but consists of partially unknown, but maybe valid simple (e.g. LicenseRef-*) expression(s)

So it may not be clear what is feasible of how to proceed in case of False.

In case of invalid characters the exception should not be caught, but (re)raised so that an appropriate exception handling can be applied.

The validate parameter should be made available in the is_compound_expression function to allow either both license item validation along with the compound check or compound check only.

@jkowalleck
Copy link
Member

understood.
@Joerki , could you draft a first pullrequest to showcase what your intuitive "fix" would look like?

@jkowalleck
Copy link
Member

this will be a change of public API -- a breaking change.
this is not a stopper, just a remark.

please continue :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants