KT.K_DOC_REFERENCES_NON_PUBLIC_PROPERTY

KDoc comments refer to non-public properties of a class

This rule will report any KDoc comments that refer to non-public properties of a class. Clients do not need to know the implementation details.

Noncompliant Code

Copy
/**
* Comment
* [prop1] - non-public property
* [prop2] - public property
*/
class Test {
    private val prop1 = 0
    val prop2 = 0
}

Compliant Code

Copy
/**
* Comment
* [prop2] - public property
*/
class Test {
    private val prop1 = 0
    val prop2 = 0
}

Options

  • excludes (default: ['**/test/**', '**/androidtest/**', '**/commontest/**', '**/jvmtest/**', '**/jstest/**', '**/iostest/**'])

    path filters

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html