Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Sep 11, 2024
1 parent f83c35b commit 5ccb8ce
Show file tree
Hide file tree
Showing 24 changed files with 44 additions and 52 deletions.
3 changes: 1 addition & 2 deletions buildSrc/src/main/kotlin/ConfigureMultiplatform.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@file:Suppress("MissingPackageDeclaration", "unused", "UndocumentedPublicFunction", "LongMethod", "UnusedImports")

import org.gradle.api.Project
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.getValue
import org.gradle.kotlin.dsl.getting
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
Expand Down Expand Up @@ -117,7 +116,7 @@ fun Project.configureMultiplatform(
compilerOptions {
freeCompilerArgs.addAll(Config.compilerArgs)
optIn.addAll(Config.optIns)
progressiveMode = true
progressiveMode.set(true)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class SubscriberManager {
/**
* Complete the wait period, freeing the store and coroutines that called [await] to continue.
*/
public fun complete() {
public fun complete() {
subscriber.getAndSet(null)?.cancel()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ private data object NoOpPlugin : StorePlugin<Nothing, Nothing, Nothing> {
* A plugin that does nothing. Useful for testing or mocking
*/
@Suppress("UNCHECKED_CAST")
public fun <S : MVIState, I : MVIIntent, A : MVIAction> NoOpPlugin(
): StorePlugin<S, I, A> = NoOpPlugin as StorePlugin<S, I, A>
public fun <S : MVIState, I : MVIIntent, A : MVIAction> NoOpPlugin(): StorePlugin<S, I, A> =
NoOpPlugin as StorePlugin<S, I, A>
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.supervisorScope
import kotlinx.coroutines.withTimeoutOrNull
import pro.respawn.flowmvi.api.ActionShareBehavior
import pro.respawn.flowmvi.api.ActionShareBehavior.Disabled
import pro.respawn.flowmvi.api.EmptyState
import pro.respawn.flowmvi.api.MVIState
import pro.respawn.flowmvi.api.Store
import pro.respawn.flowmvi.debugger.model.ClientEvent
import pro.respawn.flowmvi.debugger.model.ClientEvent.StoreConnected
import pro.respawn.flowmvi.debugger.model.ServerEvent
import pro.respawn.flowmvi.dsl.store
import pro.respawn.flowmvi.logging.StoreLogLevel
import pro.respawn.flowmvi.logging.log
import pro.respawn.flowmvi.plugins.TimeTravel
import pro.respawn.flowmvi.plugins.enableLogging
import pro.respawn.flowmvi.plugins.init
import pro.respawn.flowmvi.plugins.recover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

/**
* Serializer for the internal flowmvi UUID type
*/
public object UUIDSerializer : KSerializer<Uuid> {

override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("Filename")

package pro.respawn.flowmvi.ideplugin

import androidx.compose.runtime.Composable
Expand All @@ -10,8 +12,8 @@ import androidx.compose.ui.graphics.Color
import com.intellij.ide.ui.LafManager
import com.intellij.ide.ui.LafManagerListener
import com.intellij.openapi.application.ApplicationManager
import java.awt.Color as AwtColor
import javax.swing.UIManager
import java.awt.Color as AwtColor

@Composable
fun rememberIntelliJTheme(): IntelliJTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class DefaultStoreConfiguration(
serializer: KSerializer<S>,
fileName: String,
) = CompressedFileSaver(
// STOPSHIP: Abstract away
// TODO: Abstract away
path = File("states").apply { mkdirs() }.resolve("$fileName.json").absolutePath,
recover = NullRecover
).let { JsonSaver(json, serializer, it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package pro.respawn.flowmvi.debugger.server.di
import io.ktor.serialization.kotlinx.json.DefaultJson
import org.koin.core.module.dsl.new
import org.koin.dsl.module
import pro.respawn.flowmvi.debugger.server.arch.configuration.StoreConfiguration
import pro.respawn.flowmvi.debugger.server.arch.configuration.DefaultStoreConfiguration
import pro.respawn.flowmvi.debugger.server.arch.configuration.StoreConfiguration
import pro.respawn.flowmvi.debugger.server.ui.screens.connect.ConnectContainer
import pro.respawn.flowmvi.debugger.server.ui.screens.storedetails.StoreDetailsContainer
import pro.respawn.flowmvi.debugger.server.ui.screens.timeline.TimelineContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,4 @@ fun AppContent(
},
)
}

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package pro.respawn.flowmvi.debugger.server.navigation.component

import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.ExperimentalDecomposeApi
import com.arkivanov.decompose.childContext
import com.arkivanov.decompose.router.stack.webhistory.WebHistoryController
import pro.respawn.flowmvi.debugger.server.navigation.component.DestinationComponent
import pro.respawn.flowmvi.debugger.server.navigation.component.StackComponent
import pro.respawn.flowmvi.debugger.server.navigation.component.destinationComponent
import pro.respawn.flowmvi.debugger.server.navigation.destination.Destination
import pro.respawn.flowmvi.debugger.server.navigation.details.DetailsComponent

class RootComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import org.koin.compose.LocalKoinScope
import pro.respawn.flowmvi.compose.dsl.LocalSubscriberLifecycle
import pro.respawn.flowmvi.compose.dsl.rememberSubscriberLifecycle
import pro.respawn.flowmvi.debugger.server.di.LocalDestinationScope
import pro.respawn.flowmvi.essenty.lifecycle.asSubscriberLifecycle
import pro.respawn.flowmvi.debugger.server.navigation.component.DestinationComponent
import pro.respawn.flowmvi.essenty.lifecycle.asSubscriberLifecycle

@Composable
internal fun ProvideDestinationLocals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import pro.respawn.flowmvi.api.PipelineContext
import pro.respawn.flowmvi.debugger.server.DebugServer
import pro.respawn.flowmvi.debugger.server.arch.configuration.StoreConfiguration
import pro.respawn.flowmvi.debugger.server.arch.configuration.configure
import pro.respawn.flowmvi.debugger.server.ui.util.HostForm
import pro.respawn.flowmvi.debugger.server.ui.util.PortForm
import pro.respawn.flowmvi.debugger.server.ui.screens.connect.ConnectAction.GoToTimeline
import pro.respawn.flowmvi.debugger.server.ui.screens.connect.ConnectIntent.HostChanged
import pro.respawn.flowmvi.debugger.server.ui.screens.connect.ConnectState.ConfiguringServer
import pro.respawn.flowmvi.debugger.server.ui.util.HostForm
import pro.respawn.flowmvi.debugger.server.ui.util.PortForm
import pro.respawn.flowmvi.dsl.store
import pro.respawn.flowmvi.dsl.updateState
import pro.respawn.flowmvi.plugins.recover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import pro.respawn.flowmvi.compose.dsl.requireLifecycle
import pro.respawn.flowmvi.compose.dsl.subscribe
import pro.respawn.flowmvi.compose.preview.EmptyReceiver
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.jetbrains.compose.resources.painterResource
import pro.respawn.flowmvi.api.IntentReceiver
import pro.respawn.flowmvi.compose.dsl.requireLifecycle
import pro.respawn.flowmvi.compose.dsl.subscribe
import pro.respawn.flowmvi.compose.preview.EmptyReceiver
import pro.respawn.flowmvi.debugger.server.di.container
import pro.respawn.flowmvi.debugger.server.navigation.AppNavigator
import pro.respawn.flowmvi.debugger.server.ui.screens.connect.ConnectIntent.HostChanged
Expand All @@ -37,7 +37,6 @@ import pro.respawn.flowmvi.server.generated.resources.icon_nobg_32
fun ConnectScreen(
navigator: AppNavigator,
) = with(container<ConnectContainer, _, _, _>()) {

val state by subscribe(requireLifecycle()) {
when (it) {
is ConnectAction.GoToTimeline -> navigator.timeline()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package pro.respawn.flowmvi.debugger.server.ui.screens.storedetails

import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
Expand All @@ -15,9 +16,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import pro.respawn.flowmvi.compose.dsl.requireLifecycle
import pro.respawn.flowmvi.compose.dsl.subscribe
import pro.respawn.flowmvi.compose.preview.EmptyReceiver
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -30,6 +28,9 @@ import com.benasher44.uuid.uuid4
import kotlinx.collections.immutable.toImmutableList
import org.koin.core.parameter.parametersOf
import pro.respawn.flowmvi.api.IntentReceiver
import pro.respawn.flowmvi.compose.dsl.requireLifecycle
import pro.respawn.flowmvi.compose.dsl.subscribe
import pro.respawn.flowmvi.compose.preview.EmptyReceiver
import pro.respawn.flowmvi.debugger.model.ClientEvent
import pro.respawn.flowmvi.debugger.server.ServerEventEntry
import pro.respawn.flowmvi.debugger.server.StoreCommand
Expand All @@ -41,10 +42,10 @@ import pro.respawn.flowmvi.debugger.server.ui.screens.storedetails.StoreDetailsI
import pro.respawn.flowmvi.debugger.server.ui.screens.storedetails.StoreDetailsIntent.CopyEventClicked
import pro.respawn.flowmvi.debugger.server.ui.screens.storedetails.StoreDetailsIntent.EventClicked
import pro.respawn.flowmvi.debugger.server.ui.screens.storedetails.StoreDetailsState.DisplayingStore
import pro.respawn.flowmvi.debugger.server.ui.widgets.StoreEventListDetailsLayout
import pro.respawn.flowmvi.debugger.server.ui.theme.RespawnTheme
import pro.respawn.flowmvi.debugger.server.ui.widgets.RErrorView
import pro.respawn.flowmvi.debugger.server.ui.widgets.RScaffold
import pro.respawn.flowmvi.debugger.server.ui.widgets.StoreEventListDetailsLayout
import pro.respawn.flowmvi.debugger.server.ui.widgets.TypeCrossfade
import pro.respawn.flowmvi.util.typed
import pro.respawn.kmmutils.common.copies
Expand Down Expand Up @@ -124,6 +125,7 @@ private val StoreCommand.label: String
}

@Composable
@Preview
private fun StoreDetailsScreenPreview() = RespawnTheme {
EmptyReceiver {
StoreDetailsScreenContent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.ParagraphStyle
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
Expand All @@ -28,12 +26,11 @@ import pro.respawn.flowmvi.debugger.server.ui.screens.timeline.TimelineIntent.Cl
import pro.respawn.flowmvi.debugger.server.ui.screens.timeline.TimelineIntent.CopyEventClicked
import pro.respawn.flowmvi.debugger.server.ui.screens.timeline.TimelineIntent.EventClicked
import pro.respawn.flowmvi.debugger.server.ui.screens.timeline.TimelineState.DisplayingTimeline
import pro.respawn.flowmvi.debugger.server.ui.widgets.StoreEventListDetailsLayout
import pro.respawn.flowmvi.debugger.server.ui.widgets.RErrorView
import pro.respawn.flowmvi.debugger.server.ui.widgets.RScaffold
import pro.respawn.flowmvi.debugger.server.ui.widgets.StoreEventListDetailsLayout
import pro.respawn.flowmvi.debugger.server.ui.widgets.TypeCrossfade
import pro.respawn.kmmutils.compose.annotate
import pro.respawn.kmmutils.compose.style

/**
* The Timeline (Main) screen of the debugger.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import androidx.compose.ui.text.font.toFontFamily
import androidx.compose.ui.text.style.Hyphens
import androidx.compose.ui.text.style.LineBreak
import androidx.compose.ui.unit.sp
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.Font
import pro.respawn.flowmvi.server.generated.resources.Res
import pro.respawn.flowmvi.server.generated.resources.comfortaa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import kotlinx.datetime.LocalDateTime
import pro.respawn.flowmvi.debugger.server.util.representation
import pro.respawn.flowmvi.debugger.server.ui.screens.timeline.FocusedEvent
import pro.respawn.flowmvi.debugger.server.ui.theme.Opacity
import pro.respawn.flowmvi.debugger.server.util.representation
import pro.respawn.flowmvi.debugger.server.util.type

@Composable
Expand Down Expand Up @@ -76,7 +76,7 @@ internal fun FocusedEventLayout(
Row {
val colors = IconButtonDefaults.filledIconButtonColors(MaterialTheme.colorScheme.surfaceVariant)
IconButton(
onClick =onCopy,
onClick = onCopy,
colors = colors,
) {
Icon(Icons.Rounded.ContentCopy, contentDescription = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class DropDownMenuState internal constructor(
*/
@Composable
fun RDropDownMenu(
button: @Composable DropDownMenuState.() -> Unit,
modifier: Modifier = Modifier,
state: DropDownMenuState = rememberDropDownMenuState(),
button: @Composable DropDownMenuState.() -> Unit,
actions: @Composable DropDownMenuState.() -> Unit,
) {
// box needed for popup anchoring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ fun RScaffold(
title: String? = null,
onBack: (() -> Unit)? = null,
topBarScrollBehavior: TopAppBarScrollBehavior? = TopAppBarDefaults.enterAlwaysScrollBehavior(),
actions: @Composable RowScope.() -> Unit = {},
bottomBar: @Composable () -> Unit = {},
fab: @Composable () -> Unit = {},

snackbarHostState: SnackbarHostState? = null,
containerColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = MaterialTheme.colorScheme.onBackground,
fabPosition: FabPosition = RScaffoldDefaults.FabPosition,
contentWindowInsets: WindowInsets? = RScaffoldDefaults.partialWindowInsets,
fadeContent: Boolean = true,
actions: @Composable RowScope.() -> Unit = {},
bottomBar: @Composable () -> Unit = {},
fab: @Composable () -> Unit = {},
content: @Composable (BoxScope.() -> Unit),
) = RScaffold(
modifier = modifier,
Expand Down Expand Up @@ -89,16 +90,16 @@ fun RScaffold(
@Composable
fun RScaffold(
modifier: Modifier = Modifier,
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
fab: @Composable () -> Unit = {},
snackbarHostState: SnackbarHostState? = null,
containerColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = MaterialTheme.colorScheme.onBackground,
fabPosition: FabPosition = RScaffoldDefaults.FabPosition,
contentWindowInsets: WindowInsets? = RScaffoldDefaults.partialWindowInsets,
nestedScrollConnection: NestedScrollConnection? = null,
fadeContent: Boolean = true,
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
fab: @Composable () -> Unit = {},
content: @Composable BoxScope.() -> Unit,
) {
Scaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ val TopBarTextStyle
fun RTopBar(
modifier: Modifier = Modifier,
onNavigationIconClick: (() -> Unit)? = null,
actions: @Composable (RowScope.() -> Unit) = {},
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
title: AnnotatedString? = Res.string.app_name.string().annotate(),
navigationIcon: ImageVector = Icons.Rounded.ArrowBackIosNew,
scrollBehavior: TopAppBarScrollBehavior? = null,
style: TextStyle = TopBarTextStyle,
actions: @Composable (RowScope.() -> Unit) = {},
) = RTopBar(
modifier = modifier,
title = { RTopBarTitle(title, style = style) },
Expand All @@ -62,12 +62,12 @@ fun RTopBar(
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun RTopBar(
title: @Composable () -> Unit,
navigationIcon: @Composable () -> Unit,
modifier: Modifier = Modifier,
actions: @Composable (RowScope.() -> Unit) = {},
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
scrollBehavior: TopAppBarScrollBehavior? = null,
actions: @Composable (RowScope.() -> Unit) = {},
navigationIcon: @Composable () -> Unit,
title: @Composable () -> Unit,
) = CenterAlignedTopAppBar(
windowInsets = windowInsets,
modifier = modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ internal fun StoreEventListDetailsLayout(
onClick: (ServerEventEntry) -> Unit,
onCopy: () -> Unit,
onClose: () -> Unit,
listState: LazyListState = rememberLazyListState(),
modifier: Modifier = Modifier,
listState: LazyListState = rememberLazyListState(),
) = DynamicTwoPaneLayout(
modifier = modifier,
secondPaneVisible = focusedEvent != null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ ${from.body.prettyPrintToString()}
<--- ${to.name}
${to.body.prettyPrintToString()}
""".trimIndent()
""".trimIndent()
}
6 changes: 3 additions & 3 deletions detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ comments:
endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)'
UndocumentedPublicClass:
active: true
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**.kts', '**/kotestTest/**', '**/sample/**','**/app/**' ]
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**.kts', '**/kotestTest/**', '**/sample/**','**/app/**', '**/debugger/server/**', '**/ideplugin/**' ]
searchInNestedClass: true
searchInInnerClass: true
searchInInnerObject: true
searchInInnerInterface: true
UndocumentedPublicFunction:
active: true
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**.kts', '**/kotestTest/**', '**/sample/**', '**/app/**' ]
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**.kts', '**/kotestTest/**', '**/sample/**', '**/app/**', '**/debugger/server/**', '**/ideplugin/**' ]
UndocumentedPublicProperty:
active: true
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**.kts', '**/kotestTest/**', '**/sample/**', '**/app/**' ]
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**.kts', '**/kotestTest/**', '**/sample/**', '**/app/**', '**/debugger/server/**', '**/ideplugin/**' ]

complexity:
active: true
Expand Down

0 comments on commit 5ccb8ce

Please sign in to comment.