Skip to content

New rule proposal: Curly braces must not be omitted when parent expression spans multiple lines #1488

Open
@alxru

Description

@alxru

Category: Layout
Rule: Curly braces must not be omitted when parent expression spans multiple lines.
Rationale: Improve readability and maintainability of the code (when SA1503 is off).
See also: SA1503:CurlyBracketsMustNotBeOmitted and SA1519:CurlyBracketsMustNotBeOmittedFromMultiLineChildStatement

Bad:

if (alpha == beta &&
    beta == gamma)
    alpha = delta;

Good:

if (alpha == beta &&
    beta == gamma)
{
    alpha = delta;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions