Ktlint for all modules + run it

This commit is contained in:
Benoit Marty 2022-12-12 17:48:07 +01:00
parent b1c5219d74
commit 3e86fa48d8
29 changed files with 80 additions and 95 deletions

View file

@ -3,7 +3,6 @@ plugins {
id("org.jetbrains.kotlin.android")
alias(libs.plugins.ksp)
id("com.google.firebase.appdistribution") version "3.0.2"
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
id("org.jetbrains.kotlinx.knit") version "0.4.0"
}
@ -109,51 +108,6 @@ android {
kotlin.srcDir("build/generated/ksp/test/kotlin")
}
}
// See https://github.com/JLLeitschuh/ktlint-gradle#configuration
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
// See https://github.com/pinterest/ktlint/releases/
// TODO 0.47.1 is available
version.set("0.45.1")
android.set(true)
ignoreFailures.set(false)
enableExperimentalRules.set(true)
// display the corresponding rule
verbose.set(true)
reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
// To have XML report for Danger
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
}
filter {
exclude { element -> element.file.path.contains("$buildDir/generated/") }
}
disabledRules.set(
setOf(
// TODO Re-enable these 4 rules after reformatting project
"indent",
"experimental:argument-list-wrapping",
"max-line-length",
"parameter-list-wrapping",
"spacing-between-declarations-with-comments",
"no-multi-spaces",
"experimental:spacing-between-declarations-with-annotations",
"experimental:annotation",
// - Missing newline after "("
// - Missing newline before ")"
"wrapping",
// - Unnecessary trailing comma before ")"
"experimental:trailing-comma",
// - A block comment in between other elements on the same line is disallowed
"experimental:comment-wrapping",
// - A KDoc comment after any other element on the same line must be separated by a new line
"experimental:kdoc-wrapping",
// Ignore error "Redundant curly braces", since we use it to fix false positives, for instance in "elementLogs.${i}.txt"
"string-template",
)
)
}
}
dependencies {