Skip to content

Commit 43e28ee

Browse files
Update dependency com.pinterest.ktlint:ktlint-cli to v1.2.0 (#1826)
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.2.0 * Fix ktlint --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jake Wharton <jw@squareup.com>
1 parent c81bd35 commit 43e28ee

File tree

25 files changed

+107
-3
lines changed

25 files changed

+107
-3
lines changed

build-support/src/main/resources/app/cash/redwood/buildsupport/flexboxHelpers.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,31 +91,38 @@ internal fun Node.applyModifier(parentModifier: Modifier, density: Density) {
9191
is GrowModifier -> {
9292
flexGrow = childModifier.value.toFloat()
9393
}
94+
9495
is ShrinkModifier -> {
9596
flexShrink = childModifier.value.toFloat()
9697
}
98+
9799
is MarginModifier -> with(density) {
98100
marginStart = childModifier.margin.start.toPx().toFloat()
99101
marginEnd = childModifier.margin.end.toPx().toFloat()
100102
marginTop = childModifier.margin.top.toPx().toFloat()
101103
marginBottom = childModifier.margin.bottom.toPx().toFloat()
102104
}
105+
103106
is HorizontalAlignmentModifier -> {
104107
alignSelf = childModifier.alignment.toAlignSelf()
105108
}
109+
106110
is VerticalAlignmentModifier -> {
107111
alignSelf = childModifier.alignment.toAlignSelf()
108112
}
113+
109114
is WidthModifier -> with(density) {
110115
val width = childModifier.width.toPx().toFloat()
111116
requestedMinWidth = width
112117
requestedMaxWidth = width
113118
}
119+
114120
is HeightModifier -> with(density) {
115121
val height = childModifier.height.toPx().toFloat()
116122
requestedMinHeight = height
117123
requestedMaxHeight = height
118124
}
125+
119126
is SizeModifier -> with(density) {
120127
val width = childModifier.width.toPx().toFloat()
121128
requestedMinWidth = width
@@ -124,6 +131,7 @@ internal fun Node.applyModifier(parentModifier: Modifier, density: Density) {
124131
requestedMinHeight = height
125132
requestedMaxHeight = height
126133
}
134+
127135
is FlexModifier -> {
128136
val flex = childModifier.value.coerceAtLeast(0.0).toFloat()
129137
flexGrow = flex

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ coil-compose = { module = "io.coil-kt.coil3:coil-compose-core", version.ref = "c
8080
coil-core = { module = "io.coil-kt.coil3:coil", version.ref = "coil" }
8181
coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coil" }
8282
turbine = "app.cash.turbine:turbine:1.0.0"
83-
ktlint = "com.pinterest.ktlint:ktlint-cli:1.1.1"
83+
ktlint = "com.pinterest.ktlint:ktlint-cli:1.2.0"
8484
ktlintComposeRules = "io.nlopez.compose.rules:ktlint:0.3.11"
8585
googleJavaFormat = "com.google.googlejavaformat:google-java-format:1.20.0"
8686
poko-gradlePlugin = "dev.drewhamilton.poko:poko-gradle-plugin:0.15.2"

redwood-gradle-plugin/src/main/kotlin/app/cash/redwood/gradle/RedwoodComposePlugin.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ public class RedwoodComposePlugin : KotlinCompilerPluginSupportPlugin {
9090
val parts = plugin.split(":")
9191
return when (parts.size) {
9292
1 -> SubpluginArtifact("org.jetbrains.compose.compiler", "compiler", parts[0])
93+
9394
3 -> SubpluginArtifact(parts[0], parts[1], parts[2])
95+
9496
else -> error(
9597
"""
9698
|Illegal format of '$EXTENSION_NAME.${RedwoodComposeExtension::kotlinCompilerPlugin.name}' property.

redwood-layout-composeui/src/commonMain/kotlin/app/cash/redwood/layout/composeui/utils.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,17 @@ internal fun measureSpecsToConstraints(
7777
minWidth = width.toInt()
7878
maxWidth = width.toInt()
7979
}
80+
8081
MeasureMode.AtMost -> {
8182
minWidth = 0
8283
maxWidth = width.toInt()
8384
}
85+
8486
MeasureMode.Undefined -> {
8587
minWidth = 0
8688
maxWidth = Constraints.Infinity
8789
}
90+
8891
else -> throw AssertionError()
8992
}
9093
val minHeight: Int
@@ -94,14 +97,17 @@ internal fun measureSpecsToConstraints(
9497
minHeight = height.toInt()
9598
maxHeight = height.toInt()
9699
}
100+
97101
MeasureMode.AtMost -> {
98102
minHeight = 0
99103
maxHeight = height.toInt()
100104
}
105+
101106
MeasureMode.Undefined -> {
102107
minHeight = 0
103108
maxHeight = Constraints.Infinity
104109
}
110+
105111
else -> throw AssertionError()
106112
}
107113
return Constraints(minWidth, maxWidth, minHeight, maxHeight)

redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewBox.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ internal class UIViewBox : Box<UIView> {
108108
is HorizontalAlignment -> {
109109
itemHorizontalAlignment = childModifier.alignment
110110
}
111+
111112
is VerticalAlignment -> {
112113
itemVerticalAlignment = childModifier.alignment
113114
}
115+
114116
is Width -> {
115117
requestedWidth = childModifier.width.toPlatformDp()
116118
}
119+
117120
is Height -> {
118121
requestedHeight = childModifier.height.toPlatformDp()
119122
}
@@ -132,17 +135,23 @@ internal class UIViewBox : Box<UIView> {
132135
x = 0.0
133136
childWidth = frame.useContents { this.size.width }
134137
}
138+
135139
CrossAxisAlignment.Start -> x = 0.0
140+
136141
CrossAxisAlignment.Center -> x = (frame.useContents { this.size.width } - childWidth) / 2.0
142+
137143
CrossAxisAlignment.End -> x = frame.useContents { this.size.width } - childWidth
138144
}
139145
when (itemVerticalAlignment) {
140146
CrossAxisAlignment.Stretch -> {
141147
y = 0.0
142148
childHeight = frame.useContents { this.size.height }
143149
}
150+
144151
CrossAxisAlignment.Start -> y = 0.0
152+
145153
CrossAxisAlignment.Center -> y = (frame.useContents { this.size.height } - childHeight) / 2.0
154+
146155
CrossAxisAlignment.End -> y = frame.useContents { this.size.height } - childHeight
147156
}
148157

@@ -167,6 +176,7 @@ internal class UIViewBox : Box<UIView> {
167176
maxRequestedWidth = childModifier.width.value
168177
}
169178
}
179+
170180
is Height -> {
171181
if (childModifier.height.value > maxRequestedHeight) {
172182
maxRequestedHeight = childModifier.height.value
@@ -184,6 +194,7 @@ internal class UIViewBox : Box<UIView> {
184194
maxItemWidth = size.useContents { this.width }
185195
maxItemHeight = size.useContents { this.height }
186196
}
197+
187198
Constraint.Wrap -> { // Fill Wrap
188199
maxItemWidth = size.useContents { this.width }
189200
maxItemHeight = typedSubviews
@@ -192,6 +203,7 @@ internal class UIViewBox : Box<UIView> {
192203
}
193204
}
194205
}
206+
195207
Constraint.Wrap -> {
196208
when (heightConstraint) {
197209
Constraint.Fill -> { // Wrap Fill
@@ -200,6 +212,7 @@ internal class UIViewBox : Box<UIView> {
200212
.max()
201213
maxItemHeight = size.useContents { this.height }
202214
}
215+
203216
Constraint.Wrap -> { // Wrap Wrap
204217
val unconstrainedSizes = typedSubviews
205218
.map { it.sizeThatFits(size) }

redwood-lazylayout-widget/src/commonMain/kotlin/app/cash/redwood/lazylayout/widget/LazyListUpdateProcessor.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public abstract class LazyListUpdateProcessor<V : Any, W : Any> {
220220
itemsBefore.removeRange(0, delta)
221221
deleteRows(0, delta)
222222
}
223+
223224
newItemsBefore > itemsBefore.size -> {
224225
// Grow the before window.
225226
val delta = newItemsBefore - itemsBefore.size
@@ -236,6 +237,7 @@ public abstract class LazyListUpdateProcessor<V : Any, W : Any> {
236237
itemsAfter.removeRange(itemsAfter.size - delta, itemsAfter.size)
237238
deleteRows(index, delta)
238239
}
240+
239241
newItemsAfter > itemsAfter.size -> {
240242
// Grow the after window.
241243
val delta = newItemsAfter - itemsAfter.size

redwood-lazylayout-widget/src/commonMain/kotlin/app/cash/redwood/lazylayout/widget/SparseList.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ internal class SparseList<T> : AbstractList<T?>() {
7474
}
7575
null
7676
}
77+
7778
else -> {
7879
externalIndexes.removeAt(searchIndex)
7980
for (i in searchIndex until externalIndexes.size) {
@@ -102,6 +103,7 @@ internal class SparseList<T> : AbstractList<T?>() {
102103
externalIndexes.add(insertIndex, index)
103104
insertIndex + 1
104105
}
106+
105107
else -> insertIndex
106108
}
107109

@@ -155,12 +157,14 @@ internal class SparseList<T> : AbstractList<T?>() {
155157
nextExternalIndex++
156158
return
157159
}
160+
158161
// Return a non-null element and bump the internal index.
159162
nextInternalIndex < elements.size -> {
160163
setNext(elements[nextInternalIndex])
161164
nextInternalIndex++
162165
nextExternalIndex++
163166
}
167+
164168
else -> done()
165169
}
166170
}

redwood-protocol-guest/src/commonTest/kotlin/app/cash/redwood/protocol/guest/ProtocolTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,19 @@ class ProtocolTest {
168168
0 -> {
169169
{ state = 1 }
170170
}
171+
171172
1 -> {
172173
{ state = 2 }
173174
}
175+
174176
2 -> {
175177
null
176178
}
179+
177180
3 -> {
178181
null
179182
}
183+
180184
else -> fail()
181185
},
182186
)
@@ -239,9 +243,11 @@ class ProtocolTest {
239243
0 -> {
240244
{ state = 1 }
241245
}
246+
242247
1 -> {
243248
{ state = 2 }
244249
}
250+
245251
else -> fail()
246252
},
247253
)

redwood-protocol-host/src/commonMain/kotlin/app/cash/redwood/protocol/widget/ProtocolBridge.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class ProtocolBridge<W : Any>(
6868
"Insert attempted to replace existing widget with ID ${change.id.value}"
6969
}
7070
}
71+
7172
is ChildrenChange -> {
7273
val node = node(id)
7374
val children = node.children(change.tag) ?: continue
@@ -76,9 +77,11 @@ public class ProtocolBridge<W : Any>(
7677
val child = node(change.childId)
7778
children.insert(change.index, child)
7879
}
80+
7981
is Move -> {
8082
children.move(change.fromIndex, change.toIndex, change.count)
8183
}
84+
8285
is Remove -> {
8386
children.remove(change.index, change.count)
8487
@Suppress("ConvertArgumentToSet") // Compose side guarantees set semantics.
@@ -91,6 +94,7 @@ public class ProtocolBridge<W : Any>(
9194
changedWidgets += widget
9295
}
9396
}
97+
9498
is ModifierChange -> {
9599
val modifier = change.elements.fold<_, Modifier>(Modifier) { modifier, element ->
96100
modifier.then(factory.createModifier(element))
@@ -103,6 +107,7 @@ public class ProtocolBridge<W : Any>(
103107
changedWidgets += widget
104108
}
105109
}
110+
106111
is PropertyChange -> {
107112
val node = node(change.id)
108113
node.apply(change, eventSink)

redwood-runtime/src/commonMain/kotlin/app/cash/redwood/ui/Margin.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ public class Margin(
3333
start != end || top != bottom -> {
3434
"Margin(start=$start, end=$end, top=$top, bottom=$bottom)"
3535
}
36+
3637
start != top -> {
3738
"Margin(horizontal=$start, vertical=$top)"
3839
}
40+
3941
else -> "Margin(all=$start)"
4042
}
4143

0 commit comments

Comments
 (0)