Skip to content

SameLine: Add a separate policies for non-block body of "if" with an "else" #697

Description

@EliteMasterEric

Currently, you can configure the ifBody to be on the same line, but you can't make the value depend on whether there is a corresponding else for that if statement. I want to have the if body on the same line if there is no else block and on a different line if there is an else block (so I can then mandate that curly braces be

Examples

// This is fine.
if (foo) bar();

// I don't like this.
if (foo) bar();
else baz();

// hxformat + checkstyle currently does this (disgusting!)
if (foo) bar();
else
{
    baz();
}

// I want this while still allowing case 1.
if (foo)
{
    bar();
}
else
{
    baz();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsamelinebroken same line formatting

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions