Skip to content

no-single-line-block-comment

all languagesstylefix: safedefault: offkotlin/ktlint

Reports a block comment that fits on one line and ends its line (/* text */): it is written as a line comment. Documentation comments (/**), empty comments, comments with code after them on the same line and languages without a line comment marker are not reported. The fix turns it into a line comment.

A line comment is the plain form for a short note. A block comment on one line is usually left over from a longer comment, and the next edit adds a second line inside it.

To fix, use // text; the fix does it.

Reported
...
}
/* one line */
val a = 1
After the fix
...
}
// one line
val a = 1
lint:
rules:
no-single-line-block-comment: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line no-single-line-block-comment in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ktlint no-single-line-block-comment full