Skip to content

Commit 265d92b

Browse files
chore(deps): update plugin org.jmailen.kotlinter to v4 (#90)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent f0a82be commit 265d92b

File tree

8 files changed

+53
-26
lines changed

8 files changed

+53
-26
lines changed

.editorconfig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ ij_kotlin_imports_layout=*,^
55
ij_kotlin_allow_trailing_comma=true
66
ij_kotlin_allow_trailing_comma_on_call_site=true
77
ktlint_experimental = enabled
8-
ktlint_standard_filename = disabled
9-
ktlint_standard_function-naming = disabled
8+
ktlint_standard_function-signature = disabled
9+
ktlint_standard_multiline-expression-wrapping = disabled
10+
ktlint_standard_chain-method-continuation = disabled # weird rule
11+
ktlint_standard_discouraged-comment-location = disabled # it disallows comments to multi-line fun args
1012
ktlint_standard_property-naming = disabled
13+
ktlint_standard_function-naming = disabled
14+
ktlint_standard_string-template-indent = disabled # due to multiline-expression-wrapping dependency
15+
ktlint_standard_class-signature = disabled # due to discouraged-comment-location
16+
ktlint_standard_if-else-wrapping = disabled # due to discouraged-comment-location

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
id("org.jetbrains.kotlin.android") version "1.9.20" apply false
1010
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.20" apply false
1111
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" apply false
12-
id("org.jmailen.kotlinter") version "3.16.0" apply false
12+
id("org.jmailen.kotlinter") version "4.1.0" apply false
1313
id("com.android.application") version "8.2.0" apply false
1414
id("com.vanniktech.maven.publish.base") version "0.25.3" apply false
1515
}

core/src/main/kotlin/com/kiwi/navigationcompose/typed/NavBuilder.kt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ import kotlinx.serialization.ExperimentalSerializationApi
2525
import kotlinx.serialization.KSerializer
2626
import kotlinx.serialization.serializer
2727

28+
private typealias EnterTransitionFactory =
29+
(@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)
30+
31+
private typealias ExitTransitionFactory =
32+
(@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)
33+
2834
/**
2935
* Add the Composable to the NavGraphBuilder with type-safe arguments and route.
3036
*
@@ -50,10 +56,10 @@ import kotlinx.serialization.serializer
5056
@MainThread
5157
public inline fun <reified T : Destination> NavGraphBuilder.composable(
5258
deepLinks: List<NavDeepLink> = emptyList(),
53-
noinline enterTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = null,
54-
noinline exitTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = null,
55-
noinline popEnterTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = enterTransition,
56-
noinline popExitTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = exitTransition,
59+
noinline enterTransition: EnterTransitionFactory? = null,
60+
noinline exitTransition: ExitTransitionFactory? = null,
61+
noinline popEnterTransition: EnterTransitionFactory? = enterTransition,
62+
noinline popExitTransition: ExitTransitionFactory? = exitTransition,
5763
noinline content: @Composable T.(NavBackStackEntry) -> Unit,
5864
) {
5965
composable(
@@ -185,10 +191,10 @@ public fun <T : Destination> NavGraphBuilder.dialog(
185191
public inline fun <reified T : Destination> NavGraphBuilder.navigation(
186192
startDestination: String,
187193
deepLinks: List<NavDeepLink> = emptyList(),
188-
noinline enterTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = null,
189-
noinline exitTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = null,
190-
noinline popEnterTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = enterTransition,
191-
noinline popExitTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = exitTransition,
194+
noinline enterTransition: EnterTransitionFactory? = null,
195+
noinline exitTransition: ExitTransitionFactory? = null,
196+
noinline popEnterTransition: EnterTransitionFactory? = enterTransition,
197+
noinline popExitTransition: ExitTransitionFactory? = exitTransition,
192198
noinline builder: NavGraphBuilder.() -> Unit,
193199
) {
194200
navigation(
@@ -219,10 +225,10 @@ public fun <T : Destination> NavGraphBuilder.navigation(
219225
serializer: KSerializer<T>,
220226
startDestination: String,
221227
deepLinks: List<NavDeepLink> = emptyList(),
222-
enterTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = null,
223-
exitTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = null,
224-
popEnterTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = enterTransition,
225-
popExitTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = exitTransition,
228+
enterTransition: EnterTransitionFactory? = null,
229+
exitTransition: ExitTransitionFactory? = null,
230+
popEnterTransition: EnterTransitionFactory? = enterTransition,
231+
popExitTransition: ExitTransitionFactory? = exitTransition,
226232
builder: NavGraphBuilder.() -> Unit,
227233
) {
228234
registerDestinationType(kClass, serializer)

core/src/main/kotlin/com/kiwi/navigationcompose/typed/NavController.kt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public fun NavController.navigate(
2626
public inline fun <reified T : Destination> NavOptions.Builder.setPopUpTo(
2727
inclusive: Boolean,
2828
saveState: Boolean = false,
29-
): NavOptions.Builder {
30-
return setPopUpTo(createRoutePattern<T>(), inclusive, saveState)
31-
}
29+
): NavOptions.Builder = setPopUpTo(createRoutePattern<T>(), inclusive, saveState)
3230

3331
/**
3432
* Navigates to the specified [Destination].
@@ -54,10 +52,8 @@ public inline fun <reified T : Destination> NavOptionsBuilder.popUpTo(
5452
public inline fun <reified T : Destination> NavController.popBackStack(
5553
inclusive: Boolean,
5654
saveState: Boolean = false,
57-
): Boolean {
58-
return popBackStack(
59-
route = createRoutePattern<T>(),
60-
inclusive = inclusive,
61-
saveState = saveState,
62-
)
63-
}
55+
): Boolean = popBackStack(
56+
route = createRoutePattern<T>(),
57+
inclusive = inclusive,
58+
saveState = saveState,
59+
)

core/src/main/kotlin/com/kiwi/navigationcompose/typed/internal/UriDataDecoder.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,23 @@ internal class UriDataDecoder(
5050
// natively supported
5151

5252
override fun decodeInt(): Int = data.get(elementName)!!.toInt()
53+
5354
override fun decodeLong(): Long = data.get(elementName)!!.toLong()
55+
5456
override fun decodeFloat(): Float = data.get(elementName)!!.toFloat()
57+
5558
override fun decodeBoolean(): Boolean = data.get(elementName)!!.toBooleanStrict()
59+
5660
override fun decodeString(): String = data.get(elementName)!!
5761

5862
// delegated to other primitives
5963

6064
override fun decodeDouble(): Double = data.get(elementName)!!.toDouble()
65+
6166
override fun decodeByte(): Byte = data.get(elementName)!!.toByte()
67+
6268
override fun decodeShort(): Short = data.get(elementName)!!.toShort()
69+
6370
override fun decodeChar(): Char = data.get(elementName)!![0]
6471

6572
override fun decodeEnum(enumDescriptor: SerialDescriptor): Int = decodeInt()

core/src/main/kotlin/com/kiwi/navigationcompose/typed/internal/UriDataMap.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@ import androidx.lifecycle.SavedStateHandle
55

66
internal interface UriDataMap {
77
fun contains(key: String): Boolean
8+
89
fun get(key: String): String?
910
}
1011

1112
internal class BundleDataMap(
1213
private val bundle: Bundle,
1314
) : UriDataMap {
1415
override fun contains(key: String): Boolean = bundle.containsKey(key)
16+
1517
override fun get(key: String): String? = bundle.getString(key)
1618
}
1719

1820
internal class SavedStateDataMap(
1921
private val savedStateHandle: SavedStateHandle,
2022
) : UriDataMap {
2123
override fun contains(key: String): Boolean = savedStateHandle.contains(key)
24+
2225
override fun get(key: String): String? = savedStateHandle[key]
2326
}

core/src/main/kotlin/com/kiwi/navigationcompose/typed/internal/UrlEncoder.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,25 @@ internal class UrlEncoder(
3838
}
3939

4040
override fun encodeNull() {}
41+
4142
override fun encodeNotNullMark() {}
4243

4344
override fun encodeInt(value: Int) = appendValue(value.toString())
45+
4446
override fun encodeLong(value: Long) = appendValue(value.toString())
47+
4548
override fun encodeFloat(value: Float) = appendValue(value.toString())
49+
4650
override fun encodeBoolean(value: Boolean) = appendValue(if (value) "true" else "false")
51+
4752
override fun encodeString(value: String) = appendValue(value)
4853

4954
override fun encodeDouble(value: Double) = appendValue(value.toString())
55+
5056
override fun encodeByte(value: Byte) = appendValue(value.toString())
57+
5158
override fun encodeShort(value: Short) = appendValue(value.toString())
59+
5260
override fun encodeChar(value: Char) = appendValue(value.toString())
5361

5462
override fun encodeEnum(enumDescriptor: SerialDescriptor, index: Int) = encodeInt(index)

core/src/test/kotlin/com/kiwi/navigationcompose/typed/internal/RoutePatternTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ internal class RoutePatternTest {
3636
) : Destination
3737

3838
Assert.assertEquals(
39-
"com.kiwi.navigationcompose.typed.internal.RoutePatternTest.test.TestData/{a}/{c}/{g}/{i}/{k}/{m}/{o}?b={b}&d={d}&e={e}&f={f}&h={h}&j={j}&l={l}&n={n}",
39+
"com.kiwi.navigationcompose.typed.internal.RoutePatternTest.test.TestData/" +
40+
"{a}/{c}/{g}/{i}/{k}/{m}/{o}?b={b}&d={d}&e={e}&f={f}&h={h}&j={j}&l={l}&n={n}",
4041
createRoutePattern<TestData>(),
4142
)
4243
}

0 commit comments

Comments
 (0)