KT.FORBIDDEN_PUBLIC_DATA_CLASS
Data class in public APIs
Data classes are bad for binary compatibility in public APIs. Avoid using them. This rule is aimed at library maintainers. If you are developing a final application you can ignore this issue. More info: https://jakewharton.com/public-api-challenges-in-kotlin/
Noncompliant Code
Copy
data class C(val a: String) // violation: public data class
Compliant Code
Copy
internal data class C(val a: String)
Options
-
excludes
(default:['**']
)path filter
-
ignorePackages
(default:['*.internal', '*.internal.*']
)ignores classes in the specified packages