Search code examples
androidkotlingradlegradlewktlint

Run Ktlint for all modules by executing single task command


I have multiple modules in my android project. I have one Gradle file which having code for ktlint. I applied that Gradle file to every module by writing this in the project Gradle file.

subprojects { subProject ->
    apply from: "$project.rootDir/commonFiles/gradleScript/kotlin-code-quality.gradle"
}

now the problem is I can run ktlint on each module by giving their name in command like this.

Running ktlint for cache module.

./gradlew :cache:ktlint

but I need to run all modules ktlint at once.

Here is my open-source repository and pull request on which I need to perform ktlint action.


Solution

  • Sorry, it's my bad. ./gradlew ktlint will always run on multimodule. I had some lint checks fail in the app module. I thought it is running only on the app module.

    but when I fixed the app module's lint and ran the ./gradlew ktlint. it jumped to the cache module.

    I hope it helps you Thanks.