A ; ends a statement that a line break ends anyway

tx0/kotlin:redundant-semicolonstrictwarningstyle/formattingdepth faststyle

What it finds

In Kotlin, a line break ends a statement, so ; at the end of a line is noise. Semicolons that separate statements on one line, and the one after the entries of an enum class with members, are needed and left alone.

From the rule's source, redundant_semicolon.rs.

Example from the rule's tests
fun count(): Int {    val a = 1;tx0 reports: the ; is not needed    val b = 2; val c = 3    return a + b + c} // the `;` is the empty body of the loop: without it, the next statement would be the bodyfun spin(f: () -> Boolean) {    while (f());    for (i in 0..3);    if (f()) println("x");tx0 reports: the ; is not needed    println("done")} enum class Color {    RED, GREEN;     fun dark() = this == RED}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/kotlin:redundant-semicolon" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/kotlin:redundant-semicolon] reason="..."

tx0 explain tx0/kotlin:redundant-semicolon shows the same in the terminal. Found a false positive? Report it.