Metadata

ID: kotlin-code-style/brace-spacing

Language: Kotlin

Severity: Notice

Category: Code Style

Description

In lambda expressions, there should be a space separating each brace from the function’s body. If the function takes parameters, there should also be a space on either side of the arrow.

Non-Compliant Code Examples

val values = list.filter {it > 10}
val values = list.filter { x->x > 10 }

Compliant Code Examples

val values = list.filter { it > 10 }
val values = list.filter { x -> x > 10 }
val values = list.filter int@{ it > 10 }
val values = list.filter {
    it > 10
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Security

PREVIEWING: guillaume.barrier/ERRORT-5095-general-doc-update