From 3bdb3cb3d187aa397465e554dce5d2ace5da98eb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 21:09:47 +0100 Subject: [PATCH] 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 --- gradle/libs.versions.toml | 4 +-- .../standard/rules/ClassNamingRuleTest.kt | 25 ++++++++++--------- .../standard/rules/FunctionNamingRuleTest.kt | 25 ++++++++++--------- .../standard/rules/PropertyNamingRuleTest.kt | 25 ++++++++++--------- 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index efec88a5b9..8f526bd03f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,8 +3,8 @@ java-compilation = "21" # The java-target version is the lowest supported LTS version of Java. Jar's produced are bytecode compatible with this version. java-target = "8" -kotlin = "2.0.21" -kotlinDev = "2.1.0-RC2" +kotlin = "2.1.0" +kotlinDev = "2.1.0" [plugins] kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/ClassNamingRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/ClassNamingRuleTest.kt index bd382cc0cd..9fd6de457c 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/ClassNamingRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/ClassNamingRuleTest.kt @@ -1,9 +1,11 @@ package com.pinterest.ktlint.ruleset.standard.rules import com.pinterest.ktlint.test.KtLintAssertThat +import org.jetbrains.kotlin.lexer.KtTokens import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.MethodSource import org.junit.jupiter.params.provider.ValueSource class ClassNamingRuleTest { @@ -141,18 +143,7 @@ class ClassNamingRuleTest { } @ParameterizedTest(name = "Keyword: {0}") - @Suppress("ktlint:standard:argument-list-wrapping") - @ValueSource( - strings = [ - "abstract", "actual", "annotation", "as", "break", "by", "catch", "class", "companion", "const", "constructor", "context", - "continue", "contract", "crossinline", "data", "delegate", "do", "dynamic", "else", "enum", "expect", "external", "false", - "field", "file", "final", "finally", "for", "fun", "get", "header", "if", "impl", "import", "in", "infix", "init", "inline", - "inner", "interface", "internal", "is", "lateinit", "noinline", "null", "object", "open", "operator", "out", "override", - "package", "param", "private", "property", "protected", "public", "receiver", "reified", "return", "sealed", "set", "setparam", - "super", "suspend", "tailrec", "this", "throw", "true", "try", "typealias", "typeof", "val", "value", "var", "vararg", "when", - "where", "while", - ], - ) + @MethodSource("ktTokens") fun `Issue 2352 - Given a keyword then allow it to be wrapped between backticks`(keyword: String) { val code = """ @@ -160,4 +151,14 @@ class ClassNamingRuleTest { """.trimIndent() classNamingRuleAssertThat(code).hasNoLintViolations() } + + companion object { + @Suppress("UnstableApiUsage") + @JvmStatic + private fun ktTokens() = + KtTokens.KEYWORDS.types + .plus(KtTokens.SOFT_KEYWORDS.types) + .filterNot { it == KtTokens.AS_SAFE || it == KtTokens.NOT_IN || it == KtTokens.NOT_IS } + .map { it.debugName } + } } diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/FunctionNamingRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/FunctionNamingRuleTest.kt index ec426d08d1..933e1d2bb3 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/FunctionNamingRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/FunctionNamingRuleTest.kt @@ -2,9 +2,11 @@ package com.pinterest.ktlint.ruleset.standard.rules import com.pinterest.ktlint.ruleset.standard.rules.FunctionNamingRule.Companion.IGNORE_WHEN_ANNOTATED_WITH_PROPERTY import com.pinterest.ktlint.test.KtLintAssertThat +import org.jetbrains.kotlin.lexer.KtTokens import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.MethodSource import org.junit.jupiter.params.provider.ValueSource class FunctionNamingRuleTest { @@ -273,18 +275,7 @@ class FunctionNamingRuleTest { } @ParameterizedTest(name = "Keyword: {0}") - @Suppress("ktlint:standard:argument-list-wrapping") - @ValueSource( - strings = [ - "abstract", "actual", "annotation", "as", "break", "by", "catch", "class", "companion", "const", "constructor", "context", - "continue", "contract", "crossinline", "data", "delegate", "do", "dynamic", "else", "enum", "expect", "external", "false", - "field", "file", "final", "finally", "for", "fun", "get", "header", "if", "impl", "import", "in", "infix", "init", "inline", - "inner", "interface", "internal", "is", "lateinit", "noinline", "null", "object", "open", "operator", "out", "override", - "package", "param", "private", "property", "protected", "public", "receiver", "reified", "return", "sealed", "set", "setparam", - "super", "suspend", "tailrec", "this", "throw", "true", "try", "typealias", "typeof", "val", "value", "var", "vararg", "when", - "where", "while", - ], - ) + @MethodSource("ktTokens") fun `Issue 2352 - Given a keyword then allow it to be wrapped between backticks`(keyword: String) { val code = """ @@ -292,4 +283,14 @@ class FunctionNamingRuleTest { """.trimIndent() functionNamingRuleAssertThat(code).hasNoLintViolations() } + + companion object { + @Suppress("UnstableApiUsage") + @JvmStatic + private fun ktTokens() = + KtTokens.KEYWORDS.types + .plus(KtTokens.SOFT_KEYWORDS.types) + .filterNot { it == KtTokens.AS_SAFE || it == KtTokens.NOT_IN || it == KtTokens.NOT_IS } + .map { it.debugName } + } } diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/PropertyNamingRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/PropertyNamingRuleTest.kt index a0601ec530..66bff3e1d0 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/PropertyNamingRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/PropertyNamingRuleTest.kt @@ -3,9 +3,11 @@ package com.pinterest.ktlint.ruleset.standard.rules import com.pinterest.ktlint.test.KtLintAssertThat.Companion.assertThatRule import com.pinterest.ktlint.test.KtlintDocumentationTest import com.pinterest.ktlint.test.LintViolation +import org.jetbrains.kotlin.lexer.KtTokens import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.MethodSource import org.junit.jupiter.params.provider.ValueSource class PropertyNamingRuleTest { @@ -189,18 +191,7 @@ class PropertyNamingRuleTest { } @ParameterizedTest(name = "Keyword: {0}") - @Suppress("ktlint:standard:argument-list-wrapping") - @ValueSource( - strings = [ - "abstract", "actual", "annotation", "as", "break", "by", "catch", "class", "companion", "const", "constructor", "context", - "continue", "contract", "crossinline", "data", "delegate", "do", "dynamic", "else", "enum", "expect", "external", "false", - "field", "file", "final", "finally", "for", "fun", "get", "header", "if", "impl", "import", "in", "infix", "init", "inline", - "inner", "interface", "internal", "is", "lateinit", "noinline", "null", "object", "open", "operator", "out", "override", - "package", "param", "private", "property", "protected", "public", "receiver", "reified", "return", "sealed", "set", "setparam", - "super", "suspend", "tailrec", "this", "throw", "true", "try", "typealias", "typeof", "val", "value", "var", "vararg", "when", - "where", "while", - ], - ) + @MethodSource("ktTokens") fun `Issue 2352 - Given a keyword then allow it to be wrapped between backticks`(keyword: String) { val code = """ @@ -308,4 +299,14 @@ class PropertyNamingRuleTest { """.trimIndent() propertyNamingRuleAssertThat(code).hasNoLintViolations() } + + companion object { + @Suppress("UnstableApiUsage") + @JvmStatic + private fun ktTokens() = + KtTokens.KEYWORDS.types + .plus(KtTokens.SOFT_KEYWORDS.types) + .filterNot { it == KtTokens.AS_SAFE || it == KtTokens.NOT_IN || it == KtTokens.NOT_IS } + .map { it.debugName } + } }