Skip to content

Commit

Permalink
Migrate to kotlinter and update ktlint to 0.46.1. (#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite committed Aug 14, 2022
1 parent 9eed239 commit 1f3c8e4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: gradle/wrapper-validation-action@v1

- name: Check style
run: ./gradlew ktlintCheck
run: ./gradlew lintKotlin

# Check if there has been a binary incompatible change to the API.
# If this change is intentional, run `./gradlew apiDump` and commit the new API files.
Expand Down
18 changes: 13 additions & 5 deletions build.gradle.kts
Expand Up @@ -6,7 +6,6 @@ import com.vanniktech.maven.publish.SonatypeHost.DEFAULT
import kotlinx.validation.ApiValidationExtension
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import java.net.URL

buildscript {
Expand Down Expand Up @@ -51,11 +50,20 @@ allprojects {
group = project.groupId
version = project.versionName

apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "org.jmailen.kotlinter")

extensions.configure<KtlintExtension> {
version by rootProject.libs.versions.ktlint
disabledRules by setOf("indent", "max-line-length", "parameter-list-wrapping")
kotlinter {
version = rootProject.libs.versions.ktlint
disabledRules = arrayOf(
"annotation",
"argument-list-wrapping",
"filename",
"indent",
"max-line-length",
"parameter-list-wrapping",
"spacing-between-declarations-with-annotations",
"wrapping",
)
}

tasks.withType<DokkaTaskPartial>().configureEach {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Expand Up @@ -5,14 +5,14 @@ androidx-test = "1.4.0"
compose = "1.2.1"
composeCompiler = "1.3.0"
coroutines = "1.6.4"
ktlint = "0.44.0"
ktlint = "0.46.1"
okhttp = "4.10.0"
okio = "3.2.0"

[plugins]
binaryCompatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.11.0" }
dokka = { id = "org.jetbrains.dokka", version = "1.6.10" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "10.3.0" }
ktlint = { id = "org.jmailen.kotlinter", version = "3.11.1" }

[libraries]
gradlePlugin-android = "com.android.tools.build:gradle:7.2.2"
Expand Down
2 changes: 1 addition & 1 deletion test.sh
@@ -1,2 +1,2 @@
#!/bin/bash
./gradlew apiCheck ktlintCheck testDebugUnitTest connectedDebugAndroidTest
./gradlew apiCheck lintKotlin testDebugUnitTest connectedDebugAndroidTest

0 comments on commit 1f3c8e4

Please sign in to comment.