https://kotlinlang.org logo
#detekt
Title
# detekt
x

Xavier F. Gouchet

02/29/2024, 9:18 AM
Hello team, I'm trying to write some custom rule on a KMM project, and my rule needs type resolution. When I run it againt the jvm source set (calling
./gradlew :detektJvmMain
), my rule does have the type resolution and behaves as expected, but against the common source set (calling
./gradlew :detektMetadataMain
), the
bindingContext
is always null. Is this expected, or is there a way to have a binding context against non jvm sources?
b

Brais Gabin

02/29/2024, 12:22 PM
Right now there is no way to make that.
And I think that Metadata will never be able to have binging information. The binding information comes from a compilation and common itself can't be compiles against "the void". Maybe we can do something else with k2, and their new apis but as far as I know no one checked that yet.
x

Xavier F. Gouchet

02/29/2024, 4:09 PM
Interesting, and is there a way to have the commonMain source sets checked when running detekt on jvmMain for example ?
b

Brais Gabin

02/29/2024, 5:29 PM
🤔 Good point. I must say that I never used detekt multiplatform. I was assuming that the errors on common would be raised on every single task. If that's not the case maybe an issue should be opened with your use case at see how to fix it.
x

Xavier F. Gouchet

02/29/2024, 5:29 PM
That's not the case indeed, calling detektJvmMain only runs against the kotlin files in the jvmMain source set
I'll open an issue on github 😉
❤️ 1
e

eygraber

03/13/2024, 6:51 PM
@Xavier F. Gouchet did you end up opening an issue for it? If not I can open one.
x

Xavier F. Gouchet

03/14/2024, 6:06 AM
Hey, Eliezer, sorry I got side tracked, but yeah you can open it 🙂
Eventually came around to do it here
2 Views