block-comment-after-open
What it does
Section titled “What it does”Reports a block comment that follows an opening token on its line and ends the line (if (a) { /* note */). The tokens are the option after (default {). A line comment there, and a block comment with code after it on the line, are not reported.
Why it matters
Section titled “Why it matters”The style keeps a block comment from ending the line of an opening brace. A comment on a line of its own above the first statement says clearly which statement it describes.
To fix, move the comment to its own line.
Example
Section titled “Example”fun f(a: Int) { if (a > 1) { /* big */ g() } if (a > 2) { // line comment...Configuration
Section titled “Configuration”lint: rules: block-comment-after-open: level: warn # off (default), warn, error options: after: ["{"]| Option | Type | Default | Description |
|---|---|---|---|
after |
list | ["{"] |
The tokens a block comment must not follow on their line. |
Enabled by the presets: kotlin/ktlint.
Suppress one line with sudsy-disable-next-line block-comment-after-open in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ktlint | wrapping |
full |