Skip to content

Commit 2320a28

Browse files
committed
replaced kotlinter by jlleitschuh's ktlint plugin
1 parent 33a9992 commit 2320a28

File tree

12 files changed

+93
-98
lines changed

12 files changed

+93
-98
lines changed

.editorconfig

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
[*]
2-
charset=utf-8
3-
end_of_line=lf
4-
insert_final_newline=true
5-
indent_style=space
6-
indent_size=4
7-
max_line_length=120
2+
charset = utf-8
3+
end_of_line = lf
4+
insert_final_newline = true
5+
indent_style = space
6+
indent_size = 4
7+
max_line_length = 120
88

99
[*.json]
10-
indent_size=2
10+
indent_size = 2
1111

1212
[{*.yaml,*.yml}]
13-
indent_size=2
13+
indent_size = 2
1414

1515
[*.ipynb]
16-
insert_final_newline=false
16+
insert_final_newline = false
17+
18+
[*.{kt,kts}]
19+
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
20+
21+
# Disable wildcard imports entirely
22+
ij_kotlin_name_count_to_use_star_import = 2147483647
23+
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
24+
ij_kotlin_packages_to_use_import_on_demand = unset
25+
26+
ktlint_code_style = ktlint_official
27+
ktlint_experimental = enabled
28+
ktlint_standard_filename = disabled
29+
ktlint_standard_no-empty-first-line-in-class-body = disabled
30+
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 4
31+
ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 4
32+
ktlint_ignore_back_ticked_identifier = true
33+
ktlint_standard_multiline-expression-wrapping = disabled
34+
35+
[{*/build/**/*,**/*keywords*/**,**/*.Generated.kt,**/*$Extensions.kt}]
36+
ktlint = disabled

build.gradle.kts

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.jetbrains.kotlinx.dataframe.io.readJson
1010
import org.jetbrains.kotlinx.publisher.apache2
1111
import org.jetbrains.kotlinx.publisher.developer
1212
import org.jetbrains.kotlinx.publisher.githubRepo
13+
import org.jlleitschuh.gradle.ktlint.KtlintExtension
1314

1415
plugins {
1516
with(libs.plugins) {
@@ -19,7 +20,7 @@ plugins {
1920
alias(jupyter.api) apply false
2021
alias(dokka)
2122
alias(kover)
22-
alias(kotlinter)
23+
alias(ktlint)
2324
alias(korro) apply false
2425
alias(docProcessor) apply false
2526
alias(simpleGit) apply false
@@ -54,7 +55,12 @@ dependencies {
5455
}
5556

5657
enum class Version : Comparable<Version> {
57-
SNAPSHOT, DEV, ALPHA, BETA, RC, STABLE;
58+
SNAPSHOT,
59+
DEV,
60+
ALPHA,
61+
BETA,
62+
RC,
63+
STABLE,
5864
}
5965

6066
fun String.findVersion(): Version {
@@ -72,15 +78,19 @@ fun String.findVersion(): Version {
7278
// these names of outdated dependencies will not show up in the table output
7379
val dependencyUpdateExclusions = listOf(
7480
// TODO Requires more work to be updated to 1.7.0+, https://github.com/Kotlin/dataframe/issues/594
75-
libs.plugins.kover.get().pluginId,
76-
// TODO Updating requires major changes all across the project, https://github.com/Kotlin/dataframe/issues/364
77-
libs.plugins.kotlinter.get().pluginId,
81+
libs.plugins.kover
82+
.get()
83+
.pluginId,
7884
// TODO 5.8.0 is not possible due to https://github.com/Kotlin/dataframe/issues/595
7985
libs.kotestAssertions.get().name,
8086
// Can't be updated to 7.4.0+ due to Java 8 compatibility
81-
libs.android.gradle.api.get().group,
82-
// TODO 0.1.6 breaks ktlint, https://github.com/Kotlin/dataframe/issues/598
83-
libs.plugins.korro.get().pluginId,
87+
libs.android.gradle.api
88+
.get()
89+
.group,
90+
// TODO 0.1.6 broke kotlinter, https://github.com/Kotlin/dataframe/issues/598
91+
libs.plugins.korro
92+
.get()
93+
.pluginId,
8494
// Directly dependent on the Gradle version
8595
"org.gradle.kotlin.kotlin-dsl",
8696
)
@@ -100,14 +110,16 @@ tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
100110
doLast {
101111
val outputFile = layout.buildDirectory
102112
.file("../$outputDir/$reportfileName.json")
103-
.get().asFile
113+
.get()
114+
.asFile
104115
when (val outDatedDependencies = DataFrame.readJson(outputFile)["outdated"]["dependencies"][0]) {
105116
is AnyFrame -> {
106-
val df = outDatedDependencies.select {
107-
cols("group", "name", "version") and {
108-
"available"["milestone"] named "newVersion"
109-
}
110-
}.filter { "name"() !in dependencyUpdateExclusions && "group"() !in dependencyUpdateExclusions }
117+
val df = outDatedDependencies
118+
.select {
119+
cols("group", "name", "version") and {
120+
"available"["milestone"] named "newVersion"
121+
}
122+
}.filter { "name"() !in dependencyUpdateExclusions && "group"() !in dependencyUpdateExclusions }
111123
logger.warn("Outdated dependencies found:")
112124
df.print(
113125
rowsLimit = Int.MAX_VALUE,
@@ -137,29 +149,15 @@ allprojects {
137149
targetCompatibility = JavaVersion.VERSION_1_8.toString()
138150
}
139151

140-
// Attempts to configure kotlinter for each sub-project that uses the plugin
152+
// Attempts to configure ktlint for each sub-project that uses the plugin
141153
afterEvaluate {
142154
try {
143-
kotlinter {
144-
ignoreFailures = false
145-
reporters = arrayOf("checkstyle", "plain")
146-
experimentalRules = true
147-
disabledRules = arrayOf(
148-
"no-wildcard-imports",
149-
"experimental:spacing-between-declarations-with-annotations",
150-
"experimental:enum-entry-name-case",
151-
"experimental:argument-list-wrapping",
152-
"experimental:annotation",
153-
"max-line-length",
154-
"filename",
155-
"comment-spacing",
156-
"curly-spacing",
157-
"experimental:annotation-spacing",
158-
"no-unused-imports", // broken
159-
)
155+
configure<KtlintExtension> {
156+
version = "1.3.0"
157+
// rules are set up through .editorconfig
160158
}
161159
} catch (_: UnknownDomainObjectException) {
162-
logger.warn("Could not set kotlinter config on :${this.name}")
160+
logger.warn("Could not set ktlint config on :${this.name}")
163161
}
164162

165163
// set the java toolchain version to 11 for all subprojects for CI stability
@@ -223,13 +221,13 @@ kotlinPublications {
223221
sonatypeSettings(
224222
project.findProperty("kds.sonatype.user") as String?,
225223
project.findProperty("kds.sonatype.password") as String?,
226-
"dataframe project, v. ${project.version}"
224+
"dataframe project, v. ${project.version}",
227225
)
228226

229227
signingCredentials(
230228
project.findProperty("kds.sign.key.id") as String?,
231229
project.findProperty("kds.sign.key.private") as String?,
232-
project.findProperty("kds.sign.key.passphrase") as String?
230+
project.findProperty("kds.sign.key.passphrase") as String?,
233231
)
234232

235233
pom {

core/build.gradle.kts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import nl.jolanrensen.docProcessor.defaultProcessors.ARG_DOC_PROCESSOR_LOG_NOT_F
55
import nl.jolanrensen.docProcessor.gradle.creatingProcessDocTask
66
import org.gradle.jvm.tasks.Jar
77
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
8-
import org.jmailen.gradle.kotlinter.tasks.LintTask
98
import xyz.ronella.gradle.plugin.simple.git.task.GitTask
109

1110
plugins {
@@ -17,7 +16,7 @@ plugins {
1716
alias(korro)
1817
alias(keywordGenerator)
1918
alias(kover)
20-
alias(kotlinter)
19+
alias(ktlint)
2120
alias(docProcessor)
2221
alias(simpleGit)
2322

@@ -103,7 +102,7 @@ tasks.withType<KspTask> {
103102
}
104103
}
105104

106-
tasks.named("lintKotlinSamples") {
105+
tasks.named("runKtlintCheckOverSamplesSourceSet") {
107106
onlyIf { false }
108107
}
109108

@@ -316,37 +315,26 @@ tasks.withType<KspTaskJvm> {
316315
dependsOn(tasks.generateKeywordsSrc)
317316
}
318317

319-
tasks.formatKotlinMain {
318+
tasks.runKtlintFormatOverMainSourceSet {
320319
dependsOn(tasks.generateKeywordsSrc)
321320
dependsOn("kspKotlin")
322321
}
323322

324-
tasks.formatKotlinTest {
323+
tasks.runKtlintFormatOverTestSourceSet {
325324
dependsOn(tasks.generateKeywordsSrc)
326325
dependsOn("kspTestKotlin")
327326
}
328327

329-
tasks.lintKotlinMain {
328+
tasks.runKtlintCheckOverMainSourceSet {
330329
dependsOn(tasks.generateKeywordsSrc)
331330
dependsOn("kspKotlin")
332331
}
333332

334-
tasks.lintKotlinTest {
333+
tasks.runKtlintCheckOverTestSourceSet {
335334
dependsOn(tasks.generateKeywordsSrc)
336335
dependsOn("kspTestKotlin")
337336
}
338337

339-
tasks.withType<LintTask> {
340-
exclude("**/*keywords*/**")
341-
exclude {
342-
it.name.endsWith(".Generated.kt")
343-
}
344-
exclude {
345-
it.name.endsWith("\$Extensions.kt")
346-
}
347-
enabled = true
348-
}
349-
350338
kotlin {
351339
explicitApi()
352340
}

dataframe-arrow/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
alias(kotlin.jvm)
44
alias(publisher)
55
alias(kover)
6-
alias(kotlinter)
6+
alias(ktlint)
77
}
88
}
99

dataframe-excel/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
alias(kotlin.jvm)
44
alias(publisher)
55
alias(kover)
6-
alias(kotlinter)
6+
alias(ktlint)
77
}
88
}
99

dataframe-jdbc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
alias(kotlin.jvm)
44
alias(publisher)
55
alias(kover)
6-
alias(kotlinter)
6+
alias(ktlint)
77
alias(jupyter.api)
88
}
99
}

dataframe-openapi/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
alias(publisher)
55
alias(serialization)
66
alias(kover)
7-
alias(kotlinter)
7+
alias(ktlint)
88
alias(jupyter.api)
99
}
1010
}

gradle/libs.versions.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
ksp = "1.9.23-1.0.20"
33
kotlinJupyter = "0.12.0-139"
44

5-
# TODO Updating requires major changes all across the project
6-
# https://github.com/Kotlin/dataframe/issues/364
7-
ktlint = "3.4.5"
5+
ktlint = "12.1.1"
86

97
# make sure to sync manually with :generator module
108
kotlin = "1.9.22"
@@ -17,7 +15,7 @@ libsPublisher = "1.8.10-dev-43"
1715
# dogfood Gradle / KSP plugins in tests and idea-examples modules
1816
dataframe = "0.13.1"
1917

20-
# TODO 0.1.6 breaks ktlint, https://github.com/Kotlin/dataframe/issues/598
18+
# TODO 0.1.6 breaks kotlinter (which is no longer in use), https://github.com/Kotlin/dataframe/issues/598
2119
korro = "0.1.5"
2220

2321
# TODO Requires more work to be updated to 0.7.0+
@@ -141,7 +139,7 @@ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
141139
keywordGenerator = { id = "org.jetbrains.dataframe.generator", version = "1.0" }
142140
publisher = { id = "org.jetbrains.kotlin.libs.publisher", version.ref = "libsPublisher" }
143141
korro = { id = "io.github.devcrocod.korro", version.ref = "korro" }
144-
kotlinter = { id = "org.jmailen.kotlinter", version.ref = "ktlint" }
142+
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
145143
dataframe = { id = "org.jetbrains.kotlinx.dataframe", version.ref = "dataframe" }
146144
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
147145
docProcessor = { id = "nl.jolanrensen.docProcessor", version.ref = "docProcessor" }

plugins/dataframe-gradle-plugin/build.gradle.kts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
`java-gradle-plugin`
44
`maven-publish`
55
alias(libs.plugins.plugin.publish)
6-
alias(libs.plugins.kotlinter)
6+
alias(libs.plugins.ktlint)
77
}
88

99
repositories {
@@ -51,10 +51,12 @@ tasks.withType<ProcessResources> {
5151
filter {
5252
it.replace(
5353
"%DATAFRAME_JAR%",
54-
project(":core").configurations.getByName("instrumentedJars").artifacts.single().file.absolutePath.replace(
54+
project(
55+
":core",
56+
).configurations.getByName("instrumentedJars").artifacts.single().file.absolutePath.replace(
5557
File.separatorChar,
56-
'/'
57-
)
58+
'/',
59+
),
5860
)
5961
}
6062
}
@@ -77,13 +79,14 @@ gradlePlugin {
7779
id = "org.jetbrains.kotlin.plugin.dataframe"
7880
implementationClass = "org.jetbrains.dataframe.gradle.DeprecatingSchemaGeneratorPlugin"
7981
displayName = "Kotlin Dataframe gradle plugin"
80-
description = "The plugin was moved to 'org.jetbrains.kotlinx.dataframe'. Gradle plugin providing task for inferring data schemas from your CSV or JSON data"
82+
description =
83+
"The plugin was moved to 'org.jetbrains.kotlinx.dataframe'. Gradle plugin providing task for inferring data schemas from your CSV or JSON data"
8184
tags = listOf("dataframe", "kotlin")
8285
}
8386
}
8487
}
8588

86-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
89+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
8790
kotlinOptions.jvmTarget = "1.8"
8891
}
8992

@@ -103,7 +106,6 @@ sourceSets {
103106
}
104107
}
105108

106-
107109
val integrationTestConfiguration by configurations.creating {
108110
extendsFrom(configurations.testImplementation.get())
109111
}

plugins/expressions-converter/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
alias(kotlin.jvm)
55
alias(shadow)
66
alias(publisher)
7-
alias(kotlinter)
7+
alias(ktlint)
88
}
99
}
1010

@@ -66,7 +66,8 @@ tasks.create<JavaExec>("generateTests") {
6666

6767
fun Test.setLibraryProperty(propName: String, jarName: String) {
6868
val path = project.configurations
69-
.testRuntimeClasspath.get()
69+
.testRuntimeClasspath
70+
.get()
7071
.files
7172
.find { """$jarName-\d.*jar""".toRegex().matches(it.name) }
7273
?.absolutePath

0 commit comments

Comments
 (0)