-
Notifications
You must be signed in to change notification settings - Fork 314
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
fix(reporter): Only write major / minor SPDX license list version info #9607
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9607 +/- ##
============================================
- Coverage 68.03% 68.02% -0.02%
Complexity 1287 1287
============================================
Files 249 249
Lines 8826 8828 +2
Branches 920 921 +1
============================================
Hits 6005 6005
- Misses 2432 2433 +1
- Partials 389 390 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Fixes #9606. Signed-off-by: Sebastian Schuberth <[email protected]>
c360479
to
f3c6855
Compare
@@ -172,7 +172,7 @@ internal object SpdxDocumentModelMapper { | |||
comment = params.creationInfoComment, | |||
created = Instant.now().truncatedTo(ChronoUnit.SECONDS), | |||
creators = creators, | |||
licenseListVersion = SpdxLicense.LICENSE_LIST_VERSION.substringBefore("-") | |||
licenseListVersion = SpdxLicense.LICENSE_LIST_VERSION.split('.').take(2).joinToString(".") |
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 solution works, but it may be more efficient this other implementation, saving the splitting and joining back
licenseListVersion = SpdxLicense.LICENSE_LIST_VERSION.split('.').take(2).joinToString(".") | |
val licenseList = SpdxLicense.LICENSE_LIST_VERSION | |
licenseListVersion = licenseList.substring(0, licenseList.lastIndexOf("_")) |
I do not really know much Kotlin, so take this with a pinch of salt.
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.
While lastIndexOf("_")
would need to use "."
instead, it would also not work for something like "1.2.3.4" as the input. Not that I'm expecting that to happen, but you never know 😉
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.
true!
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.
BTW, otherwise I would have simply used substringBeforeLast('.')
.
Fixes #9606.