-
Notifications
You must be signed in to change notification settings - Fork 10
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
add option to override parse function #7
base: main
Are you sure you want to change the base?
Conversation
What's your use case? This package doesn't requiring injection of Allowing users to override |
Yep. It's to be able to configure |
f1930d5
to
ccd1c31
Compare
rebased to resolve the conflicts. @kemitchell any thoughts on landing this to allow options to flow to My main goal is to allow the proposed licenseVisitor so that I can do satisifes like satisfies('mit', 'MIT OR Apache-2.0') |
If @motet-a is still available and interested in |
@dabutvin If you have pressing needs that require packages in the public registry, feel free to publish forks as new packages. We can always re-merge and deprecate. |
👍 Makes sense to me. |
ccd1c31
to
2487f0a
Compare
@kemitchell What's your thinking here? We are working out of a fork (OK) so this is not super critical but if would be great to just wrap up. This is a pretty modest change that would be still be relevant even if |
@jeffmcaffer I'd support a new package that implements a parser for the SPDX grammar with invalid identifiers, and a patch to spdx-expression-parse that runs that new parser, then validates that all identifiers are valid SPDX identifiers. Would be happy to host the new, generic parser here in |
@kemitchell my thinking here was that even with a more parser choices it would be good to allow satisfies to be configured with the parser to use (this PR) rather than an option to determine which parser to create. That is more future-proof and enables people to innovate on parsing as they see fit. |
@jeffmcaffer not ignoring you. Just very, very busy. |
@jeffmcaffer, by chance, is the root cause of your problem here a bottleneck getting new licenses onto the SPDX list? |
In a sense. IIRC, we need to handle expressions that have NOASSERTION as a valid element. We are not using LicenseRef to date but that would be a thing. In the case of this module it is really separating the concerns of parsing the expression and checking satisfaction. The other proposed changes to spdx-parse are certainly related |
Another aspect to this is enabling flexibility within the parser, such as being case insensitive. I think it's valuable to be able to have this work in certain situations satisfies('mit', 'MIT OR Apache-2.0') |
satisfies(correct('mit'), '(MIT OR Apache-2.0)') |
@jeffmcaffer I don't recall offhand. Is |
@kemitchell spdx-correct is pretty aggressive and resulting in false corrections. In any event, the scenario remains, it would be great to have parsing separate from satisfaction (or any other) computations. An alternate design approach is to allow calling either with a string (in which case the default So, for example, |
@jeffmcaffer: How would you feel about a major version that accepts an array of acceptable identifiers as rule and an AST in spdx-expression-parse shape? |
I did not answer @kemitchell's question about NOASSERTION. You are likely right but, most/all of the computations (e.g., satisfies) should not care, just parsing. the computations will just do string equality etc. Having NOASSERTION be in an expression is very important otherwise data is lost. For example, in trying to merge together the licenses from 3 files with license tool output of MIT, ISC, NOASSERTION, ideally we would get MIT AND ISC AND NOASSERTION. That helps readers know that there is something funky going on and they need to look deeper. Of course, it would be great if we could always have a id for every license but given the 000s of licenses out there and the 00s of SPDX ids, that's not practical. Even with the ongoing thinking about dynamic license identification and registration we will likely still have NOASSERTION cases. So, I would lobby to have NOASSERTION be a valid part of SPDX expressions. |
That could be OK with some tweaks
Perhaps we can roll back to your basic issues with the proposed change. Might be that we are just not aligned on a fundamental API design philosophy or something. More than happy to try and fit into the approach but am fuzzy on how. |
Don't go there yet! I'm mostly just really, really, really busy. But I have some time for this tonight. |
No description provided.