Replace ktlint with Spotless for code formatting
- Add Spotless plugin 8.1.0 with ktlint 1.7.1 and Google Java Format - Configure ktlint rules, disable filename/max-line-length/property-naming - Remove old ktlint plugin
This commit is contained in:
@@ -2,7 +2,6 @@ import org.gradle.api.file.DuplicatesStrategy
|
|||||||
import org.gradle.api.tasks.Sync
|
import org.gradle.api.tasks.Sync
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
|
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.util.Base64
|
import java.util.Base64
|
||||||
@@ -16,7 +15,7 @@ plugins {
|
|||||||
id("org.jetbrains.kotlin.plugin.compose")
|
id("org.jetbrains.kotlin.plugin.compose")
|
||||||
id("org.jetbrains.kotlin.plugin.serialization")
|
id("org.jetbrains.kotlin.plugin.serialization")
|
||||||
id("com.github.triplet.play")
|
id("com.github.triplet.play")
|
||||||
id("org.jlleitschuh.gradle.ktlint")
|
alias(libs.plugins.spotless)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getProps(propName: String): String {
|
fun getProps(propName: String): String {
|
||||||
@@ -342,14 +341,19 @@ tasks.withType<KotlinCompile>().configureEach {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ktlint {
|
spotless {
|
||||||
android.set(false)
|
kotlin {
|
||||||
version.set("1.0.1")
|
target("src/**/*.kt")
|
||||||
verbose.set(true)
|
ktlint(libs.versions.ktlint.get())
|
||||||
outputToConsole.set(true)
|
.editorConfigOverride(mapOf(
|
||||||
reporters {
|
"ktlint_standard_backing-property-naming" to "disabled",
|
||||||
reporter(ReporterType.PLAIN)
|
"ktlint_standard_filename" to "disabled",
|
||||||
reporter(ReporterType.CHECKSTYLE)
|
"ktlint_standard_max-line-length" to "disabled",
|
||||||
reporter(ReporterType.HTML)
|
"ktlint_standard_property-naming" to "disabled",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
java {
|
||||||
|
target("src/**/*.java")
|
||||||
|
googleJavaFormat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ plugins {
|
|||||||
id("com.github.triplet.play") version "3.13.0" apply false
|
id("com.github.triplet.play") version "3.13.0" apply false
|
||||||
id("org.jetbrains.kotlin.plugin.compose") version "2.2.0" apply false
|
id("org.jetbrains.kotlin.plugin.compose") version "2.2.0" apply false
|
||||||
id("org.jetbrains.kotlin.plugin.serialization") version "2.2.0" apply false
|
id("org.jetbrains.kotlin.plugin.serialization") version "2.2.0" apply false
|
||||||
id("org.jlleitschuh.gradle.ktlint") version "13.1.0" apply false
|
alias(libs.plugins.spotless) apply false
|
||||||
id("io.gitlab.arturbosch.detekt") version "1.23.8"
|
id("io.gitlab.arturbosch.detekt") version "1.23.8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
gradle/libs.versions.toml
Normal file
6
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[versions]
|
||||||
|
spotless = "8.1.0"
|
||||||
|
ktlint = "1.7.1"
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
|
||||||
Reference in New Issue
Block a user