detekt / detekt

Static code analysis for Kotlin
https://detekt.dev
Apache License 2.0
6.26k stars 773 forks source link

Android Studio highlighting issue for excluded files #1745

Closed schauersbergern closed 5 years ago

schauersbergern commented 5 years ago

Expected Behavior

When in the detekt-config.yml a file or path is excluded for a rule, the line which violates the rule should not be highlighted

Observed Behavior

When in the detekt-config.yml a file or path is excluded for a rule, the line which violates the rule is still highlighted

Steps to Reproduce

open a .kt class, add function:

suspend fun testfun() { var counter = 0

    val tasks = arrayOf<suspend () -> Unit>(
        { counter++ }
    )

    doParallel(*tasks)
}

in detekt-config.yml add

SpreadOperator: active: true excludes: "**/path/to/file"

after detekt check, the line doParallel(*tasks) is still highlighted with error color and error "SpreadOperator: Using a spread operator causes a full copy of the array to be created before calling a method has a very high performance penalty." is displayed

Context

We wand to accomplish the same behaviour of visual plugin inspection and authomatic gradle inspection

Your Environment

schalkms commented 5 years ago

I couldn't reproduce your problem. Can you please post your Gradle config which relates to configuring detekt?

schauersbergern commented 5 years ago

I have set up a minimal detekt project, Here is the config: https://github.com/schauersbergern/detektMinimalSetup/blob/master/build.gradle

Note: Highlighting cannot be suppressed for the files in the excludes, e.g test, androidTest

image

image

schalkms commented 5 years ago

So you are using the Detekt IntelliJ plugin, right? https://github.com/arturbosch/detekt-intellij-plugin

schauersbergern commented 5 years ago

Yes, thanks for the hint, I have filed the issue in the plugin repo