Enums should be a single line or one entry per line.

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

Metadata

ID: kotlin-code-style/enum-wrapping

Language: Kotlin

Severity: Notice

Category: Code Style

Description

An enum should be a single line, or each enum entry has to be placed on a separate line. In case the enumeration contains enum entries and declarations those are to be separated by a blank line.

Non-Compliant Code Examples

enum class Foo {
    A,
    B, C,
    D
}

enum class Foo {
    A;
    fun foo() = "foo"
}

Compliant Code Examples

enum class Foo { A, B, C, D }

enum class Foo {
    A,
    B,
    C,
    D
}

enum class Foo {
    A,
    B,
    C,
    D,
    ;

    fun foo() = "foo"
}
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