Skip to content

Commit

Permalink
Update dependency com.pinterest.ktlint:ktlint-cli to v1.3.0 (#2082)
Browse files Browse the repository at this point in the history
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.3.0

* Disable expression body rule, reformat

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <[email protected]>
  • Loading branch information
renovate[bot] and JakeWharton authored Jun 5, 2024
1 parent fa42afa commit 5205fe8
Show file tree
Hide file tree
Showing 44 changed files with 122 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ class RedwoodBuildPlugin : Plugin<Project> {
)
.editorConfigOverride(
mapOf(
// Lowercase names are great for grouping multiple functions and/or types.
"ktlint_standard_filename" to "disabled",
// Making something an expression body should be a choice around readability.
"ktlint_standard_function-expression-body" to "disabled",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_compose_compositionlocal-allowlist" to "disabled",
),
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ coil-compose = { module = "io.coil-kt.coil3:coil-compose-core", version.ref = "c
coil-core = { module = "io.coil-kt.coil3:coil", version.ref = "coil" }
coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coil" }
turbine = "app.cash.turbine:turbine:1.1.0"
ktlint = "com.pinterest.ktlint:ktlint-cli:1.2.1"
ktlint = "com.pinterest.ktlint:ktlint-cli:1.3.0"
ktlintComposeRules = "io.nlopez.compose.rules:ktlint:0.4.3"
googleJavaFormat = "com.google.googlejavaformat:google-java-format:1.22.0"
poko-gradlePlugin = "dev.drewhamilton.poko:poko-gradle-plugin:0.15.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ internal class NodeApplier<W : Any>(
override val widgetSystem: WidgetSystem<W>,
root: Widget.Children<W>,
private val onEndChanges: () -> Unit,
) : AbstractApplier<Node<W>>(ChildrenNode(root)), RedwoodApplier<W> {
) : AbstractApplier<Node<W>>(ChildrenNode(root)),
RedwoodApplier<W> {
private var closed = false
private val changedWidgets = LinkedHashSet<ChangeListener>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import app.cash.redwood.widget.ChangeListener
import com.example.redwood.testapp.testing.ButtonValue
import com.example.redwood.testapp.widget.Button

class ListeningButton : Button<WidgetValue>, ChangeListener {
class ListeningButton :
Button<WidgetValue>,
ChangeListener {
private val changes = ArrayList<String>()
fun changes(): List<String> {
val snapshot = changes.toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import app.cash.redwood.widget.Widget
import com.example.redwood.testapp.testing.TestRowValue
import com.example.redwood.testapp.widget.TestRow

class ListeningTestRow : TestRow<WidgetValue>, ChangeListener {
class ListeningTestRow :
TestRow<WidgetValue>,
ChangeListener {
private val changes = ArrayList<String>()
fun changes(): List<String> {
val snapshot = changes.toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinCompile

internal class RedwoodComposeExtensionImpl(
private val project: Project,
) : RedwoodComposeExtension, DangerZone {
) : RedwoodComposeExtension,
DangerZone {
private var metricsEnabled = false
private var reportsEnabled = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class ComposeUiFlexContainerTest(

class ComposeTestFlexContainer private constructor(
private val delegate: ComposeUiFlexContainer,
) : TestFlexContainer<@Composable () -> Unit>, FlexContainer<@Composable () -> Unit> by delegate {
) : TestFlexContainer<@Composable () -> Unit>,
FlexContainer<@Composable () -> Unit> by delegate {
private var childCount = 0
override val children: ComposeWidgetChildren = delegate.children
constructor(direction: FlexDirection, backgroundColor: Int) : this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ private class HTMLSpacer(
private class HTMLFlexElementChildren(
private val container: HTMLElement,
private val delegate: HTMLElementChildren = HTMLElementChildren(container),
) :
Widget.Children<HTMLElement> by delegate {
) : Widget.Children<HTMLElement> by delegate {
override fun onModifierUpdated(index: Int, widget: Widget<HTMLElement>) {
widget.applyModifiers(clearStyles = true)
delegate.onModifierUpdated(index, widget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,9 @@ abstract class AbstractFlexContainerTest<T : Any> {
}
}

interface TestFlexContainer<T : Any> : Widget<T>, ChangeListener {
interface TestFlexContainer<T : Any> :
Widget<T>,
ChangeListener {
override val value: T
val children: Widget.Children<T>
fun width(width: Constraint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ fun assumeTrue(b: Boolean) {

internal data class CrossAxisAlignmentImpl(
override val alignment: CrossAxisAlignment,
) : HorizontalAlignment, VerticalAlignment
) : HorizontalAlignment,
VerticalAlignment

internal data class WidthImpl(
override val width: Dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import platform.darwin.NSInteger

internal class UIViewFlexContainer(
direction: FlexDirection,
) : YogaFlexContainer<UIView>, ChangeListener {
) : YogaFlexContainer<UIView>,
ChangeListener {
private val yogaView: YogaUIView = YogaUIView(
applyModifier = { node, index ->
node.applyModifier(node.context as Modifier, Density.Default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class UIViewFlexContainerTest(

class UIViewTestFlexContainer internal constructor(
private val delegate: UIViewFlexContainer,
) : TestFlexContainer<UIView>, FlexContainer<UIView> by delegate, ChangeListener by delegate {
) : TestFlexContainer<UIView>,
FlexContainer<UIView> by delegate,
ChangeListener by delegate {
private var childCount = 0
override val children: Widget.Children<UIView> = delegate.children

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import app.cash.redwood.widget.ViewGroupChildren

internal class ViewBox(
context: Context,
) : FrameLayout(context), Box<View> {
) : FrameLayout(context),
Box<View> {
private val density = Density(context.resources)
private var horizontalAlignment = CrossAxisAlignment.Start
private var verticalAlignment = CrossAxisAlignment.Start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import app.cash.redwood.yoga.isHorizontal
internal class ViewFlexContainer(
private val context: Context,
private val direction: FlexDirection,
) : YogaFlexContainer<View>, ChangeListener {
) : YogaFlexContainer<View>,
ChangeListener {
private val yogaLayout: YogaLayout = YogaLayout(
context,
applyModifier = { node, index ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import kotlin.math.min

internal class ViewSpacer(
context: Context,
) : View(context), Spacer<View> {
) : View(context),
Spacer<View> {
private val density = Density(context.resources)

override val value get() = this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class ViewFlexContainerTest(

class ViewTestFlexContainer internal constructor(
private val delegate: ViewFlexContainer,
) : TestFlexContainer<View>, FlexContainer<View> by delegate, ChangeListener by delegate {
) : TestFlexContainer<View>,
FlexContainer<View> by delegate,
ChangeListener by delegate {
private var childCount = 0
override val children: ViewGroupChildren = delegate.children
override fun add(widget: Widget<View>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ package app.cash.redwood.layout.widget
import app.cash.redwood.layout.api.CrossAxisAlignment
import app.cash.redwood.layout.api.MainAxisAlignment

public interface FlexContainer<W : Any> : Row<W>, Column<W> {
public interface FlexContainer<W : Any> :
Row<W>,
Column<W> {
override fun horizontalAlignment(horizontalAlignment: MainAxisAlignment) {
mainAxisAlignment(horizontalAlignment)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ class ComposeUiLazyListTest(

class ComposeTestFlexContainer private constructor(
private val delegate: ComposeUiLazyList,
) : TestFlexContainer<@Composable () -> Unit>, LazyList<@Composable () -> Unit> by delegate {
) : TestFlexContainer<@Composable () -> Unit>,
LazyList<@Composable () -> Unit> by delegate {
private var childCount = 0

constructor(direction: FlexDirection, backgroundColor: Int) : this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import app.cash.redwood.lazylayout.widget.LazyList
import app.cash.redwood.lazylayout.widget.RedwoodLazyLayoutWidgetFactory
import app.cash.redwood.lazylayout.widget.RefreshableLazyList

public class ComposeUiRedwoodLazyLayoutWidgetFactory :
RedwoodLazyLayoutWidgetFactory<@Composable () -> Unit> {
public class ComposeUiRedwoodLazyLayoutWidgetFactory : RedwoodLazyLayoutWidgetFactory<@Composable () -> Unit> {
override fun LazyList(): LazyList<@Composable () -> Unit> = ComposeUiLazyList()

override fun RefreshableLazyList(): RefreshableLazyList<@Composable () -> Unit> = ComposeUiLazyList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ internal open class HTMLLazyList(document: Document) : LazyList<HTMLElement> {

internal class HTMLRefreshableLazyList(
document: Document,
) : HTMLLazyList(document), RefreshableLazyList<HTMLElement> {
) : HTMLLazyList(document),
RefreshableLazyList<HTMLElement> {
override fun refreshing(refreshing: Boolean) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ import platform.UIKit.item
import platform.darwin.NSInteger
import platform.darwin.NSObject

internal open class UIViewLazyList : LazyList<UIView>, ChangeListener {
internal open class UIViewLazyList :
LazyList<UIView>,
ChangeListener {
internal val tableView: UITableView = object : UITableView(
CGRectZero.readValue(),
UITableViewStyle.UITableViewStylePlain,
Expand Down Expand Up @@ -333,7 +335,9 @@ internal class LazyListContainerCell(
}
}

internal class UIViewRefreshableLazyList : UIViewLazyList(), RefreshableLazyList<UIView> {
internal class UIViewRefreshableLazyList :
UIViewLazyList(),
RefreshableLazyList<UIView> {

private var onRefresh: (() -> Unit)? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ private const val VIEW_TYPE_ITEM = 1

internal open class ViewLazyList private constructor(
internal val recyclerView: RecyclerView,
) : LazyList<View>, ChangeListener {
) : LazyList<View>,
ChangeListener {
private val adapter = LazyContentItemListAdapter()
private val scope = MainScope()

Expand Down Expand Up @@ -292,7 +293,8 @@ internal open class ViewLazyList private constructor(

internal class ViewRefreshableLazyList(
context: Context,
) : ViewLazyList(context), RefreshableLazyList<View> {
) : ViewLazyList(context),
RefreshableLazyList<View> {

private val swipeRefreshLayout = SwipeRefreshLayout(context)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class ViewLazyListTest(

class ViewTestFlexContainer private constructor(
private val delegate: ViewLazyList,
) : TestFlexContainer<View>, LazyList<View> by delegate, ChangeListener by delegate {
) : TestFlexContainer<View>,
LazyList<View> by delegate,
ChangeListener by delegate {
private var childCount = 0

constructor(context: Context, direction: FlexDirection, backgroundColor: Int) : this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ internal actual inline fun <E> PlatformList<E>.asList(): List<E> {

internal class JsArrayList<E>(
private val storage: JsArray<E>,
) : AbstractList<E>(), RandomAccess {
) : AbstractList<E>(),
RandomAccess {
override val size: Int get() = storage.size

override fun get(index: Int): E {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ public class ProtocolBridge<W : Any>(
@OptIn(RedwoodCodegenApi::class)
private class RootProtocolNode<W : Any>(
children: Widget.Children<W>,
) : ProtocolNode<W>(Id.Root, UnknownWidgetTag), Widget<W> {
) : ProtocolNode<W>(Id.Root, UnknownWidgetTag),
Widget<W> {
private val children = ProtocolChildren(children)

override fun apply(change: PropertyChange, eventSink: EventSink) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ import com.github.ajalt.clikt.parameters.types.path
import java.io.File
import java.net.URLClassLoader

internal class ApiCommand : CliktCommand(
name = "api",
help = "Write schema protocol API to XML, or validate schema compatibility with existing XML",
) {
internal class ApiCommand :
CliktCommand(
name = "api",
help = "Write schema protocol API to XML, or validate schema compatibility with existing XML",
) {
private val file by option("-f", "--file")
.path()
.required()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ import java.net.URLClassLoader
import kotlin.io.path.createDirectories
import kotlin.io.path.writeText

internal class JsonCommand : CliktCommand(
name = "json",
help = "Parse schema members into a JSON representation",
) {
internal class JsonCommand :
CliktCommand(
name = "json",
help = "Parse schema members into a JSON representation",
) {
private val out by option().path().required()
.help("Directory into which JSON is written")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,15 @@ public interface ProtocolWidget : Widget {
public sealed interface ProtocolTrait : Trait {
public val tag: Int
}
public interface ProtocolProperty : Property, ProtocolTrait
public interface ProtocolEvent : Event, ProtocolTrait
public interface ProtocolChildren : Children, ProtocolTrait
public interface ProtocolProperty :
Property,
ProtocolTrait
public interface ProtocolEvent :
Event,
ProtocolTrait
public interface ProtocolChildren :
Children,
ProtocolTrait
}

public interface ProtocolModifier : Modifier {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ private class RedwoodZiplineTreehouseUi(
private val appLifecycle: StandardAppLifecycle,
private val treehouseUi: TreehouseUi,
private val bridge: ProtocolBridge,
) : ZiplineTreehouseUi, ZiplineScoped, EventSink by bridge {
) : ZiplineTreehouseUi,
ZiplineScoped,
EventSink by bridge {

/**
* By overriding [ZiplineScoped.scope], all services passed into [start] are added to this scope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public class TreehouseLayout(
context: Context,
override val widgetSystem: WidgetSystem<View>,
androidOnBackPressedDispatcher: AndroidOnBackPressedDispatcher,
) : RedwoodLayout(context, androidOnBackPressedDispatcher), TreehouseView<View> {
) : RedwoodLayout(context, androidOnBackPressedDispatcher),
TreehouseView<View> {
override var readyForContentChangeListener: ReadyForContentChangeListener<View>? = null
set(value) {
check(value == null || field == null) { "View already bound to a listener" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import app.cash.zipline.ZiplineManifest
*/
class RetainEverythingEventListenerFactory(
private val eventLog: EventLog,
) : EventListener(), EventListener.Factory {
) : EventListener(),
EventListener.Factory {
var app: TreehouseApp<*>? = null
var manifestUrl: String? = null
var zipline: Zipline? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ internal class TreehouseAppContent<A : AppService>(
private val dispatchers: TreehouseDispatchers,
private val codeEventPublisher: CodeEventPublisher,
private val source: TreehouseContentSource<A>,
) : Content, CodeHost.Listener<A>, CodeSession.Listener<A> {
) : Content,
CodeHost.Listener<A>,
CodeSession.Listener<A> {
private val stateFlow = MutableStateFlow<State<A>>(
State(ViewState.None, CodeState.Idle(isInitialLaunch = true)),
)
Expand Down Expand Up @@ -303,7 +305,9 @@ private class ViewContentCodeBinding<A : AppService>(
private val isInitialLaunch: Boolean,
private val onBackPressedDispatcher: OnBackPressedDispatcher,
firstUiConfiguration: StateFlow<UiConfiguration>,
) : ChangesSinkService, TreehouseView.SaveCallback, ZiplineTreehouseUi.Host {
) : ChangesSinkService,
TreehouseView.SaveCallback,
ZiplineTreehouseUi.Host {
private val uiConfigurationFlow = SequentialStateFlow(firstUiConfiguration)

private val bindingScope = CoroutineScope(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import platform.UIKit.UIView
public class TreehouseUIView private constructor(
override val widgetSystem: WidgetSystem<UIView>,
view: RootUiView,
) : TreehouseView<UIView>, RedwoodUIView(view) {
) : RedwoodUIView(view),
TreehouseView<UIView> {
override var saveCallback: TreehouseView.SaveCallback? = null
override var stateSnapshotId: StateSnapshot.Id = StateSnapshot.Id(null)

Expand Down
Loading

0 comments on commit 5205fe8

Please sign in to comment.