Inspectopedia Help

Object property naming convention

Reports properties that do not follow the naming conventions.

The following properties are reported:

  • Top-level properties

  • Properties in objects and companion objects

You can specify the required pattern in the inspection options.

Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores.

Example:

// top-level property val USER_NAME_FIELD = "UserName" // top-level property holding reference to singleton object val PersonComparator: Comparator<Person> = /*...*/ class Person { companion object { // property in companion object val NO_NAME = Person() } }

Inspection options

Option

Type

Default

Pattern

String

[A-Za-z][_A-Za-z\d]*

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023