-
Notifications
You must be signed in to change notification settings - Fork 317
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
feat(model)!: Stop silently ignoring invalid declared license mappings #8691
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8691 +/- ##
=========================================
Coverage 67.79% 67.79%
Complexity 1164 1164
=========================================
Files 243 243
Lines 7711 7711
Branches 861 861
=========================================
Hits 5228 5228
Misses 2127 2127
Partials 356 356
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
365f499
to
c12804d
Compare
@oss-review-toolkit/core-devs gentle ask for review |
I wonder whether this is the best place to implement this kind of check. My guess is that the "swallowing" of the mapping happens due to
I'd rather see a check being implemented in that function, as it then would also apply to built-in declared license mappings, to guards against typos etc. in declared-license-mapping.yml. As I agree that having a mapping configured that maps to some value that we'd discard later on anyway dos not make any sense, I was playing around with a proposal that now ended up in another / additional PR, see #8730. |
I deliberately put it there for the reason mentioned in the commit message [1], as I believe knowing the file path of the incorrect entry must be in the error. [1] ... ORT now fails with the error message pointing to the problematic curation file path. |
While I agree that having the file path in the error message would be beneficial, I'm still unsure if this is the right place to add this kind of check. I'd rather include this as another PR check in the package curation repository then. But I'm happy to also hear @mnonnenmacher's opinion here. Another reason why I'm a bit reluctant to add more of these |
e1b2176
to
9f8235c
Compare
9f8235c
to
12a2a8e
Compare
init { | ||
declaredLicenseMapping.values.forEach { spdxExpression -> | ||
require(spdxExpression.isValid(ALLOW_LICENSEREF_EXCEPTIONS)) { | ||
"The value '$spdxExpression' within the declared license mapping is not a valid SPDX expression." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO "within" sounds a bit strange here. How about:
"The declared license '$key' is configured to map to '$value' which is not a valid SPDX expression."
(So I would also include the key into the exception message for clarity.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text looks unchanged. Did you forget to push?
12a2a8e
to
80e3ca8
Compare
Prepare for being more strict about the validity of SPDX expression used in the values of the `Map`. Signed-off-by: Frank Viernau <[email protected]>
Previously, `PackageCuration.apply()` silently ignored declared license mapping entries with invalid SPDX expressions. For example, if one accidentally omits the `LicenseRef-` prefix, the mapping is just silently ignored. Add a check that all values in the `Map` are valid SPDX expression into the constructor, to fail as early as possible. When used via a `FilePackageCurationProvider`, ORT now fails with the error message pointing to the problematic curation file path. Fixes: #7828. Signed-off-by: Frank Viernau <[email protected]>
80e3ca8
to
8ce0d9a
Compare
Previously,
PackageCuration.apply()
silently ignored declared license mapping entries with invalid SPDX expressions. For example, if one accidentally omits theLicenseRef-
prefix, the mapping is just silently ignored.Add a check that all values in the
Map
are valid SPDX expression into the constructor, to fail as early as possible. When used via aFilePackageCurationProvider
, ORT now fails with the error message pointing to the problematic curation file path.Fixes: #7828.