このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

Metadata

ID: kotlin-code-style/no-line-break-before-assignment

Language: Kotlin

Severity: Notice

Category: Code Style

Description

Keeping the assignment operator on the same line as the value being assigned improves understandability of code.

Non-Compliant Code Examples

val concurrency // The number of coroutines to use
    = 6

fun sum(a: Int, b: Int): Int
    =      a + b

fun countFor(jobName: String?
= null): Int = 3

val (first, last)
    = getName()

class Router {
    val isEnabled get()
        = true
}

val generate: () -> String?
        // For now, just return null
        = { null }

Compliant Code Examples

val concurrency = // The number of coroutines to use
    6

fun sum(a: Int, b: Int): Int =
    a + b

fun countFor(jobName: String? =
null): Int = 3

val (first, last) =
    getName()

class Router {
    val isEnabled get() =
        true
}

val generate: () -> String? =
        // For now, just return null
        { null }

fun sum(a: Int, b: Int): Int = a + b
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