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-best-practices/no-empty-file

Language: Kotlin

Severity: Notice

Category: Best Practices

Description

A Kotlin (script) file should not be empty. It needs to contain at least one declaration. Files only containing a package and/or import statements are disallowed.

Non-Compliant Code Examples

package foo

import foo

Compliant Code Examples

package test.foo.bar

import foo

fun foo() {
    println("File has declaration")
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Integraciones perfectas. Prueba Datadog Code Analysis