Skip to content

Commit be73e52

Browse files
committed
Upgrade Spotless dependency to 8.4.0
1 parent 327a702 commit be73e52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+7646
-6397
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: Fix lint issues instead of suppressing
3+
description: User prefers fixing lint/format violations in code rather than disabling or suppressing checks
4+
type: feedback
5+
---
6+
7+
Fix lint/format violations in the actual code rather than disabling or suppressing the checks.
8+
9+
**Why:** User wants to maintain code quality standards and not work around linting tools.
10+
11+
**How to apply:** When encountering lint errors, fix the code to comply with the rules instead of adding suppressions or disabling rules in config files.

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ insert_final_newline = true
77
[*.{kt,kts,sh}]
88
indent_style = space
99
indent_size = 4
10+
max_line_length = off
1011

1112
[*.{md,yml,yaml}]
1213
indent_style = space

buildSrc/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ dependencies {
3333
}
3434

3535
java {
36-
sourceCompatibility = JavaVersion.VERSION_11
37-
targetCompatibility = JavaVersion.VERSION_11
36+
sourceCompatibility = JavaVersion.VERSION_25
37+
targetCompatibility = JavaVersion.VERSION_25
3838
}
3939

4040
tasks.withType<KotlinCompile> {
4141
compilerOptions {
42-
jvmTarget = JvmTarget.JVM_11
42+
jvmTarget = JvmTarget.JVM_25
4343
}
4444
}

buildSrc/src/main/kotlin/com/charleskorn/kaml/build/ConfigureAssemble.kt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ fun Project.configureAssemble() {
3333
description = "Prepares files for release."
3434
group = "Distribution"
3535

36-
project.extensions.getByType<PublishingExtension>().publications.names
36+
project.extensions
37+
.getByType<PublishingExtension>()
38+
.publications.names
3739
.filter { it != "kotlinMultiplatform" }
3840
.forEach { publicationName ->
3941
if (publicationName in TARGETS_WITH_JAR_TASK) {
@@ -58,13 +60,29 @@ fun Project.configureAssemble() {
5860
with(
5961
copySpec()
6062
.from(tasks.named("generatePomFileFor${publicationName.capitalize()}Publication"))
61-
.rename { fileName -> if (fileName == "pom-default.xml") "${project.name}-$publicationName-${project.version}.pom" else fileName },
63+
.rename { fileName ->
64+
if (fileName ==
65+
"pom-default.xml"
66+
) {
67+
"${project.name}-$publicationName-${project.version}.pom"
68+
} else {
69+
fileName
70+
}
71+
},
6272
)
6373

6474
with(
6575
copySpec()
6676
.from(tasks.named("generateMetadataFileFor${publicationName.capitalize()}Publication"))
67-
.rename { fileName -> if (fileName == "module.json") "${project.name}-$publicationName-${project.version}.module.json" else fileName },
77+
.rename { fileName ->
78+
if (fileName ==
79+
"module.json"
80+
) {
81+
"${project.name}-$publicationName-${project.version}.module.json"
82+
} else {
83+
fileName
84+
}
85+
},
6886
)
6987
}
7088

buildSrc/src/main/kotlin/com/charleskorn/kaml/build/ConfigurePublishing.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ private fun Project.createPublishingTasks() {
4747
// (see https://kotlinlang.slack.com/archives/C0F4UNJET/p1616470404031100?thread_ts=1616198351.029900&cid=C0F4UNJET)
4848
// This creates an empty JavaDoc JAR to make Maven Central happy.
4949
val publicationName = this.name
50-
val javadocTask = tasks.register<Jar>(this.name + "JavadocJar") {
51-
archiveClassifier.set("javadoc")
52-
archiveBaseName.set("kaml-$publicationName")
53-
}
50+
val javadocTask =
51+
tasks.register<Jar>(this.name + "JavadocJar") {
52+
archiveClassifier.set("javadoc")
53+
archiveBaseName.set("kaml-$publicationName")
54+
}
5455

5556
artifact(javadocTask)
5657

@@ -89,9 +90,12 @@ private fun Project.createPublishingTasks() {
8990

9091
repositories {
9192
maven {
92-
url = rootProject.layout.buildDirectory
93-
.dir("staging-deploy")
94-
.get().asFile.toURI()
93+
url =
94+
rootProject.layout.buildDirectory
95+
.dir("staging-deploy")
96+
.get()
97+
.asFile
98+
.toURI()
9599
}
96100
}
97101
}

buildSrc/src/main/kotlin/com/charleskorn/kaml/build/SpotlessConfiguration.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $licenseText
5151
fun Project.configureSpotless() {
5252
apply<SpotlessPlugin>()
5353

54-
configure<SpotlessExtension>() {
54+
configure<SpotlessExtension> {
5555
format("misc") {
5656
target(
5757
fileTree(
@@ -70,7 +70,7 @@ fun Project.configureSpotless() {
7070

7171
kotlinGradle {
7272
target("*.gradle.kts", "gradle/*.gradle.kts", "buildSrc/*.gradle.kts")
73-
ktlint("0.50.0")
73+
ktlint("1.8.0")
7474

7575
@Suppress("INACCESSIBLE_TYPE")
7676
licenseHeader(kotlinLicenseHeader, "import|tasks|apply|plugins|rootProject")
@@ -82,7 +82,7 @@ fun Project.configureSpotless() {
8282

8383
kotlin {
8484
target("src/**/*.kt", "buildSrc/**/*.kt")
85-
ktlint("0.50.0")
85+
ktlint("1.8.0")
8686

8787
@Suppress("INACCESSIBLE_TYPE")
8888
licenseHeader(kotlinLicenseHeader)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file is generated by updateDaemonJvm
2+
toolchainVersion=25

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ snakeyaml-engine-kmp = "4.0.1"
66
okio = "3.16.4"
77
kotest = "6.1.7"
88
ksp = "2.3.6"
9-
spotless = "7.2.1"
9+
spotless = "8.4.0"
1010

1111
[libraries]
1212
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }

src/commonMain/kotlin/com/charleskorn/kaml/Location.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919

2020
package com.charleskorn.kaml
2121

22-
public data class Location(val line: Int, val column: Int)
22+
public data class Location(
23+
val line: Int,
24+
val column: Int,
25+
)

src/commonMain/kotlin/com/charleskorn/kaml/Yaml.kt

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ public class Yaml(
3737
override val serializersModule: SerializersModule = EmptySerializersModule(),
3838
public val configuration: YamlConfiguration = YamlConfiguration(),
3939
) : StringFormat {
40-
4140
public companion object {
4241
public val default: Yaml = Yaml()
4342
}
4443

45-
public inline fun <reified T> decodeFromYamlNode(node: YamlNode): T =
46-
decodeFromYamlNode(serializersModule.serializer<T>(), node)
44+
public inline fun <reified T> decodeFromYamlNode(node: YamlNode): T = decodeFromYamlNode(serializersModule.serializer<T>(), node)
4745

4846
public fun <T> decodeFromYamlNode(
4947
deserializer: DeserializationStrategy<T>,
@@ -56,12 +54,9 @@ public class Yaml(
5654
override fun <T> decodeFromString(
5755
deserializer: DeserializationStrategy<T>,
5856
string: String,
59-
): T {
60-
return decodeFromSource(deserializer, string.bufferedSource())
61-
}
57+
): T = decodeFromSource(deserializer, string.bufferedSource())
6258

63-
public inline fun <reified T> decodeFromSource(source: Source): T =
64-
decodeFromSource(serializersModule.serializer<T>(), source)
59+
public inline fun <reified T> decodeFromSource(source: Source): T = decodeFromSource(serializersModule.serializer<T>(), source)
6560

6661
public fun <T> decodeFromSource(
6762
deserializer: DeserializationStrategy<T>,
@@ -73,23 +68,25 @@ public class Yaml(
7368
return input.decodeSerializableValue(deserializer)
7469
}
7570

76-
public fun parseToYamlNode(string: String): YamlNode =
77-
parseToYamlNode(string.bufferedSource())
71+
public fun parseToYamlNode(string: String): YamlNode = parseToYamlNode(string.bufferedSource())
7872

7973
internal fun parseToYamlNode(source: Source): YamlNode {
8074
val parser = YamlParser(source, configuration.codePointLimit)
81-
val reader = YamlNodeReader(
82-
parser,
83-
configuration.extensionDefinitionPrefix,
84-
configuration.anchorsAndAliases.maxAliasCount,
85-
)
75+
val reader =
76+
YamlNodeReader(
77+
parser,
78+
configuration.extensionDefinitionPrefix,
79+
configuration.anchorsAndAliases.maxAliasCount,
80+
)
8681
val node = reader.read()
8782
parser.ensureEndOfStreamReached()
8883
return node
8984
}
9085

91-
public inline fun <reified T> encodeToSink(value: T, sink: Sink): Unit =
92-
encodeToSink(serializersModule.serializer<T>(), value, sink)
86+
public inline fun <reified T> encodeToSink(
87+
value: T,
88+
sink: Sink,
89+
): Unit = encodeToSink(serializersModule.serializer<T>(), value, sink)
9390

9491
public fun <T> encodeToSink(
9592
serializer: SerializationStrategy<T>,
@@ -108,8 +105,10 @@ public class Yaml(
108105
return buffer.readUtf8().trimEnd()
109106
}
110107

111-
public inline fun <reified T> encodeToBufferedSink(value: T, sink: BufferedSink): Unit =
112-
encodeToBufferedSink(serializersModule.serializer<T>(), value, sink)
108+
public inline fun <reified T> encodeToBufferedSink(
109+
value: T,
110+
sink: BufferedSink,
111+
): Unit = encodeToBufferedSink(serializersModule.serializer<T>(), value, sink)
113112

114113
@PublishedApi
115114
internal fun <T> encodeToBufferedSink(
@@ -127,14 +126,19 @@ public class Yaml(
127126

128127
private class BufferedSinkDataWriter(
129128
val sink: BufferedSink,
130-
) : StreamDataWriter, AutoCloseable {
129+
) : StreamDataWriter,
130+
AutoCloseable {
131131
override fun flush(): Unit = sink.flush()
132132

133133
override fun write(str: String) {
134134
sink.writeUtf8(str)
135135
}
136136

137-
override fun write(str: String, off: Int, len: Int) {
137+
override fun write(
138+
str: String,
139+
off: Int,
140+
len: Int,
141+
) {
138142
sink.writeUtf8(string = str, beginIndex = off, endIndex = off + len)
139143
}
140144

0 commit comments

Comments
 (0)