Skip to content

Commit 3bdb3cb

Browse files
fix(deps): update kotlin monorepo to v2.1.0 (#2880)
* fix(deps): update kotlin monorepo to v2.1.0 * Remove keywords from unit tests that no longer exists on Kotlin 2.1 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Paul Dingemans <[email protected]>
1 parent 0595110 commit 3bdb3cb

File tree

4 files changed

+41
-38
lines changed

4 files changed

+41
-38
lines changed

gradle/libs.versions.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
java-compilation = "21"
44
# The java-target version is the lowest supported LTS version of Java. Jar's produced are bytecode compatible with this version.
55
java-target = "8"
6-
kotlin = "2.0.21"
7-
kotlinDev = "2.1.0-RC2"
6+
kotlin = "2.1.0"
7+
kotlinDev = "2.1.0"
88

99
[plugins]
1010
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/ClassNamingRuleTest.kt

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.pinterest.ktlint.ruleset.standard.rules
22

33
import com.pinterest.ktlint.test.KtLintAssertThat
4+
import org.jetbrains.kotlin.lexer.KtTokens
45
import org.junit.jupiter.api.Nested
56
import org.junit.jupiter.api.Test
67
import org.junit.jupiter.params.ParameterizedTest
8+
import org.junit.jupiter.params.provider.MethodSource
79
import org.junit.jupiter.params.provider.ValueSource
810

911
class ClassNamingRuleTest {
@@ -141,23 +143,22 @@ class ClassNamingRuleTest {
141143
}
142144

143145
@ParameterizedTest(name = "Keyword: {0}")
144-
@Suppress("ktlint:standard:argument-list-wrapping")
145-
@ValueSource(
146-
strings = [
147-
"abstract", "actual", "annotation", "as", "break", "by", "catch", "class", "companion", "const", "constructor", "context",
148-
"continue", "contract", "crossinline", "data", "delegate", "do", "dynamic", "else", "enum", "expect", "external", "false",
149-
"field", "file", "final", "finally", "for", "fun", "get", "header", "if", "impl", "import", "in", "infix", "init", "inline",
150-
"inner", "interface", "internal", "is", "lateinit", "noinline", "null", "object", "open", "operator", "out", "override",
151-
"package", "param", "private", "property", "protected", "public", "receiver", "reified", "return", "sealed", "set", "setparam",
152-
"super", "suspend", "tailrec", "this", "throw", "true", "try", "typealias", "typeof", "val", "value", "var", "vararg", "when",
153-
"where", "while",
154-
],
155-
)
146+
@MethodSource("ktTokens")
156147
fun `Issue 2352 - Given a keyword then allow it to be wrapped between backticks`(keyword: String) {
157148
val code =
158149
"""
159150
class `$keyword`
160151
""".trimIndent()
161152
classNamingRuleAssertThat(code).hasNoLintViolations()
162153
}
154+
155+
companion object {
156+
@Suppress("UnstableApiUsage")
157+
@JvmStatic
158+
private fun ktTokens() =
159+
KtTokens.KEYWORDS.types
160+
.plus(KtTokens.SOFT_KEYWORDS.types)
161+
.filterNot { it == KtTokens.AS_SAFE || it == KtTokens.NOT_IN || it == KtTokens.NOT_IS }
162+
.map { it.debugName }
163+
}
163164
}

ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/FunctionNamingRuleTest.kt

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ package com.pinterest.ktlint.ruleset.standard.rules
22

33
import com.pinterest.ktlint.ruleset.standard.rules.FunctionNamingRule.Companion.IGNORE_WHEN_ANNOTATED_WITH_PROPERTY
44
import com.pinterest.ktlint.test.KtLintAssertThat
5+
import org.jetbrains.kotlin.lexer.KtTokens
56
import org.junit.jupiter.api.Nested
67
import org.junit.jupiter.api.Test
78
import org.junit.jupiter.params.ParameterizedTest
9+
import org.junit.jupiter.params.provider.MethodSource
810
import org.junit.jupiter.params.provider.ValueSource
911

1012
class FunctionNamingRuleTest {
@@ -273,23 +275,22 @@ class FunctionNamingRuleTest {
273275
}
274276

275277
@ParameterizedTest(name = "Keyword: {0}")
276-
@Suppress("ktlint:standard:argument-list-wrapping")
277-
@ValueSource(
278-
strings = [
279-
"abstract", "actual", "annotation", "as", "break", "by", "catch", "class", "companion", "const", "constructor", "context",
280-
"continue", "contract", "crossinline", "data", "delegate", "do", "dynamic", "else", "enum", "expect", "external", "false",
281-
"field", "file", "final", "finally", "for", "fun", "get", "header", "if", "impl", "import", "in", "infix", "init", "inline",
282-
"inner", "interface", "internal", "is", "lateinit", "noinline", "null", "object", "open", "operator", "out", "override",
283-
"package", "param", "private", "property", "protected", "public", "receiver", "reified", "return", "sealed", "set", "setparam",
284-
"super", "suspend", "tailrec", "this", "throw", "true", "try", "typealias", "typeof", "val", "value", "var", "vararg", "when",
285-
"where", "while",
286-
],
287-
)
278+
@MethodSource("ktTokens")
288279
fun `Issue 2352 - Given a keyword then allow it to be wrapped between backticks`(keyword: String) {
289280
val code =
290281
"""
291282
fun `$keyword`() = "foo"
292283
""".trimIndent()
293284
functionNamingRuleAssertThat(code).hasNoLintViolations()
294285
}
286+
287+
companion object {
288+
@Suppress("UnstableApiUsage")
289+
@JvmStatic
290+
private fun ktTokens() =
291+
KtTokens.KEYWORDS.types
292+
.plus(KtTokens.SOFT_KEYWORDS.types)
293+
.filterNot { it == KtTokens.AS_SAFE || it == KtTokens.NOT_IN || it == KtTokens.NOT_IS }
294+
.map { it.debugName }
295+
}
295296
}

ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/PropertyNamingRuleTest.kt

+13-12
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ package com.pinterest.ktlint.ruleset.standard.rules
33
import com.pinterest.ktlint.test.KtLintAssertThat.Companion.assertThatRule
44
import com.pinterest.ktlint.test.KtlintDocumentationTest
55
import com.pinterest.ktlint.test.LintViolation
6+
import org.jetbrains.kotlin.lexer.KtTokens
67
import org.junit.jupiter.api.Nested
78
import org.junit.jupiter.api.Test
89
import org.junit.jupiter.params.ParameterizedTest
10+
import org.junit.jupiter.params.provider.MethodSource
911
import org.junit.jupiter.params.provider.ValueSource
1012

1113
class PropertyNamingRuleTest {
@@ -189,18 +191,7 @@ class PropertyNamingRuleTest {
189191
}
190192

191193
@ParameterizedTest(name = "Keyword: {0}")
192-
@Suppress("ktlint:standard:argument-list-wrapping")
193-
@ValueSource(
194-
strings = [
195-
"abstract", "actual", "annotation", "as", "break", "by", "catch", "class", "companion", "const", "constructor", "context",
196-
"continue", "contract", "crossinline", "data", "delegate", "do", "dynamic", "else", "enum", "expect", "external", "false",
197-
"field", "file", "final", "finally", "for", "fun", "get", "header", "if", "impl", "import", "in", "infix", "init", "inline",
198-
"inner", "interface", "internal", "is", "lateinit", "noinline", "null", "object", "open", "operator", "out", "override",
199-
"package", "param", "private", "property", "protected", "public", "receiver", "reified", "return", "sealed", "set", "setparam",
200-
"super", "suspend", "tailrec", "this", "throw", "true", "try", "typealias", "typeof", "val", "value", "var", "vararg", "when",
201-
"where", "while",
202-
],
203-
)
194+
@MethodSource("ktTokens")
204195
fun `Issue 2352 - Given a keyword then allow it to be wrapped between backticks`(keyword: String) {
205196
val code =
206197
"""
@@ -308,4 +299,14 @@ class PropertyNamingRuleTest {
308299
""".trimIndent()
309300
propertyNamingRuleAssertThat(code).hasNoLintViolations()
310301
}
302+
303+
companion object {
304+
@Suppress("UnstableApiUsage")
305+
@JvmStatic
306+
private fun ktTokens() =
307+
KtTokens.KEYWORDS.types
308+
.plus(KtTokens.SOFT_KEYWORDS.types)
309+
.filterNot { it == KtTokens.AS_SAFE || it == KtTokens.NOT_IN || it == KtTokens.NOT_IS }
310+
.map { it.debugName }
311+
}
311312
}

0 commit comments

Comments
 (0)