Ktlint-gradle - create/override lint rules

213 views Asked by At

I am using the Ktlint-gradle library in my Android project.

I have recently upgraded to Gradle version 8.2.0 and ktlint version 12.0.3.

Post upgrade, some of the linting rules have changed and I'd like to override them or disable them. But I am unsure what rules need to be added to the .editorconfig file.

First I want to allow inline comments.

e.g.

data class Something(
  val someValue: String // comment about someValue
)

Ktlint error: A comment in a 'value_argument_list' is only allowed when placed on a separate line (cannot be auto-corrected)

Second I want to allow variables to start with an underscore _.

e.g.

val _binding = ViewBinding? = null

Ktlint error: Property name should start with a lowercase letter and use camel case (cannot be auto-corrected)


Could you please assist in providing the rules or settings needed to override these?

0

There are 0 answers