I was wondering if there is any way to add braces in nested If-else using Uncrustify. For example:
if( stat_error == -1 ){
if ( debug > 0 )
printf( "...ERROR ); //I would like to add braces around here.
exit( -1 );
} else {
I have seen this:
# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
mod_full_brace_if = add # ignore/add/remove/force
But it doesn't seem to work for nested conditionals.
Is there any way to do it?
My experience with Uncrustify in your example :
Add or remove braces on single - line
if
statement. Will not remove the braces if they contain anelse
.
mod_full_brace_if = add
Make all
if
/elseif
/else
statements in a chain be braced or not. Overridesmod_full_brace_if
.If any must be braced, they are all braced. If all can be unbraced, then the braces are removed.
mod_full_brace_if_chain = false
And it worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With