pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.06k stars 504 forks source link

Can't disable value-argument/parameter-comment #2667

Closed ShindongLee closed 1 month ago

ShindongLee commented 1 month ago

I've read issue https://github.com/pinterest/ktlint/issues/2445 which is resolved but I am having same experiences.

Expected Behavior

Rule value-argument-comment and value-parameter-comment is disabled

Observed Behavior

ktlintFormat / ktlintCheck fails with error:

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

Steps to Reproduce

.editorconfig

[*.{kt,kts}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 180
tab_width = 4
ktlint_standard_value-argument-comment = disabled
ktlint_standard_value-parameter-comment = disabled

code

something.function(
      a = a,
      b = b,
      c = c, // comment <-- A comment in a 'value_argument_list' is only allowed when placed on a separate line (cannot be auto-corrected)
)

data class Something(
    val a: A,
    val b: B,
    val c: C, // comment <-- A comment in a 'value_parameter_list' is only allowed when placed on a separate line (cannot be auto-corrected)
)

Your Environment

ShindongLee commented 1 month ago

never mind,

I am using gradle multi module, and I moved the ktlint block in build.gradle.kts

ktlint {
    version.set("1.2.1")
}

into subproject

subprojects {
    ktlint {
        version.set("1.2.1")
    }
}

and it disabled the rules.

Thank you.

paul-dingemans commented 1 month ago

Nice you solved it yourselves. Enjoy using ktlint!