0
0
mirror of https://github.com/thunderbird/thunderbird-android.git synced 2024-09-19 19:52:14 +02:00

Add detekt plugin for compose

This commit is contained in:
Wolf Montwé 2023-02-22 10:51:23 +01:00
parent b074534fec
commit f4317b0fad
No known key found for this signature in database
GPG Key ID: 6D45B21512ACBF72
4 changed files with 63 additions and 3 deletions

View File

@ -42,3 +42,7 @@ tasks.withType<DetektCreateBaselineTask>().configureEach {
"gradle/**",
)
}
dependencies {
detektPlugins(libs.detekt.plugin.compose)
}

View File

@ -725,3 +725,47 @@ style:
active: true
excludeImports:
- 'java.util.*'
Compose:
CompositionLocalAllowlist:
active: true
allowedCompositionLocals: [LocalElevations, LocalImages, LocalSizes, LocalSpacings]
ContentEmitterReturningValues:
active: true
# You can optionally add your own composables here
# contentEmitters: MyComposable,MyOtherComposable
ModifierComposable:
active: true
ModifierMissing:
active: true
ModifierReused:
active: true
ModifierWithoutDefault:
active: true
MultipleEmitters:
active: true
# You can optionally add your own composables here
# contentEmitters: MyComposable,MyOtherComposable
MutableParams:
active: true
ComposableNaming:
active: true
# You can optionally disable the checks in this rule for regex matches against the composable name (e.g. molecule presenters)
# allowedComposableFunctionNames: .*Presenter,.*MoleculePresenter
ComposableParamOrder:
active: true
PreviewNaming:
active: true
PreviewPublic:
active: true
# You can optionally disable that only previews with @PreviewParameter are flagged
# previewPublicOnlyIfParams: false
RememberMissing:
active: true
UnstableCollections:
active: true
ViewModelForwarding:
active: true
ViewModelInjection:
active: true

View File

@ -15,9 +15,13 @@ import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
@Composable
fun MainView() {
fun MainView(
modifier: Modifier = Modifier,
) {
Column(
modifier = Modifier.fillMaxSize(),
modifier = Modifier
.fillMaxSize()
.then(modifier),
) {
K9Theme {
MainContent(name = "K-9")
@ -37,8 +41,14 @@ fun MainView() {
@Composable
fun MainContent(
name: String,
modifier: Modifier = Modifier,
) {
Surface(modifier = Modifier.fillMaxWidth(), color = MainTheme.colors.background) {
Surface(
modifier = Modifier
.fillMaxWidth()
.then(modifier),
color = MainTheme.colors.background,
) {
Column {
Text(text = "Hello $name!")
Image(painter = painterResource(id = MainTheme.images.logo), contentDescription = "logo")

View File

@ -129,6 +129,8 @@ icu4j-charset = "com.ibm.icu:icu4j-charset:72.1"
leakcanary-android = "com.squareup.leakcanary:leakcanary-android:2.9.1"
detekt-plugin-compose = "io.nlopez.compose.rules:detekt:0.1.1"
[bundles]
shared-jvm-test = [
"junit",