Search code examples
androidktlint

How do you tell ktlint in android to exclude specific paths in the project?


Currently when I want to format my code, I run this in the terminal in my android studio directory

https://github.com/pinterest/ktlint

./gradlew ktlintFormat

This command works great, but recently I added some folders into my project and the code in there is being checked by the ktlintFormat command. I wish to exclude those folders from being checked. Does anyone know if this is possible?


Solution

  • ktlint {
        filter {
            exclude("**/generated/**")
            include("**/kotlin/**")
        }
    }