Enforce if/else expressions to use braces

Metadata

ID: kotlin-best-practices/if-else-bracing

Language: Kotlin

Severity: Notice

Category: Best Practices

Description

No description found

Compliant Code Examples

fun func(value: Int) {
    if (value > 0)
        foo()
    else if (value < 0) {
        bar()
    } else
        baz()
}
fun func(value: Int) {
    if (value > 0) {
        foo()
    } else if (value < 0) {
        bar()
    } else {
        baz()
    }
}
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 Analysis