Skip to content

Commit 25b1f63

Browse files
committed
style: fix code style
1 parent 2d9db57 commit 25b1f63

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/LicenseCompatibilityInterpreter.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ internal class LicenseCompatibilityInterpreter(
7474
resolvedCases[licenseExpression]?.let { return it.asResolved(licenseExpression) }
7575

7676
// Expand the license (e.g. expand OR_LATER into OR ... OR)
77-
val e = licenseEquivalence.expand(licenseExpression)
78-
79-
return when (e) {
77+
return when (val e = licenseEquivalence.expand(licenseExpression)) {
8078
is DisjunctionLicenseExpression ->
8179
// A or X => A
8280
e.unordered.takeIf { it.isNotEmpty() }?.map { eval(it) }?.reduce { a, b ->

plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/api/LicenseEquivalence.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class LicenseEquivalence(
5555
}
5656
}
5757
val result = seq.toSet()
58-
return if (result.isEmpty()) null else result
58+
return result.ifEmpty { null }
5959
}
6060

6161
fun expand(licenseExpression: LicenseExpression): LicenseExpression {

plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/api/LicenseExpression.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fun LicenseExpression.weight(): Int =
160160
is JustLicense -> 1
161161
is OrLaterLicense -> 2
162162
is WithException -> license.weight() + 1
163-
is ConjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.maxOrNull() ?: 1
164-
is DisjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.maxOrNull() ?: 1
163+
is ConjunctionLicenseExpression -> licenses.maxOfOrNull { it.weight() + 1 } ?: 1
164+
is DisjunctionLicenseExpression -> licenses.maxOfOrNull { it.weight() + 1 } ?: 1
165165
else -> TODO("Unexpected expression: ${this::class.simpleName}: $this")
166166
}

plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/release/AsfLicenseCategory.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ import com.github.vlsi.gradle.license.api.License
2222
import com.github.vlsi.gradle.license.api.LicenseEquivalence
2323
import com.github.vlsi.gradle.license.api.LicenseExpression
2424
import com.github.vlsi.gradle.license.api.LicenseExpressionSet
25-
import com.github.vlsi.gradle.license.api.LicenseExpressionSetOperation
2625
import com.github.vlsi.gradle.license.api.SpdxLicense
2726
import com.github.vlsi.gradle.license.api.SpdxLicenseException
28-
import com.github.vlsi.gradle.license.api.orLater
29-
import com.github.vlsi.gradle.license.api.with
3027

3128
/**
3229
* See https://apache.org/legal/resolved.html

0 commit comments

Comments
 (0)