https://kotlinlang.org logo
#ktlint
Title
# ktlint
x

xenomachina

12/13/2023, 10:03 PM
Hmmm... It looks like ktlint 1.0.1 also wants every function signature that has more than one parameter to be multi-line, even if it fits on one line.
$ cat Foo.kt
Copy code
class Foo {
    fun baz(key: String) {
        println("$key")
    }

    fun bar(key: String, value: Int) {
        println("$key $value")
    }
}
$ cat .editorconfig
Copy code
max_line_length = 120
ktlint_function_signature_wrapping_rule_always_with_minimum_parameters = 10
(I also tried without setting
ktlint_function_signature_wrapping_rule_always_with_minimum_parameters
)
$ ktlint Foo.kt
Copy code
/private/tmp/Foo.kt:6:13: Newline expected after opening parenthesis (standard:function-signature)
/private/tmp/Foo.kt:6:26: Parameter should start on a newline (standard:function-signature)
/private/tmp/Foo.kt:6:36: Newline expected before closing parenthesis (standard:function-signature)
14:01:27.792 [main] WARN com.pinterest.ktlint.cli.internal.KtlintCommandLine - Lint has found errors than can be autocorrected using 'ktlint --format'

Summary error count (descending) by rule:
  standard:function-signature: 3
2 Views