Commit 852d804f authored by Nghia Truong's avatar Nghia Truong
Browse files

STYLE: Improve code formatting with uncrustify

Replace many 'add' options by 'force' option for new line and space: if two ore more empty lines (or spaces) exist, modify them to make sure there is just one empty line (or space).

Add option to enforce a break line between namespace/class and brace character.

Add several more options to enforce space around operators/parenthesis/bracket etc.
parent ba159257
......@@ -49,7 +49,7 @@ use_indent_func_call_param = false # false/true
nl_end_of_file = add # ignore/add/remove/force
# The maximum consecutive newlines (3 = 2 blank lines)
nl_max = 3 # number
nl_max = 2 # number
# Whether to remove blank lines after '{'
eat_blanks_after_open_brace = true # false/true
......@@ -58,67 +58,73 @@ eat_blanks_after_open_brace = true # false/true
eat_blanks_before_close_brace = true # false/true
# Add or remove braces on single-line 'for' statement
mod_full_brace_for = add # ignore/add/remove/force
mod_full_brace_for = force # ignore/add/remove/force
# 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
mod_full_brace_if = force # ignore/add/remove/force
# Add or remove braces on single-line 'while' statement
mod_full_brace_while = add # ignore/add/remove/force
mod_full_brace_while = force # ignore/add/remove/force
# Whether to remove superfluous semicolons
mod_remove_extra_semicolon = false # false/true
# Add or remove newline between 'enum' and '{'
nl_enum_brace = add # ignore/add/remove/force
nl_enum_brace = force # ignore/add/remove/force
# Newline between namespace and {.
nl_namespace_brace = force # ignore/add/remove/force
# Add or remove newline between 'class' and '{'.
nl_class_brace = force # ignore/add/remove/force
# Add or remove newline between 'struct and '{'
nl_struct_brace = add # ignore/add/remove/force
nl_struct_brace = force # ignore/add/remove/force
# Add or remove newline between 'union' and '{'
nl_union_brace = add # ignore/add/remove/force
nl_union_brace = force # ignore/add/remove/force
# Add or remove newline between 'if' and '{'
nl_if_brace = add # ignore/add/remove/force
nl_if_brace = force # ignore/add/remove/force
# Add or remove newline between '}' and 'else'
nl_brace_else = add # ignore/add/remove/force
nl_brace_else = force # ignore/add/remove/force
# Add or remove newline between 'else' and '{'
nl_else_brace = add # ignore/add/remove/force
nl_else_brace = force # ignore/add/remove/force
# Add or remove newline between 'else' and 'if'
nl_else_if = remove # ignore/add/remove/force
# Add or remove newline between '}' and 'finally'
nl_brace_finally = add # ignore/add/remove/force
nl_brace_finally = force # ignore/add/remove/force
# Add or remove newline between 'finally' and '{'
nl_finally_brace = add # ignore/add/remove/force
nl_finally_brace = force # ignore/add/remove/force
# Add or remove newline between 'try' and '{'
nl_try_brace = add # ignore/add/remove/force
nl_try_brace = force # ignore/add/remove/force
# Add or remove newline between 'for' and '{'
nl_for_brace = add # ignore/add/remove/force
nl_for_brace = force # ignore/add/remove/force
# Add or remove newline between 'catch' and '{'
nl_catch_brace = add # ignore/add/remove/force
nl_catch_brace = force # ignore/add/remove/force
# Add or remove newline between '}' and 'catch'
nl_brace_catch = add # ignore/add/remove/force
nl_brace_catch = force # ignore/add/remove/force
# Add or remove newline between 'do' and '{'
nl_do_brace = add # ignore/add/remove/force
nl_do_brace = force # ignore/add/remove/force
# Add or remove newline between '}' and 'while' of 'do' statement
nl_brace_while = add # ignore/add/remove/force
nl_brace_while = force # ignore/add/remove/force
# Add or remove newline between 'switch' and '{'
nl_switch_brace = add # ignore/add/remove/force
nl_switch_brace = force # ignore/add/remove/force
# Add or remove newline between function signature and '{'
nl_fdef_brace = add # ignore/add/remove/force
nl_fdef_brace = force # ignore/add/remove/force
# Don't split one-line braced statements inside a class xx { } body
nl_class_leave_one_liners = true # false/true
......@@ -126,8 +132,47 @@ nl_class_leave_one_liners = true # false/true
# Don't split one-line C++11 lambdas - '[]() { return 0; }'
nl_cpp_lambda_leave_one_liners = true # false/true
# The number of newlines after '}' of a multi-line function body.
nl_after_func_body = 2 # unsigned number
# Add or remove space around compare operator '<', '>', '==', etc
sp_compare = add # ignore/add/remove/force
sp_compare = force # ignore/add/remove/force
# Add or remove space around non-assignment symbolic operators ('+', '/', '%',
# '<<', and so forth).
sp_arith = force # ignore/add/remove/force
# Add or remove space around boolean operators '&&' and '||'.
sp_bool = force # ignore/add/remove/force
# Add or remove space after ',', i.e. 'a,b' vs. 'a, b'.
sp_after_comma = force # ignore/add/remove/force
# Add or remove space inside a non-empty '[' and ']'.
sp_inside_square = remove # ignore/add/remove/force
# Add or remove space before '(' of control statements ('if', 'for', 'switch',
# 'while', etc.).
sp_before_sparen = remove # ignore/add/remove/force
# Add or remove space inside '(' and ')' of control statements.
sp_inside_sparen = remove # ignore/add/remove/force
# Add or remove space after '(' of control statements.
#
# Overrides sp_inside_sparen.
sp_inside_sparen_open = remove # ignore/add/remove/force
# Add or remove space before ')' of control statements.
#
# Overrides sp_inside_sparen.
sp_inside_sparen_close = remove # ignore/add/remove/force
# Add or remove space after ')' of control statements.
sp_after_sparen = remove # ignore/add/remove/force
# Add or remove space between ')' and '{' of of control statements.
sp_sparen_brace = force # ignore/add/remove/force
# If true, cpp lambda body will be indentedDefault=False.
indent_cpp_lambda_body = false # false/true
......@@ -152,4 +197,5 @@ cmt_indent_multi = false # false/true
# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment.
# Will substitute $(filename) with the current file's name.
cmt_insert_file_header = "../HeaderForSources.txt"
\ No newline at end of file
cmt_insert_file_header = "../HeaderForSources.txt"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment