Use ktlint plugin instead of manual ktlint tasks

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-03-17 13:46:44 +01:00
parent d1d6898ffb
commit eb67a31bd1
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
3 changed files with 4 additions and 21 deletions

View File

@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
task: [ detekt, ktlint ]
task: [ detekt, ktlintCheck ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8

View File

@ -31,10 +31,7 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.github.spotbugs'
apply plugin: 'io.gitlab.arturbosch.detekt'
configurations {
ktlint
}
apply plugin: "org.jlleitschuh.gradle.ktlint"
def urlFile = { url, fileName ->
File file = new File("$buildDir/download/${fileName}")
@ -149,7 +146,7 @@ android {
}
}
check.dependsOn 'spotbugsGplayDebugReport', 'lint', 'ktlint', 'detekt'
check.dependsOn 'spotbugsGplayDebug', 'lint', 'ktlintCheck', 'detekt'
lint.dependsOn 'preBuild'
compileOptions {
@ -206,7 +203,6 @@ dependencies {
implementation ('com.gitlab.bitfireAT:dav4jvm:2.1.3', {
exclude group: 'org.ogce', module: 'xpp3' // Android comes with its own XmlPullParser
})
ktlint "com.pinterest:ktlint:0.44.0"
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'androidx.camera:camera-core:1.0.2'
@ -338,20 +334,6 @@ dependencies {
gplayImplementation "com.google.firebase:firebase-messaging:23.0.0"
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "--reporter=plain", "--reporter=plain,output=${buildDir}/ktlint.txt,src/**/*.kt"
}
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "-F", "src/**/*.kt"
}
detekt {
reports {
xml {

View File

@ -40,6 +40,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.5'
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files