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