mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:05:28 +00:00
[ktLint] Setup KtLint
This commit is contained in:
committed by
Benoit Marty
parent
106b83cf35
commit
e9a3dec6e9
+50
-4
@@ -3,6 +3,7 @@ plugins {
|
|||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
alias(libs.plugins.ksp)
|
alias(libs.plugins.ksp)
|
||||||
id("com.google.firebase.appdistribution") version "3.0.2"
|
id("com.google.firebase.appdistribution") version "3.0.2"
|
||||||
|
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -28,12 +29,12 @@ android {
|
|||||||
}
|
}
|
||||||
register("nightly") {
|
register("nightly") {
|
||||||
keyAlias = System.getenv("ELEMENT_ANDROID_NIGHTLY_KEYID")
|
keyAlias = System.getenv("ELEMENT_ANDROID_NIGHTLY_KEYID")
|
||||||
?: project.property("signing.element.nightly.keyId") as? String?
|
?: project.property("signing.element.nightly.keyId") as? String?
|
||||||
keyPassword = System.getenv("ELEMENT_ANDROID_NIGHTLY_KEYPASSWORD")
|
keyPassword = System.getenv("ELEMENT_ANDROID_NIGHTLY_KEYPASSWORD")
|
||||||
?: project.property("signing.element.nightly.keyPassword") as? String?
|
?: project.property("signing.element.nightly.keyPassword") as? String?
|
||||||
storeFile = file("./signature/nightly.keystore")
|
storeFile = file("./signature/nightly.keystore")
|
||||||
storePassword = System.getenv("ELEMENT_ANDROID_NIGHTLY_STOREPASSWORD")
|
storePassword = System.getenv("ELEMENT_ANDROID_NIGHTLY_STOREPASSWORD")
|
||||||
?: project.property("signing.element.nightly.storePassword") as? String?
|
?: project.property("signing.element.nightly.storePassword") as? String?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +115,51 @@ android {
|
|||||||
checkDependencies = true
|
checkDependencies = true
|
||||||
abortOnError = true
|
abortOnError = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 {
|
dependencies {
|
||||||
@@ -139,4 +185,4 @@ dependencies {
|
|||||||
|
|
||||||
implementation(libs.showkase)
|
implementation(libs.showkase)
|
||||||
ksp(libs.showkase.processor)
|
ksp(libs.showkase.processor)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user