Skip to content

Commit 077cb02

Browse files
committed
chore: Prefer enumEntries over enumValues
This fixes an inspection hint. Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
1 parent 04eeba9 commit 077cb02

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

buildSrc/src/main/kotlin/ort-kotlin-conventions.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import dev.detekt.gradle.Detekt
2121
import dev.detekt.gradle.report.ReportMergeTask
2222

23+
import kotlin.enums.enumEntries
24+
2325
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2426
import org.gradle.api.tasks.testing.logging.TestLogEvent
2527
import org.gradle.kotlin.dsl.dependencies
@@ -154,7 +156,7 @@ tasks.withType<Jar>().configureEach {
154156
}
155157

156158
val maxKotlinJvmTarget = runCatching { JvmTarget.fromTarget(javaLanguageVersion) }
157-
.getOrDefault(enumValues<JvmTarget>().max())
159+
.getOrDefault(enumEntries<JvmTarget>().max())
158160

159161
val mergeDetektReportsTaskName = "mergeDetektReports"
160162
val mergeDetektReports = if (rootProject.tasks.findByName(mergeDetektReportsTaskName) != null) {

plugins/license-fact-providers/spdx/src/test/kotlin/SpdxLicenseFactProviderTest.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import io.kotest.matchers.string.beEmpty
2929
import io.kotest.matchers.string.contain
3030
import io.kotest.matchers.string.haveLength
3131

32+
import kotlin.enums.enumEntries
33+
3234
import org.ossreviewtoolkit.utils.spdx.SpdxLicense
3335
import org.ossreviewtoolkit.utils.spdx.SpdxLicenseException
3436

@@ -43,13 +45,13 @@ class SpdxLicenseFactProviderTest : WordSpec({
4345
}
4446

4547
"return the license text for all SPDX licenses" {
46-
enumValues<SpdxLicense>().forAll {
48+
enumEntries<SpdxLicense>().forAll {
4749
provider.getLicenseText(it.id)?.text shouldNot beEmpty()
4850
}
4951
}
5052

5153
"return the license text for all SPDX exceptions" {
52-
enumValues<SpdxLicenseException>().forAll {
54+
enumEntries<SpdxLicenseException>().forAll {
5355
provider.getLicenseText(it.id)?.text shouldNot beEmpty()
5456
}
5557
}
@@ -61,13 +63,13 @@ class SpdxLicenseFactProviderTest : WordSpec({
6163

6264
"hasLicenseText()" should {
6365
"return true for all SPDX licenses" {
64-
enumValues<SpdxLicense>().forAll {
66+
enumEntries<SpdxLicense>().forAll {
6567
provider.hasLicenseText(it.id) shouldBe true
6668
}
6769
}
6870

6971
"return true for all SPDX exceptions" {
70-
enumValues<SpdxLicenseException>().forAll {
72+
enumEntries<SpdxLicenseException>().forAll {
7173
provider.hasLicenseText(it.id) shouldBe true
7274
}
7375
}

0 commit comments

Comments
 (0)