Skip to content

Commit

Permalink
Merge pull request #18 from futuredapp/feature/bump-ktlint
Browse files Browse the repository at this point in the history
Bump Ktlint and Detekt
  • Loading branch information
PavelMesicek authored May 16, 2024
2 parents 5182e7a + cc8e849 commit 1d6de24
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 37 deletions.
24 changes: 19 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
[*.{kt,kts}]

max_line_length=130
max_line_length = 140
indent_style = space
indent_size=4
continuation_indent_size=4
ktlint_standard_import-ordering=disabled
ij_kotlin_allow_trailing_comma=true
indent_size = 4

insert_final_newline = true
trim_trailing_whitespace = true

ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

continuation_indent_size = 4
ktlint_standard_import-ordering = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_context-receiver-wrapping = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_no-blank-line-in-list = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_annotation = disabled


8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ android.apply {

compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions.apply {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}

composeOptions {
Expand Down Expand Up @@ -137,7 +137,7 @@ android.apply {
}

kotlin {
jvmToolchain(11)
jvmToolchain(JavaVersion.VERSION_17.majorVersion.toInt())
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import kotlinx.serialization.modules.SerializersModule
class ApplicationModule {

@Provides
fun resources(@ApplicationContext context: Context): Resources = context.resources
fun resources(
@ApplicationContext context: Context,
): Resources = context.resources

@Provides
fun json(): Json = Json(from = Json.Default) {
Expand All @@ -31,6 +33,8 @@ class ApplicationModule {
}

@Provides
fun sharedPrefs(@ApplicationContext context: Context) =
fun sharedPrefs(
@ApplicationContext context: Context,
) =
PreferenceManager.getDefaultSharedPreferences(context)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app.futured.androidprojecttemplate.navigation

import androidx.compose.animation.AnimatedContentScope
import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.runtime.Composable
import androidx.compose.ui.window.DialogProperties
import androidx.navigation.NamedNavArgument
Expand Down Expand Up @@ -40,19 +39,19 @@ sealed class Destination(
route = "detail/{title}?subtitle={subtitle}?value={value}",
destinationScreen = { DetailScreen(navigation = it) },
arguments =
listOf(
navArgument("title") {
type = NavType.StringType
},
navArgument("subtitle") {
type = NavType.StringType
defaultValue = "Default subtitle"
},
navArgument("value") {
type = NavType.StringType
nullable = true
},
),
listOf(
navArgument("title") {
type = NavType.StringType
},
navArgument("subtitle") {
type = NavType.StringType
defaultValue = "Default subtitle"
},
navArgument("value") {
type = NavType.StringType
nullable = true
},
),
) {
fun buildRoute(title: String, subtitle: String?, value: String?): String = route
.withArgument("title", title)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("TopLevelPropertyNaming")

package app.futured.androidprojecttemplate.tools.compose

import android.content.res.Configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package app.futured.androidprojecttemplate.ui

import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.navigation.NavHostController
Expand All @@ -19,10 +18,6 @@ fun NavGraph(
navController: NavHostController = rememberNavController(),
navigation: NavRouter = remember { NavRouterImpl(navController) },
) {
LocalOnBackPressedDispatcherOwner.current?.onBackPressedDispatcher?.let {
navController.navigateUp()
}

NavHost(
navController = navController,
startDestination = Destination.Home.route,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@file:OptIn(ExperimentalMaterial3Api::class)
@file:Suppress("PackageNaming")

package app.futured.androidprojecttemplate.ui.screens._templateScreen

Expand Down Expand Up @@ -99,8 +100,7 @@ object TEMPLATE {
@Composable
fun TEMPLATEContentPreview() = Showcase {
TEMPLATE.Content(
actions =
object : TEMPLATE.Actions {
actions = object : TEMPLATE.Actions {
override fun onNavigateBack() = Unit
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ object Home {
fun HomeContentPreview() {
Showcase {
Home.Content(
actions =
object : Home.Actions {
actions = object : Home.Actions {
override fun onNavigateToDetail() = Unit
override fun onIncrementCounter() = Unit
},
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ object Versions {
const val androidGradlePlugin = "8.4.0"

// plugins
const val detekt = "1.22.0"
const val ktlintGradle = "11.2.0"
const val ktlint = "0.48.2"
const val detekt = "1.23.6"
const val ktlintGradle = "12.1.1"
const val ktlint = "1.2.1"

// kotlin
const val kotlin = "1.9.23"
Expand Down

0 comments on commit 1d6de24

Please sign in to comment.