Skip to content

no-empty-file

Kotlincleanupno fixdefault: offkotlin/ktlint

Reports a .kt file with nothing in it but a package, imports and comments.

A file without a declaration is a leftover of a deleted class, or one that was never filled, and it still compiles and shows up in the project.

To fix, delete the file, or add the declaration.

Reported
package a
import b.C
kotlin:
lint:
rules:
no-empty-file: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line no-empty-file in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ktlint no-empty-file full