Skip to content

Commit

Permalink
Update dependency com.pinterest.ktlint:ktlint-ruleset-standard to v0.…
Browse files Browse the repository at this point in the history
…50.0 (#6239)

* Update dependency com.pinterest.ktlint:ktlint-ruleset-standard to v0.50.0

* Update test code to align to new rule behaviour

* Fix new issues raised by ktlint

* Fix a typo

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Matthew Haughton <3flex@users.noreply.github.com>
  • Loading branch information
2 people authored and cortinico committed Jul 15, 2023
1 parent e44a7e8 commit 7ee3b8a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class KtTreeCompiler(
val service = settings.taskPool
val tasks = kotlinFiles.map { path ->
service.task { compiler.compile(basePath, path) }
.recover { settings.error("Could not compile '$path'.", it); null }
.recover {
settings.error("Could not compile '$path'.", it)
null
}
}.toList()
return awaitAll(tasks).filterNotNull()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ inline fun <reified T : Extension> loadExtensions(
.filter(predicate)
.sortedBy { it.priority }
.asReversed()
.onEach { it.init(settings.config); it.init(settings) }
.onEach {
it.init(settings.config)
it.init(settings)
}
.also { settings.debug { "Loaded extensions: $LIST_ITEM_SPACING${it.joinToString(LIST_ITEM_SPACING)}" } }
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class ParameterListWrappingSpec {
@Test
fun `reports when max line length is exceeded`() {
val code = """
fun f(a: Int, b: Int, c: Int) {}
fun f(a: Int, b: Int, c: Int) {
}
""".trimIndent()
val config = TestConfig("maxLineLength" to "10")
assertThat(ParameterListWrapping(config).lint(code)).hasSize(4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ class MethodSignatureSpec {
"'protected',true",
"'private',false"
)
fun `should return x for finalize function with y access modifier`(accessModifier: String, isFinalize: Boolean) {
fun `should return x for finalize function with y access modifier`(
accessModifier: String,
isFinalize: Boolean,
) {
val namedFunction = makeFunction("$accessModifier fun finalize() {}")
assertThat(namedFunction.isJvmFinalizeFunction()).isEqualTo(isFinalize)
}
Expand All @@ -85,7 +88,7 @@ class MethodSignatureSpec {
}

@Test
fun `should return false for overriden finalize function`() {
fun `should return false for overridden finalize function`() {
val namedFunction = makeFunction("override fun finalize()")
assertThat(namedFunction.isJvmFinalizeFunction()).isFalse()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ class StringLiteralDuplication(config: Config = Config.empty) : Rule(config) {
private fun add(str: KtStringTemplateExpression) {
val text = str.plainContent
literals.compute(text) { _, oldValue -> oldValue?.plus(1) ?: 1 }
literalReferences.compute(text) { _, entries -> entries?.add(str); entries ?: mutableListOf(str) }
literalReferences.compute(text) { _, entries ->
entries?.add(str)
entries ?: mutableListOf(str)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dokka = "1.8.10"
jacoco = "0.8.10"
kotlin = "1.8.22"
ktlint = "0.49.1"
ktlint = "0.50.0"
junit = "5.9.3"
contester = "0.2.0"

Expand Down

0 comments on commit 7ee3b8a

Please sign in to comment.