Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

else if constexpr block is not aligned correctly. #2652

Open
duclong201 opened this issue Feb 5, 2025 · 0 comments
Open

else if constexpr block is not aligned correctly. #2652

duclong201 opened this issue Feb 5, 2025 · 0 comments

Comments

@duclong201
Copy link

duclong201 commented Feb 5, 2025

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;
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant