Skip to content

Commit 9463f7e

Browse files
don't use 'it'.
1 parent 5b92570 commit 9463f7e

File tree

1 file changed

+19
-20
lines changed
  • src/main/kotlin/com/autonomousapps/internal

1 file changed

+19
-20
lines changed

src/main/kotlin/com/autonomousapps/internal/Bundles.kt

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import com.autonomousapps.graph.Graphs.children
77
import com.autonomousapps.graph.Graphs.reachableNodes
88
import com.autonomousapps.model.*
99
import com.autonomousapps.model.Coordinates.Companion.copy
10-
import com.autonomousapps.model.internal.declaration.Bucket
1110
import com.autonomousapps.model.internal.DependencyGraphView
11+
import com.autonomousapps.model.internal.declaration.Bucket
1212
import com.autonomousapps.model.internal.intermediates.Usage
1313

1414
/**
@@ -89,54 +89,53 @@ internal class Bundles private constructor(private val dependencyUsages: Map<Coo
8989
bundleRules.primaries.forEach { (name, primaryId) ->
9090
val regexes = bundleRules.rules[name]!!
9191
dependencyGraph.values.forEach { view ->
92-
val projectNode = view.graph.nodes().find { it.identifier == projectPath }!!
92+
val projectNode = view.graph.nodes().find { node -> node.identifier == projectPath }!!
9393
view.graph.reachableNodes(projectNode)
9494
.find { child -> child.matches(primaryId) }
9595
?.let { primaryNode ->
9696
val subordinateNodes = view.graph.reachableNodes(primaryNode)
97-
subordinateNodes.filter { subordinateNode ->
98-
regexes.any { subordinateNode.matches(it) }
99-
}.forEach { subordinateNode ->
100-
bundles.setPrimary(primaryNode, subordinateNode)
101-
}
97+
subordinateNodes
98+
.filter { subordinateNode ->
99+
regexes.any { regex -> subordinateNode.matches(regex) }
100+
}
101+
.forEach { subordinateNode -> bundles.setPrimary(primaryNode, subordinateNode) }
102102
}
103103
}
104104
}
105105

106106
// Handle bundles that don't have a primary entry point
107107
dependencyGraph.values.forEach { view ->
108108
// Find the node that represents the current project, which always exists in the graph
109-
val projectNode = view.graph.nodes().find { it.identifier == projectPath }!!
109+
val projectNode = view.graph.nodes().find { node -> node.identifier == projectPath }!!
110110
view.graph.children(projectNode).forEach { parentNode ->
111111
val rules = bundleRules.matchingBundles(parentNode)
112112

113113
// handle user-supplied bundles
114114
if (rules.isNotEmpty()) {
115115
val reachableNodes = view.graph.reachableNodes(parentNode)
116-
rules.values.forEach { regexes ->
117-
reachableNodes.filter { childNode ->
118-
regexes.any { childNode.matches(it) }
119-
}.forEach { childNode ->
120-
bundles[parentNode] = childNode
116+
rules.values
117+
.forEach { regexes ->
118+
reachableNodes
119+
.filter { childNode -> regexes.any { regex -> childNode.matches(regex) } }
120+
.forEach { childNode -> bundles[parentNode] = childNode }
121121
}
122-
}
123122
}
124123

125124
// handle dynamic ktx bundles
126125
if (ignoreKtx) {
127126
if (parentNode.identifier.endsWith("-ktx")) {
128127
val baseId = parentNode.identifier.substringBeforeLast("-ktx")
129-
view.graph.children(parentNode).find { child ->
130-
child.matches(baseId)
131-
}?.let { bundles[parentNode] = it }
128+
view.graph.children(parentNode)
129+
.find { child -> child.matches(baseId) }
130+
?.let { child -> bundles[parentNode] = child }
132131
}
133132
}
134133

135134
fun implicitKmpBundleFor(target: String) {
136135
val candidate = "${parentNode.identifier}-${target}"
137136
view.graph.children(parentNode)
138-
.find { it.matches(candidate) }
139-
?.let { bundles[parentNode] = it }
137+
.find { child -> child.matches(candidate) }
138+
?.let { child -> bundles[parentNode] = child }
140139
}
141140

142141
// Implicit KMP bundles for JVM and Android (inverse form compared to ktx)
@@ -152,7 +151,7 @@ internal class Bundles private constructor(private val dependencyUsages: Map<Coo
152151
val kmpIdentifier = candidate.identifier.substringBeforeLast(suffix)
153152
val kmp = candidate.copy(
154153
kmpIdentifier,
155-
GradleVariantIdentification(setOf(kmpIdentifier), candidate.gradleVariantIdentification.attributes)
154+
GradleVariantIdentification(setOf(kmpIdentifier), candidate.gradleVariantIdentification.attributes),
156155
)
157156
if (view.graph.hasEdgeConnecting(kmp, candidate)) {
158157
kmp to candidate

0 commit comments

Comments
 (0)