Skip to content

Commit

Permalink
Deteket (#237)
Browse files Browse the repository at this point in the history
* Add detekt as versions toml

* Add detekt in build.gradle.kts

* Add detekt to storage-base

* Add it to workflow

* Update file, complaining by detekt

* Add detekt to all modules

* Detekt changes

* Fixing detekt

* Detekt changes

* Add detekt to app

* APp detekt
  • Loading branch information
alorma committed Mar 6, 2024
1 parent cc51640 commit 2154b18
Show file tree
Hide file tree
Showing 43 changed files with 972 additions and 219 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ jobs:
- name: Build sample Wasm - PR
run: ./gradlew :composeApp:compileKotlinWasmJs

detekt:
name: Detekt - PR
if: ${{ success() }}
needs: [ build-sample-android, build-sample-iOS, build-sample-desktop, build-sample-wasm ]
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17

- name: Detekt - PR
run: ./gradlew detektAll

check-sign:
name: Check signature - PR
if: ${{ success() }}
Expand Down
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
import io.gitlab.arturbosch.detekt.Detekt

plugins {
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.detekt).apply(false)
}

buildscript {
Expand All @@ -29,6 +31,11 @@ allprojects {
}
}

tasks.register("detektAll") {
allprojects {
this@register.dependsOn(tasks.withType<Detekt>())
}
}

rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) {
rootProject.the<YarnRootExtension>().yarnLockMismatchReport = YarnLockMismatchReport.NONE
Expand Down
5 changes: 5 additions & 0 deletions compose-settings-storage-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.detekt)
}

apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle")
Expand Down Expand Up @@ -95,4 +96,8 @@ compose.desktop {
//packageVersion = rootProject.findProperty("libVersion").toString()
}
}
}

dependencies {
detektPlugins(libs.compose.detekt.rules)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ interface SettingValueState<T> {
fun reset()

var value: T
}
}
5 changes: 5 additions & 0 deletions compose-settings-storage-disk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.detekt)
}

apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle")
Expand Down Expand Up @@ -104,4 +105,8 @@ compose.desktop {
packageVersion = "1.0.0"
}
}
}

dependencies {
detektPlugins(libs.compose.detekt.rules)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ class BooleanSettingValueState(
override fun reset() {
value = defaultValue
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ class TriStateSettingValueState(
override fun reset() {
value = defaultValue
}
}
}
5 changes: 5 additions & 0 deletions compose-settings-storage-memory/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.detekt)
}

apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle")
Expand Down Expand Up @@ -101,4 +102,8 @@ compose.desktop {
packageVersion = "1.0.0"
}
}
}

dependencies {
detektPlugins(libs.compose.detekt.rules)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ internal class InMemoryBooleanSettingValueState(private val defaultValue: Boolea
override fun reset() {
value = defaultValue
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ internal class InMemoryFloatSettingValueState(private val defaultValue: Float) :
override fun reset() {
value = defaultValue
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ internal class InMemoryIntSettingValueState(private val defaultValue: Int) :
override fun reset() {
value = defaultValue
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ internal class InMemoryStringSettingValueState(private val defaultValue: String?
override fun reset() {
value = defaultValue
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ internal class InMemoryTriStateSettingValueState(private val defaultValue: Boole
override fun reset() {
value = defaultValue
}
}
}
5 changes: 5 additions & 0 deletions compose-settings-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.detekt)
}

apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle")
Expand Down Expand Up @@ -102,4 +103,8 @@ compose.desktop {
packageVersion = "1.0.0"
}
}
}

dependencies {
detektPlugins(libs.compose.detekt.rules)
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ fun SettingsCheckbox(
role = Role.Switch,
onValueChange = { update(!state) },
).then(modifier),
enabled = enabled,
title = title,
subtitle = subtitle,
icon = icon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import com.alorma.compose.settings.ui.internal.SettingsTileScaffold

@Composable
fun SettingsMenuLink(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
icon: (@Composable () -> Unit)? = null,
title: @Composable () -> Unit,
subtitle: (@Composable () -> Unit)? = null,
action: (@Composable () -> Unit)? = null,
colors: ListItemColors = ListItemDefaults.colors(),
Expand All @@ -26,13 +26,12 @@ fun SettingsMenuLink(
enabled = enabled,
onClick = onClick,
).then(modifier),
enabled = enabled,
title = title,
subtitle = subtitle,
icon = icon,
action = action,
colors = colors,
tonalElevation = tonalElevation,
shadowElevation = shadowElevation,
action = action,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ fun SettingsRadioButton(
role = Role.RadioButton,
onValueChange = { onClick() },
).then(modifier),
enabled = enabled,
title = title,
subtitle = subtitle,
icon = icon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.unit.dp
import com.alorma.compose.settings.ui.internal.SettingsTileScaffold

@Composable
@Suppress("LongParameterList")
fun SettingsSlider(
title: @Composable () -> Unit,
value: Float,
Expand All @@ -32,7 +33,6 @@ fun SettingsSlider(
) {
SettingsTileScaffold(
modifier = modifier,
enabled = enabled,
title = title,
subtitle = {
Column {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ fun SettingsSwitch(
role = Role.Switch,
onValueChange = { update(!state) },
).then(modifier),
enabled = enabled,
title = title,
subtitle = subtitle,
icon = icon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ fun SettingsTriStateCheckbox(
verticalAlignment = Alignment.CenterVertically,
) {
SettingsTileScaffold(
enabled = enabled,
title = title,
subtitle = subtitle,
icon = icon,
Expand Down
Loading

0 comments on commit 2154b18

Please sign in to comment.