Skip to content

enum-entry-name-case

Kotlinstyleno fixdefault: offkotlin/ktlint

Reports an enum entry whose name is neither PascalCase nor UPPER_SNAKE_CASE (a in enum class E { a, B }).

Enum entries are constants, and the conventions for constants are UPPER_SNAKE_CASE or, since Kotlin reads them as objects, PascalCase. A lowercase entry reads as a property.

To fix, rename the entry in one of the two styles.

Reported
enum class E { a, B, C_D, _e, FooBar }
enum class F { `1x flows`, G_1, _2BIG }
kotlin:
lint:
rules:
enum-entry-name-case: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line enum-entry-name-case 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 enum-entry-name-case full