Closed Bencodes closed 5 days ago
Tnx for reporting. Next time please enclose your .editorconfig
settings as well. It turns out that this problem only occurs with non-default code style android_studio
.
- Relevant parts of the
.editorconfig
settings: An empty configuration reproduces this error.
This is not correct. With an empty .editorconfig
you're using ktlint_official
code style which does not reproduces this problem. The .editorconfig
below does reproduce the problem:
root = true
[*.{kt,kts}]
ktlint_code_style = android_studio
The problem could also reproduced with the other code styles given that additional .editorconfig
properties are set. The fix is to explicitly check that the primary constructory does not contain any EOL-comment in the parameter list.
Expected Behavior
Formatting data classes with
//
comments should produce valid Kotlin code.Observed Behavior
Auto fixing produces invalid Kotlin code that does not compile.
Steps to Reproduce
Run
ktlint -f
against the following Kotlin data class:Results in:
KtLint does not fail if you replace the
// Foo
comment with/* Foo */
.Your Environment
.editorconfig
settings: An empty configuration reproduces this error.