Jonathan Lennox10/02/2023, 4:49 PM
Whatever I try the XXX comment triggers
class Test( /** The width. */ val width: Int, /** The height */ /* XXX We should be able to figure out the height automatically. */ val height: Int )
. Any suggestions?
Paul Dingemans10/02/2023, 4:54 PM
Jonathan Lennox10/02/2023, 5:13 PM
but I don't understand what it wants - I've tried putting blank lines in various places
A comment in a 'value_parameter' is only allowed when placed on a new line before this element (standard:discouraged-comment-location)
isn't able to autocorrect this.
Paul Dingemans10/02/2023, 7:33 PM
Jonathan Lennox10/02/2023, 7:43 PM
Paul Dingemans10/02/2023, 8:53 PM
I would say that those should be descriptive enough. So, I will take no further actions on this.
src/main/kotlin/Foo.kt:5:5: A comment in a 'value_parameter' is only allowed when placed on a new line before this element (standard:discouraged-comment-location) src/main/kotlin/Foo.kt:5:5: a block comment may not be preceded by a KDoc. Reversed order is allowed though when separated by a newline. (standard:no-consecutive-comments) src/main/kotlin/Foo.kt:5:5: Replace the block comment with an EOL comment (standard:no-single-line-block-comment) s
Jonathan Lennox10/02/2023, 8:53 PM
-- maybe the other warnings only show up in ktlint style?
ktlint_code_style = intellij_idea
Paul Dingemans10/03/2023, 7:09 PM
as you did not mention anything about it. I just had another look on it. The validation message is not correct in your situation. The new message will be
Still this message is not really clear in your specific example but it is the best I can come up now. There is really something weird going on in the kotlin compiler. It actually makes a difference whether the block comment is placed before or after the KDoc. When it is placed before the KDoc, it is contrary to the KDoc not a part of the value parameter. When placed after the KDoc, both the KDoc and block comment are part of the value parameter. The latter situation is difficult to handle in certain rules. Because it is really unusual to do so, this situation is just blocked by the rule so that other rules do not have to take this into account. So, in your code you can switch the order of the block comment and kdoc. It is a bit unstatisfying, but not really worth the effort to fix.
A (block or EOL) comment inside or on same line after a 'value_parameter' is not allowed. It may be placed on a separate line above.