Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KDoc followed by block comment in value parameter list #2292

Closed
paul-dingemans opened this issue Oct 3, 2023 · 1 comment · Fixed by #2293
Closed

KDoc followed by block comment in value parameter list #2292

paul-dingemans opened this issue Oct 3, 2023 · 1 comment · Fixed by #2293
Milestone

Comments

@paul-dingemans
Copy link
Collaborator

Based upon https://kotlinlang.slack.com/archives/CKS3XG0LS/p1696265393123499

Given code below:

class Test(
    /** The width. */
    val width: Int,
    /** The height */
    /* XXX We should be able to figure out the height automatically. */
    val height: Int
)

with code style intellij_idea results in lint violation:

A comment in a 'value_parameter' is only allowed when placed on a new line before this element (standard:discouraged-comment-location)
@paul-dingemans paul-dingemans added this to the 1.0.1 milestone Oct 3, 2023
@paul-dingemans
Copy link
Collaborator Author

The validation message is not correct in this situation. The new message will be 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. Still this message is not really clear in this 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.

paul-dingemans added a commit that referenced this issue Oct 6, 2023
* Improve violation message in `discouraged-comment-location`

Closes #2292

* Fix lint violation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant