I just added Spotless to my project with this config:
build.gradle.kts(:app)
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.diffplug.spotless") version "6.23.3"
}
...
spotless {
kotlin {
target("**/*.kt", "**/*.kts")
ktlint()
targetExclude("${layout.buildDirectory}/**/*.kt", "bin/**/*.kt", "buildSrc/**/*.kt")
}
}
however, after running ./gradlew spotlessApply
in terminal it gonna throw this error:
Error on line: 20, column: 5
rule: standard:function-naming
Function name should start with a lowercase letter (except factory methods) and use camel case
But in Line 20 I have a composable fun which should not start with a lowercase letter:
@Composable
fun ExplorerScreen() {
...
}
how can I ignore this error?
Add
ktlint_function_naming_ignore_when_annotated_with=Composable
to .editorconfigCheck out this PR from the nowinandroid repo