Enum Entry Naming

ID

kotlin.naming_enum_entry

Severity

info

Remediation Complexity

medium

Remediation Risk

low

Remediation Effort

medium

Resource

Code Smell

Language

Kotlin

Tags

naming_convention, style

Description

Reports enum entries whose name starts with a lowercase letter. Kotlin allows either UPPER_CASE (Java tradition) or UpperCamelCase — both start with an uppercase letter.

Rationale

Lowercase-starting enum entries violate the Kotlin naming convention and are easily confused with local variables.

// Bad — lowercase first letter
enum class Priority {
    low,    // FLAW
    medium, // FLAW
    high    // FLAW
}

// Good — UPPER_CASE
enum class Priority { LOW, MEDIUM, HIGH }

// Good — UpperCamelCase
enum class Priority { Low, Medium, High }

Remediation

Rename enum entries to start with an uppercase letter, using either UPPER_CASE or UpperCamelCase consistently throughout the enum.