Skip to content

Commit

Permalink
fix(deps): update kotlin monorepo to v2.1.0 (#2880)
Browse files Browse the repository at this point in the history
* 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 <paul-dingemans@users.noreply.github.com>
  • Loading branch information
renovate[bot] and paul-dingemans authored Dec 1, 2024
1 parent 0595110 commit 3bdb3cb
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 38 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -141,23 +143,22 @@ 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 =
"""
class `$keyword`
""".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 }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -273,23 +275,22 @@ 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 =
"""
fun `$keyword`() = "foo"
""".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 }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 =
"""
Expand Down Expand Up @@ -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 }
}
}

0 comments on commit 3bdb3cb

Please # to comment.