A Kotlin (script) file should not be empty.

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

Seamless integrations. Try Datadog Code Analysis