diktat icon indicating copy to clipboard operation
diktat copied to clipboard

Empty lines in class constructor before properties with comments

Open DrAlexD opened this issue 2 years ago • 0 comments

Describe the bug

It looks like BLANK_LINE_BETWEEN_PROPERTIES rule also applies to class constructor. And it happens only for KDoc comments.

Expected behavior

/**
 * @property name single-line comment
 * @property birthDate
 *   kdoc property
 *   comment
 */
class B<K : Any> constructor(
    val name: String,
    /*
     * block
     * comment
     */
    private val lastName: String,
    val birthDate: String,
    /**
     * @property addr property
     * comment
     */
    val addr: String
) {}

Observed behavior

/**
 * @property name single-line comment
 * @property birthDate
 *   kdoc property
 *   comment
 */
class B<K : Any> constructor(
    val name: String,
    /*
     * block
     * comment
     */
    private val lastName: String,
    
    val birthDate: String,

    /**
     * @property addr property
     * comment
     */
    val addr: String
) {}

Steps to Reproduce

class B<K : Any> constructor(
    // single-line comment
    val name: String,
    /*
     * block
     * comment
     */
    private val lastName: String,
    /**
     * kdoc property
     * comment
     */
    val birthDate: String,
    /**
     * @property addr property
     * comment
     */
    val addr: String
) {}

DrAlexD avatar Dec 21 '23 11:12 DrAlexD