Naming Long Class Name

ID

kotlin.naming_long_class_name

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

Kotlin

Tags

naming, readability

Description

Reports a class declaration whose name length exceeds a configurable threshold (default 40 characters). Excessively long class names usually signal that the class is doing too much, or that information that belongs in the package structure has leaked into the identifier.

Rationale

A class name is the first contract the class offers to its callers; if the name is hard to read or hard to type, every reference site pays the cost. Long compound names often combine multiple responsibilities (XmlParserAndValidatorAndCachingResultEmitter) and serve as a refactoring signal: split the class, or rely on the package or module name to provide the qualifying context.

// Bad — 51 characters
class ThisIsAVeryLongAndUnnecessarilyVerboseClassNameImpl

// Good — focused name, context comes from the package
class Parser

Remediation

Pick a shorter, more focused name. If the original name encodes several responsibilities, split the class first and name each piece for its single purpose. The maximum length is configurable via the maxLength property.