Class Naming
ID |
kotlin.naming_class |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Code Smell |
Language |
Kotlin |
Tags |
naming_convention, style |
Description
Reports class, interface, enum class, and object declarations whose name does
not match the configurable classNamePattern (default: ^[A-Z][a-zA-Z0-9_]*$).
The Kotlin convention requires type names to use UpperCamelCase.
Rationale
Consistent naming improves readability and makes it easier to distinguish types from variables and functions at a glance. A lowercase-starting type name is almost always a mistake.
// Bad — lowercase first letter
class myClass // FLAW
interface myService // FLAW
enum class myStatus { A, B } // FLAW
// Good
class MyClass
interface MyService
enum class MyStatus { A, B }