Thread
#detekt
    Javier

    Javier

    9 months ago
    I searched for
    multiplatform
    in docs and I found nothing. I am just running
    ./gradlew detekt
    (indeed
    ./gradlew build
    ) and I would like to know if just running it in the linux runner is enough or I just run
    detekt
    on every single runner to detect code smells in all targets of all modules. I would like to avoid running specific
    detekt**
    tasks because I am using reusable workflows in all projects and every project can have different targets and I want a modular workflow but not very complex one.
    b

    Brais Gabin

    9 months ago
    detekt
    is a dump task. It only runs on src/main/java(kotlin) and src/test/java(kotlin). If you want it to run over other source sets you need to add them. (I'm on phone so please check the documentation to see how, I can't link it). And remember that you wouldn't be running the rules that need type solving. My recommendation is to add the task
    detektAll
    to all your projects and configure it for each one in gradle. We need to refactor our gradle plugin. At the begging it was doing a very simple thing so the api was really simple but that api didn't evolve with the complexity of the project. But we would need to add lots of breaking changes to do that. It's a difficult topic. Any contribution to six this is more than appreciated as always.
    Javier

    Javier

    9 months ago
    I checked the config I did years ago and it looks like I am adding the entire project as sources and indicating the files detekt has to check
    target.tasks.withType(Detekt::class.java).configureEach { detekt ->
                detekt.setSource(detekt.project.files(detekt.project.projectDir))
                detekt.include("**/*.kt")
                detekt.include("**/*.kts")
                detekt.exclude("**/resources/**")
                detekt.exclude("**/build/**")
    }
    not sure if this setup can be problematic in term of performance
    in term of KMP, it is working
    b

    Brais Gabin

    9 months ago
    No idea about preformance. But yes, it should work.
    Javier

    Javier

    9 months ago
    Perfect, thank you 🙂
    gammax

    gammax

    9 months ago
    Just a side note that you’re not using Type Resolution if you follow this approach.
    Javier

    Javier

    9 months ago
    Problem is I have a lot of multiplatform projects
    And type resolution doesnt work on them no? Only jvm and android
    gammax

    gammax

    9 months ago
    Yup that’s correct 👍 If you’re looking for TR on iOS/Native/JS, you should consider using the compiler plugin