Skip to content

Commit

Permalink
Switch to io.github.usefulness:ktlint-gradle-plugin (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski authored Jan 29, 2023
1 parent 50bca13 commit 96faab6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
30 changes: 14 additions & 16 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
[versions]
google-agp = "7.4.0"
gradle-starter = "0.55.0"
gradle-kotlinter = "3.13.0"
gradle-gradlepublish = "1.1.0"
google-agp = "7.4.0"
gradle-jacocotestkit = "1.0.9"
maven-kotlin = "1.8.0"
maven-issuechecker = "0.3.0"
gradle-detekt = "1.22.0"
maven-junit = "5.9.2"
maven-assertj = "3.24.2"
maven-jgit = "6.4.0.202211300538-r"
gradle-axion = "1.14.3"
gradle-detekt = "1.22.0"
mavencentral-kotlin = "1.8.0"
mavencentral-issuechecker = "0.3.0"
mavencentral-junit = "5.9.2"
mavencentral-assertj = "3.24.2"
mavencentral-jgit = "6.4.0.202211300538-r"
mavencentral-ktlint-gradle = "0.1.0"

[libraries]
agp-gradle = { module = "com.android.tools.build:gradle", version.ref = "google-agp" }
publishplugin-gradle = { module = "com.gradle.publish:plugin-publish-plugin", version.ref = "gradle-gradlepublish" }
usefulness-issuechecker = { module = "com.github.usefulness:issuechecker", version.ref = "maven-issuechecker" }
usefulness-issuechecker = { module = "com.github.usefulness:issuechecker", version.ref = "mavencentral-issuechecker" }
usefulness-ktlint = { module = "io.github.usefulness:ktlint-gradle-plugin", version.ref = "mavencentral-ktlint-gradle" }
detekt-gradle = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "gradle-detekt" }
jmailen-kotlinter = { module = "org.jmailen.gradle:kotlinter-gradle", version.ref = "gradle-kotlinter" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "maven-junit" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "maven-assertj" }
eclipse-jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "maven-jgit" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "mavencentral-junit" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "mavencentral-assertj" }
eclipse-jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "mavencentral-jgit" }
axion-gradle = { module = "pl.allegro.tech.build:axion-release-plugin", version.ref = "gradle-axion" }


[plugins]
jmailen-kotlinter = { id = "org.jmailen.kotlinter", version.ref = "gradle-kotlinter" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "maven-kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "mavencentral-kotlin" }
droidsonroids-jacocotestkit = { id = "pl.droidsonroids.jacoco.testkit", version.ref = "gradle-jacocotestkit" }
starter-config = { id = "com.starter.config", version.ref = "gradle-starter" }
starter-library-kotlin = { id = "com.starter.library.kotlin", version.ref = "gradle-starter" }
Expand Down
4 changes: 1 addition & 3 deletions gradle/plugins/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
plugins {
id 'java-gradle-plugin'
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.jmailen.kotlinter)
alias(libs.plugins.starter.library.kotlin)
}

dependencies {
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin'
implementation libs.publishplugin.gradle
}

Expand Down
2 changes: 1 addition & 1 deletion quality/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

dependencies {
api 'org.jetbrains.kotlin:kotlin-gradle-plugin'
api libs.jmailen.kotlinter
api libs.usefulness.ktlint
api libs.detekt.gradle
implementation libs.usefulness.issuechecker
implementation project(":config")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.project.starter.quality.internal

import com.project.starter.quality.tasks.ProjectCodeStyleTask
import io.github.usefulness.KtlintGradleExtension
import io.github.usefulness.KtlintGradlePlugin
import org.gradle.api.Project
import org.jmailen.gradle.kotlinter.KotlinterExtension
import org.jmailen.gradle.kotlinter.KotlinterPlugin

internal fun Project.configureKtlint() {
pluginManager.apply(KotlinterPlugin::class.java)
pluginManager.apply(KtlintGradlePlugin::class.java)

extensions.configure(KotlinterExtension::class.java) {
extensions.configure(KtlintGradleExtension::class.java) {
it.experimentalRules = true
it.reporters = emptyArray()
it.disabledRules += arrayOf("import-ordering", "filename", "experimental:function-signature")
}

Expand Down
2 changes: 1 addition & 1 deletion quality/src/main/resources/detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ style:
active: true
maxJumpCount: 1
MagicNumber:
active: true
active: false
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts' ]
ignoreNumbers:
- '-1'
Expand Down

0 comments on commit 96faab6

Please sign in to comment.