Closed metalichesky closed 7 months ago
It expect that you have disabled the type-parameter-list-spacing
which is reponsible for adding the white spaces around type parameters:
$ ktlint-1.1.1 --stdin
09:18:49.975 [main] INFO com.pinterest.ktlint.cli.internal.KtlintCommandLine -- Enable default patterns [**/*.kt, **/*.kts]
fun<T>runSomething(input: T) {}
<stdin>:2:4: Expected a single space (standard:type-parameter-list-spacing)
<stdin>:2:7: Expected a single space (standard:type-parameter-list-spacing)
<stdin>:4:1: Needless blank line(s) (standard:no-consecutive-blank-lines)
Summary error count (descending) by rule:
standard:type-parameter-list-spacing: 2
standard:no-consecutive-blank-lines: 1
Expected Behavior
Type arguments must be wrapped with whitespaces:
Kotlin codestyle proof: https://kotlinlang.org/docs/coding-conventions.html#type-arguments
When you do auto-formatting in IntelliJ or Android Studio, it wraps your type arguments with whitespaces.
Observed Behavior
But
fun-keyword-spacing
rule ignores it and allows you to write code without spacings at all:It only emit error on multiple spaces after
fun
.Steps to Reproduce
Run ktlint check on code like this:
Your Environment
ktlint version 1.1.1 ktlint-gradle 12.1.0 gradle 8.2.0