rocketraman
12/20/2021, 8:31 PMgammax
12/20/2021, 11:04 PM• I’m looking to enable detekt across all source sets in a kvision style project: frontendMain, commonMain, backendMainYou should have all the Detekt tasks already created for you
• I’d like to enable the formatter/ktlint plugin for all source setsThis is supported and “should work” out of the box
• I’d like to customize detekt ideally once for all source sets in the entire projectSame as above, you should be able to specify the
detekt{}
configuration at the same level where you apply the kotlin("multiplatform")
Gradle plugin
• Detekt should run with type supportThat’s the tricky point. TR works so far onyl with Android & JVM targets only
rocketraman
12/20/2021, 11:24 PMYou should have all the Detekt tasks already created for youI am missing the
detektCommonMain
task. I do have detektMetadataCommonMain
. I do also have the expected detektBackendMain
and detektFrontendMain
tasks.
> I’d like to enable the formatter/ktlint plugin for all source sets
This is supported and “should work” out of the boxI had to explicitly specify
source
i.e.:
source = files("src/backendMain/kotlin", "src/backendTest/kotlin", "src/commonMain/kotlin", "src/frontendMain/kotlin")
Is that to be expected or am I doing something wrong?
I was also unable to add the formatter plugin -- trying to add detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.19.0"
at the all
in the multiplatform dependencies declaration did not work. I didn't try to add it to each source set independently -- not sure if that would work.gammax
12/20/2021, 11:32 PMrocketraman
12/21/2021, 2:23 AMLine 65: detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.19.0")
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
Not open source, sorrydependencies
block, not inside the sourceSets
.