Create plugin for linting (#8942)

This commit is contained in:
Andreas
2023-01-19 04:33:56 +01:00
committed by GitHub
parent b56b8b55b4
commit c31e75f02f
15 changed files with 45 additions and 38 deletions

View File

@ -3,12 +3,14 @@ plugins {
}
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinLibs.versions.kotlin.version.get()}")
implementation(androidxLibs.gradle)
implementation(kotlinLibs.gradle)
implementation(libs.kotlinter)
implementation(gradleApi())
}
repositories {
gradlePluginPortal()
mavenCentral()
google()
}

View File

@ -1,5 +1,11 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
create("androidxLibs") {
from(files("../gradle/androidx.versions.toml"))
}
create("kotlinLibs") {
from(files("../gradle/kotlinx.versions.toml"))
}

View File

@ -0,0 +1,20 @@
import org.jmailen.gradle.kotlinter.KotlinterExtension
import org.jmailen.gradle.kotlinter.KotlinterPlugin
apply<KotlinterPlugin>()
extensions.configure<KotlinterExtension>("kotlinter") {
experimentalRules = true
disabledRules = arrayOf(
"experimental:argument-list-wrapping", // Doesn't play well with Android Studio
"filename", // Often broken to give a more general name
)
}
tasks {
named<DefaultTask>("preBuild").configure {
if (!System.getenv("CI").toBoolean())
dependsOn("formatKotlin")
}
}