Skip to content

Commit

Permalink
[#541] Update detekt rules for Jetpack Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-conway committed Nov 3, 2023
1 parent ebf81b4 commit 429fa8f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
4 changes: 4 additions & 0 deletions template-compose/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ dependencies {
kapt(COMPILER)
}

with(Dependencies.Kotlin) {
implementation(COLLECTIONS_IMMUTABLE)
}

with(Dependencies.Log) {
implementation(TIMBER)

Expand Down
4 changes: 4 additions & 0 deletions template-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ plugins {
id(Plugins.KOVER) version Versions.KOVER
}

dependencies {
detektPlugins("io.nlopez.compose.rules:detekt:0.3.3")
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
Expand Down
2 changes: 2 additions & 0 deletions template-compose/buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ object Dependencies {

object Kotlin {
const val COROUTINES_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLIN_COROUTINES}"
const val COLLECTIONS_IMMUTABLE =
"org.jetbrains.kotlinx:kotlinx-collections-immutable:${Versions.KOTLIN_COLLECTIONS_IMMUTABLE}"
}

object Log {
Expand Down
1 change: 1 addition & 0 deletions template-compose/buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ object Versions {

const val KOTEST = "5.6.2"
const val KOTLIN = "1.9.10"
const val KOTLIN_COLLECTIONS_IMMUTABLE = "0.3.6"
const val KOTLIN_COROUTINES = "1.7.1"
const val KOVER = "0.7.3"

Expand Down
46 changes: 46 additions & 0 deletions template-compose/detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ style:
MagicNumber:
active: true
ignoreNumbers: [ '-1', '0', '1', '2' ]
ignoreAnnotated: [ 'Preview' ]
ignoreHashCodeFunction: false
ignorePropertyDeclaration: true
ignoreConstantDeclaration: true
Expand Down Expand Up @@ -347,3 +348,48 @@ style:
active: false
WildcardImport:
active: false

Compose:
CompositionLocalAllowlist:
active: true
allowedCompositionLocals: LocalAppColors,LocalAppDimensions,LocalAppShapes,LocalAppStyles,LocalAppTypography
ContentEmitterReturningValues:
active: true
DefaultsVisibility:
active: true
ModifierClickableOrder:
active: true
ModifierComposable:
active: true
ModifierMissing:
active: true
ModifierNaming:
active: true
ModifierNotUsedAtRoot:
active: true
ModifierReused:
active: true
ModifierWithoutDefault:
active: true
MultipleEmitters:
active: true
MutableParams:
active: true
ComposableNaming:
active: true
ComposableParamOrder:
active: true
PreviewAnnotationNaming:
active: true
PreviewPublic:
active: true
RememberMissing:
active: true
RememberContentMissing:
active: true
UnstableCollections:
active: true
ViewModelForwarding:
active: true
ViewModelInjection:
active: true

0 comments on commit 429fa8f

Please sign in to comment.