saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
521 stars 39 forks source link

bug: toggleOnOff() switch not skipping code in extended JpaRepository interface #1758

Open mtyminsky opened 11 months ago

mtyminsky commented 11 months ago

Describe the bug

toggleOnOff() switch not skipping code in extendig JpaRepository interface
example below, but I changed some details because it is a fragment of code from work project.

Expected behavior

should skip fragment of code

Observed behavior

not skipping fragment of code

Steps to Reproduce

package here.is.a.package

import org.springframework.data.jpa.repository.JpaRepository

/** repository */
interface CustomRepo : JpaRepository<Custom, EntityId> {

    /**
     * some description
     *
     * @param param1
     * @param param2
     * @return boolean
     */
    // spotless:off
    fun existsByUserIdAndUserProfileId(param1: EntityId, param2: CustomId): Boolean
    // spotless:on
}
spotless {
    format("misc") {
        target("*.md", ".gitignore")

        trimTrailingWhitespace()
        indentWithTabs()
        endWithNewline()
    }
    kotlin {
        ktfmt().kotlinlangStyle()
        diktat().configFile("${projectDir}/diktat-analysis.yml")
        toggleOffOn()
    }
}

Environment information

nulls commented 11 months ago

Hi @mtyminsky, thanks for reporting the issue. We will look into it