pinterest / ktlint

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

multiline class arguments #2745

Closed mandrachek closed 3 months ago

mandrachek commented 3 months ago

Currently there exists ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than for forcing multi-line functions.

I'd like to have a similar override for class definitions, e.g., something like: ktlint_parameter_wrapping_rule_force_multiline_when_argument_count_greater_or_equal_than=3

data class(field1: String, field2: String, field3: String)

->

data class(
   field1: String, 
   field2: String,
   field:3: String
)

I tried disabling the standard ParameterWrappingRule rule, and creating my own version of it, but I don't yet understand enough of how all the parsing works. It winds up wrapping everything but.

mandrachek commented 3 months ago

Just found this - https://pinterest.github.io/ktlint/latest/rules/standard/#parameter-list-wrapping

ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than=3

was apparently looking at older documentation