Skip to content

Commit be92fe1

Browse files
committed
[#541] Update detekt rules for Jetpack Compose
1 parent 91c7ac8 commit be92fe1

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed

template-compose/app/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ dependencies {
156156
kapt(COMPILER)
157157
}
158158

159+
with(Dependencies.Kotlin) {
160+
implementation(COLLECTIONS_IMMUTABLE)
161+
}
162+
159163
with(Dependencies.Log) {
160164
implementation(TIMBER)
161165

template-compose/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ plugins {
99
id(Plugins.KOVER) version Versions.KOVER
1010
}
1111

12+
dependencies {
13+
detektPlugins("io.nlopez.compose.rules:detekt:0.3.3")
14+
}
15+
1216
tasks.register("clean", Delete::class) {
1317
delete(rootProject.buildDir)
1418
}

template-compose/buildSrc/src/main/java/Dependencies.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ object Dependencies {
2929

3030
object Kotlin {
3131
const val COROUTINES_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLIN_COROUTINES}"
32+
const val COLLECTIONS_IMMUTABLE =
33+
"org.jetbrains.kotlinx:kotlinx-collections-immutable:${Versions.KOTLIN_COLLECTIONS_IMMUTABLE}"
3234
}
3335

3436
object Log {

template-compose/buildSrc/src/main/java/Versions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ object Versions {
2929

3030
const val KOTEST = "5.6.2"
3131
const val KOTLIN = "1.9.10"
32+
const val KOTLIN_COLLECTIONS_IMMUTABLE = "0.3.6"
3233
const val KOTLIN_COROUTINES = "1.7.1"
3334
const val KOVER = "0.7.3"
3435

template-compose/detekt-config.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ style:
286286
MagicNumber:
287287
active: true
288288
ignoreNumbers: [ '-1', '0', '1', '2' ]
289+
ignoreAnnotated: [ 'Preview' ]
289290
ignoreHashCodeFunction: false
290291
ignorePropertyDeclaration: true
291292
ignoreConstantDeclaration: true
@@ -347,3 +348,48 @@ style:
347348
active: false
348349
WildcardImport:
349350
active: false
351+
352+
Compose:
353+
CompositionLocalAllowlist:
354+
active: true
355+
allowedCompositionLocals: LocalAppColors,LocalAppDimensions,LocalAppShapes,LocalAppStyles,LocalAppTypography
356+
ContentEmitterReturningValues:
357+
active: true
358+
DefaultsVisibility:
359+
active: true
360+
ModifierClickableOrder:
361+
active: true
362+
ModifierComposable:
363+
active: true
364+
ModifierMissing:
365+
active: true
366+
ModifierNaming:
367+
active: true
368+
ModifierNotUsedAtRoot:
369+
active: true
370+
ModifierReused:
371+
active: true
372+
ModifierWithoutDefault:
373+
active: true
374+
MultipleEmitters:
375+
active: true
376+
MutableParams:
377+
active: true
378+
ComposableNaming:
379+
active: true
380+
ComposableParamOrder:
381+
active: true
382+
PreviewAnnotationNaming:
383+
active: true
384+
PreviewPublic:
385+
active: true
386+
RememberMissing:
387+
active: true
388+
RememberContentMissing:
389+
active: true
390+
UnstableCollections:
391+
active: true
392+
ViewModelForwarding:
393+
active: true
394+
ViewModelInjection:
395+
active: true

0 commit comments

Comments
 (0)