pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.07k stars 504 forks source link

False positive: EOL comment may not be preceded by a block comment #2599

Closed igorwojda closed 3 months ago

igorwojda commented 3 months ago

Expected Behavior

Black line is there so rule should pass

Observed Behavior

Step 'ktlint' found problem in 'src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koclass/KoClassDeclarationForKoParentClassProviderTest.kt':
Error on line: 124, column: 28
rule: standard:no-consecutive-comments
an EOL comment may not be preceded by a block comment unless separated by a blank line
java.lang.AssertionError: Error on line: 124, column: 28
rule: standard:no-consecutive-comments
an EOL comment may not be preceded by a block comment unless separated by a blank line

Steps to Reproduce

@Test
    fun `object-has-parent-class-with-duplicated-name`() {
        /*
        Some comment
        */

        // given
        val a = 2
}

Your Environment

spotless {
    kotlin {
        project.fileTree(project.rootDir) {
            exclude(".gradle/**")
        }

        ktlint("1.2.1")

        indentWithSpaces()
        endWithNewline()
    }

checks
    isEnforceCheck = false
}
igorwojda commented 3 months ago

Woks as expected