-
Notifications
You must be signed in to change notification settings - Fork 324
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(spdx): Expose the validation of license text files' existence #9523
Closed
nnobelis
wants to merge
1
commit into
oss-review-toolkit:main
from
boschglobal:nnobelis/license_text_loading
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Have you considered refactoring the function to stop returning a lambda, in favour of the actual text / String?
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.
No, what would be the motivation to do it ? Just for code cleanup ?
BTW, do you know why it was decided to return a lambda in the first place ?
EDIT: I think @mnonnenmacher wrote the implementation. Could you please share your opinion on this ?
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.
Git blame is your friend, the rationale is in the commit message of 45a3087.
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.
Motivation IMO would be to have a cleaner / simpler (public) API.
The approach to do this lazily could still be kept, but by an ORT internal function.
(To me this API looks a bit more complicated than necessary / not clean enough, which I believe it should be fixed before made public).
I don't understand why exposing something like the following does not suffice (which I believe we already have).
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.
@fviernau I think this is already the case. The public function hides the lambda return type https://github.com/boschglobal/oss-review-toolkit/blob/ed2f67ed59a0d7970ab7d4efb0767622cef05659/utils/spdx/src/main/kotlin/Utils.kt#L113.
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.
This PR exposes return type
(() -> String)?
ofgetLicenseTextReader()
, doesn't it ?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.
Yes, but this is because the
LicenseTextProvider.getLicenseTextReader
also exposes this return type:ort/reporter/src/main/kotlin/LicenseTextProvider.kt
Line 36 in 6a7d63d
getLicenseText
->String?
getLicenseTextReader
->(() -> String)?
Therefore this is consistent with the current state of the implementation.