Skip to content

else if constexpr block is not aligned correctly. #2652

@duclong201

Description

@duclong201

Description

Hi, I'm using Uncrustify 0.80.1 and the default config from https://github.com/uncrustify/uncrustify/blob/master/documentation/htdocs/default.cfg and else if constexpr block is not correctly formatted

Original

if constexpr (std::is_same_v<T, bool>) {
    values.push_back(arg ? "true" : "false");
} else if constexpr (std::is_same_v<T, string>) {
    values.push_back(string::format("\"%@\"", arg));
} else if constexpr (std::is_same_v<T, json>) {
    values.push_back(arg.dump());
} else {
    std::cout << "Unsupported type" << std::endl;
}

I'm expecting uncrustify to leave this untouched but it formats the code as follows

Formatted

if constexpr (std::is_same_v<T, bool>) {
    values.push_back(arg ? "true" : "false");
} else if constexpr (std::is_same_v<T, string>) {
	values.push_back(string::format("\"%@\"", arg));
    } else if constexpr (std::is_same_v<T, json>) {
	    values.push_back(arg.dump());
	} else {
	    std::cout << "Unsupported type" << std::endl;
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions