This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

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

Integraciones sin problemas. Prueba Datadog Code Security

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