Skip to content

Commit

Permalink
Add spotless plugin for code formatting and rule for Kotlin sources
Browse files Browse the repository at this point in the history
  • Loading branch information
wmontwe committed Feb 3, 2023
1 parent 697f201 commit 713dbf9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugins {
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.spotless)
}

project.ext {
Expand Down Expand Up @@ -101,6 +102,17 @@ allprojects {
}
}

spotless {
kotlin {
ktlint(libs.versions.ktlint.get())
.setEditorConfigPath("$projectDir/.editorconfig")
target("**/*.kt")
targetExclude("**/build/", "**/resources/")
trimTrailingWhitespace()
endWithNewline()
}
}

tasks.register('testsOnCi') {
dependsOn getSubprojects()
.collect { project -> project.tasks.withType(Test) }
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

[versions]
androidGradlePlugin = "7.4.0"
ktlint = "0.44.0"
ktlint = "0.47.1"
spotless = "6.14.0"

kotlin = "1.8.0"
kotlinCoroutines = "1.6.4"
Expand Down Expand Up @@ -39,6 +40,7 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktlint = "org.jlleitschuh.gradle.ktlint:11.0.0"
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }

[libraries]
desugar = "com.android.tools:desugar_jdk_libs:1.1.8"
Expand Down

0 comments on commit 713dbf9

Please sign in to comment.