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

BorzdeG

11/21/2021, 1:33 PM
Detekt swears in the Multiplatform project. At the same time, there are no such errors in IDEA. What to do about it?Detekt swears in the Multiplatform project. At the same time, there are no such errors in IDEA. What to do about it? https://github.com/itbasis/kochange/runs/4278481352?check_suite_focus=true#step:4:42
g

gammax

11/21/2021, 1:36 PM
What do you mean with Swears?
b

BorzdeG

11/21/2021, 1:36 PM
example:
error: unresolved reference: Currency
The problem seems to be that some of the classes are in commonMain when checking for jvmMain.
j

Javier

11/21/2021, 2:18 PM
I haven't tried to run detekt tasks for specific source sets but I am using detekt in kmp projects with no issues
but I just run gradlew detekt
b

BorzdeG

11/21/2021, 2:23 PM
detekt
in KMP does not check the source code - you can see this by adding an empty class, for example, to commonMain. You will not receive an EmptyClassBlock error
j

Javier

11/21/2021, 2:28 PM
it does for me
I even have it configured with GitHub code scanning
but I don't run detektJvmMain, I just run detekt
b

BorzdeG

11/21/2021, 2:39 PM
because you have prescribed this for all Detekt tasks:
Copy code
setSource(projectDir)
include("**/*.kt")
...
also, apparently you don’t have `expect`/`actual` in your project ...
j

Javier

11/21/2021, 3:19 PM
I am using it in more projects
with expect and actual too
don't remember the default config I have tho, I did it long time ago hahah
there are actual expect there
g

gammax

11/21/2021, 7:42 PM
Just a small heads up: on KMP projects if you use a plain
detetk
you’re not using type resolution. You should use one of the other
detektJvmMain
and similar tasks to enable type resolution.
👍 1
l

leandro

11/09/2022, 2:54 PM
on KMP projects if you use a plain detetk you’re not using type resolution.
Is this still true? I wonder what’s the best way to run detekt on KMP modules, and more specifically, across the whole project
19 Views