Closed vinaygopinath closed 6 months ago
On second thought, I think the warning is due to the interaction between
standard:parameter-list-spacing
which expects the field name and its class to be separated by a colon and a space, as in exactly in the unformatted code
class MyClass @Inject constructor(
val someReallyLongFieldNameUsedInMyClass: SomeReallyLongDependencyClass
)
standard:parameter-wrapping
which, when the field name and class name exceed the max line length, complains about a "Missing newline before SomeReallyLongDependencyClass"standard:max-line-length
standard:indent
Technically I could not reproduce your problem because you most likely have changed the class names to shorter names. But with decreasing the max_line_length to 74
, I was able to reproduce it.
Problem is indeed caused by rules parameter-list-spacing
and parameter-wrapping
. They disagree with each other about how to format the parameter.
When the
parameter-wrapping
andindent
rules are enabled, and a function parameter exceeds the max line length,ktlint -F
shows the warningSample code
Expected Behavior
I believe the expected formatted output is
Observed Behavior
The actual formatted output is
Your Environment
Relevant parts of the
.editorconfig
settings