-
-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive from UnusedImports on org.gradle.kotlin.dsl.provideDelegate #1608
Comments
This is interesting, because See KT-22101 and gradle/kotlin-dsl-samples#564 Not sure what best thing to do is, since trying to whitelist this case in detekt doesn't seem the right approach. |
Hmm, that makes sense to me. But looking at the delegated properties doc, this imported function seems to be an overloaded operator. So when we use the delegated property in scope, it should be considered as being in used theoretically. |
Sorry, haven't had time to look at this more closely. Can you see what ktlint does here? It has a similar rule. |
Couldn't help myself - there's a whitelist of all the operators in the rule in detekt, just need to add |
Sounds good to me |
have tried running ktlint, it would also report |
Hi,
I've found that when I'm writing the gradle buildSrc using kotlin dsl, and use the kotlin delegation, I would need to import
org.gradle.kotlin.dsl.provideDelegate
. But Detekt would give me anUnusedImports
error in this case.For example, with the following code, detekt task would fail:
Expected Behavior
It should not report
UnusedImports
if I do use it for delegation.Observed Behavior
Detekt task fails and report there's an
UnusedImports
error.Your Environment
The text was updated successfully, but these errors were encountered: