Update formatting rules

This commit is contained in:
Scott Lahteine 2020-06-12 16:32:47 -05:00
parent 40f55f8b98
commit 0c4cf2ce32

View file

@ -28,11 +28,28 @@ indent_columns = 2
# Spaces to indent '{' from 'case'. # Spaces to indent '{' from 'case'.
# By default, the brace will appear under the 'c' in case. # By default, the brace will appear under the 'c' in case.
# Usually set to 0 or indent_columns. # Usually set to 0 or indent_columns.
indent_case_brace = 4 indent_case_brace = 0
# Spaces to indent 'case' from 'switch' # Spaces to indent 'case' from 'switch'
# Usually 0 or indent_columns. # Usually 0 or indent_columns.
indent_switch_case = 4 indent_switch_case = 2
# indent 'break' with 'case' from 'switch'.
indent_switch_break_with_case = false
# Whether to indent continued function call parameters one indent level,
# rather than aligning parameters under the open parenthesis.
indent_func_call_param = true
# Whether to indent continued function definition parameters one indent level,
# rather than aligning parameters under the open parenthesis.
indent_func_def_param = true
# Add or remove space between function name and '(' on function declaration.
sp_func_proto_paren = remove
# Add or remove space between function name and '(' on function calls.
sp_func_call_paren = remove
# Add or remove space around arithmetic operator '+', '-', '/', '*', etc # Add or remove space around arithmetic operator '+', '-', '/', '*', etc
sp_arith = force sp_arith = force
@ -65,34 +82,37 @@ sp_paren_paren = remove
sp_inside_sparen = remove sp_inside_sparen = remove
# Add or remove space between 'else' and '{' if on the same line # Add or remove space between 'else' and '{' if on the same line
sp_else_brace = force sp_else_brace = add
# Add or remove space between '}' and 'else' if on the same line # Add or remove space between '}' and 'else' if on the same line
sp_brace_else = force sp_brace_else = add
# Add or remove space inside a non-empty '[' and ']' # Add or remove space inside a non-empty '[' and ']'
sp_inside_square = remove sp_inside_square = remove
# Add or remove space before '(' of 'if', 'for', 'switch', and 'while' # Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
sp_before_sparen = force sp_before_sparen = add
# Add or remove space after ',' # Add or remove space after ','
sp_after_comma = force sp_after_comma = add
# Add or remove space before ',' # Add or remove space before ','
sp_before_comma = remove sp_before_comma = remove
# Add or remove space between ')' and '{' # Add or remove space between ')' and '{'
sp_paren_brace = force sp_paren_brace = add
# Add or remove space between ')' and '{' of function.
sp_fparen_brace = add
# Add or remove space after ')' of 'if', 'for', 'switch', and 'while' # Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
sp_after_sparen = force sp_after_sparen = add
# Add or remove space after ';', except when followed by a comment. Default=Add # Add or remove space after ';', except when followed by a comment. Default=Add
sp_after_semi = force sp_after_semi = add
# Add or remove newline between '}' and 'else' # Add or remove newline between '}' and 'else'
nl_brace_else = force nl_brace_else = add
# Add or remove newline between 'enum' and '{' # Add or remove newline between 'enum' and '{'
nl_enum_brace = remove nl_enum_brace = remove
@ -122,8 +142,13 @@ nl_end_of_file = add
# Add or remove newline between function signature and '{' # Add or remove newline between function signature and '{'
nl_fdef_brace = remove nl_fdef_brace = remove
# Whether to collapse a function definition whose body (not counting braces)
# is only one line so that the entire definition (prototype, braces, body) is
# a single line.
nl_create_func_def_one_liner = true
# Whether to remove blank lines after '{' # Whether to remove blank lines after '{'
eat_blanks_after_open_brace = true eat_blanks_after_open_brace = false
# Whether to remove blank lines before '}' # Whether to remove blank lines before '}'
eat_blanks_before_close_brace = false eat_blanks_before_close_brace = false
@ -151,11 +176,6 @@ mod_full_brace_while = false
# Whether to remove superfluous semicolons # Whether to remove superfluous semicolons
mod_remove_extra_semicolon = true mod_remove_extra_semicolon = true
# If an #ifdef or #else body exceeds the specified number of newlines and
# doesn't have a comment after the #else, a comment will be added.
mod_add_long_ifdef_else_comment = 40
# Whether to put a newline after a brace close. # Whether to put a newline after a brace close.
# Does not apply if followed by a necessary ';'. # Does not apply if followed by a necessary ';'.
nl_after_brace_close = true nl_after_brace_close = true
@ -164,6 +184,12 @@ nl_after_brace_close = true
# Default is true. # Default is true.
cmt_indent_multi = false cmt_indent_multi = false
#
# Indent all code and preprocessor directives together
# to remove all ambiguity and permit code folding.
# TODO: Reduce indent at the "whole file" level.
#
# Add or remove indentation of preprocessor directives inside #if blocks # Add or remove indentation of preprocessor directives inside #if blocks
# at brace level 0 (file-level). # at brace level 0 (file-level).
pp_indent = add pp_indent = add
@ -172,6 +198,10 @@ pp_indent = add
# indented from column 1. # indented from column 1.
pp_indent_at_level = true pp_indent_at_level = true
# Whether to indent '#define' at the brace level. If false, these are
# indented from column 1.
pp_define_at_level = true
# If pp_indent_at_level=true, sets the indent for #if, #else and #endif when # If pp_indent_at_level=true, sets the indent for #if, #else and #endif when
# not at file-level. Negative values decrease indent down to the first column. # not at file-level. Negative values decrease indent down to the first column.
# #
@ -197,14 +227,35 @@ pp_if_indent_code = true
# Default: 1 # Default: 1
pp_indent_count = 2 pp_indent_count = 2
# Whether to indent '#define' at the brace level. If false, these are
# indented from column 1.
pp_define_at_level = true
# Whether to ignore the '#define' body while formatting. # Whether to ignore the '#define' body while formatting.
pp_ignore_define_body = true pp_ignore_define_body = true
# Whether to indent extern C blocks between #if, #else, and #endif.
# Only applies to the indent of the preprocesser that the extern block is
# directly inside of.
#
# Default: true
pp_indent_extern = false
# Whether to indent braces directly inside #if, #else, and #endif.
# Only applies to the indent of the preprocesser that the braces are directly
# inside of.
#
# Default: true
pp_indent_brace = false
# If an #ifdef body exceeds the specified number of newlines and doesn't have
# a comment after the #endif, a comment will be added.
mod_add_long_ifdef_endif_comment = 40
# If an #ifdef or #else body exceeds the specified number of newlines and
# doesn't have a comment after the #else, a comment will be added.
mod_add_long_ifdef_else_comment = 40
# Whether to remove blanks after '#ifxx' and '#elxx', or before '#elxx' and
# '#endif'. Does not affect top-level #ifdefs.
nl_squeeze_ifdef = true
# #
# Newline adding and removing options # Newline adding and removing options
# #