Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Ktlint and Detekt #18

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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


10 changes: 6 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("MagicNumber")

plugins {
id("com.android.application")
kotlin("android")
Expand Down Expand Up @@ -46,12 +48,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 +139,7 @@ android.apply {
}

kotlin {
jvmToolchain(11)
jvmToolchain(17)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jestli ten suppress na magic number je jen kvuli tomuhle, nejde to nahradit treba JavaVersion.VERSION_17.majorVersion.toInt() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jj je to tam jen kvůli tomu upravím díky

}

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
Loading