Metadata

ID: kotlin-code-style/annotation-spacing

Language: Kotlin

Severity: Notice

Category: Code Style

Description

Each annotations should be placed on a separate line. This is important because it makes the code more readable and easier to understand. When multiple annotations are placed on the same line, it can become difficult to distinguish between them and understand their individual impacts on the associated code.

Non-Compliant Code Examples

@JvmField

fun foo() {}

@Foo @Bar
/**
 * block comment
 */
class FooBar {
}

Compliant Code Examples

@JvmField
fun foo() {}

/**
 * block comment
 */
@Foo
class FooBar {
}
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