Skip to content

Rule: Mandatory braces for single-line for loop bodies #2652

Closed
@daphil19

Description

@daphil19

I'd like to have the option to enforce braces around for loops with a single statement for the body. This is similar to #365, which added this for if statements.

Non-compliant example:

for (i in 0..10)
    println(i)

Compliant example:

for (i in 0..10) {
    println(i)
}

Compliant example 2:

for (i in 0..10) println(i)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions