mutter/tools/uncrustify.cfg

156 lines
4.5 KiB
INI
Raw Normal View History

# Run `uncrustify --show-config` to see documentation for these options.
#
# See also: https://gitlab.gnome.org/GNOME/mutter/-/blob/master/HACKING.md
#################################################################################
# CHANGES
#
# The first part of this file controls what automated changes Uncrustify makes.
#################################################################################
# Files are in UTF-8
utf8_force = true
# Unix style newlines
newlines = lf
# We use spaces for alignment
indent_with_tabs = 0
# We use 2 spaces for indenting
indent_columns = 2
# We indent braces 2 spaces deep
indent_brace = 2
indent_case_brace = 2
# We align parameters in function definitions, like this:
#
# int64_t meta_string_to_date (const char *date_string,
# int *offset_p,
# GError **error)
#
align_func_params = true
# A '*' in a variable definition is considered 'dangling', rather than
# being part of the variable type. This produces the following style of
# alignment:
#
# meta_string_to_date (const gchar *date_string,
# gint *offset_p,
# GError **error)
#
align_var_def_star_style = 2 # dangling
# Keep extra spaces which uncrustify thinks are not needed for alignment.
#
# This causes uncrustify to preserve a lot more of the existing alignment
# in Mutter's source code, for example we can keep this:
#
# meta_string_to_date (const char *date_string,
# int *offset_p,
# GError **error)
#
# Instead of it being changed to this:
#
# meta_string_to_date (const char *date_string,
# int *offset_p,
# GError **error)
#
# Because this setting is enabled, the uncrustify process is not
# idempodent with regards to variable alignment because we still have some
# extra alignment in the sourcecode which uncrustify did not insert, and
# rerunning uncrustify with different settings might remove those extra spaces.
align_keep_extra_space = true
# Ensure arithmetic operators are properly spaced, e.g:
# foo = 1 + (2 / 4);
sp_arith = force
sp_arith_additive = force
# Ensure spaces between assignments, e.g.:
# foo = 2;
# foo += 2;
sp_assign = force
# Enforce spacing around = operator (and -=, etc).
sp_after_assign = force
sp_before_assign = force
# Remove spaces between '*', e.g.:
# char **foo;
sp_between_ptr_star = remove
# Remove space after pointer stars.
sp_after_ptr_star = remove
# But add space before pointer return types and function
sp_after_ptr_star_func = force
# Ensure there is space between '*' and '(', e.g.:
# typedef GNode* (* ForeachFunc) (...);
sp_ptr_star_paren = force
# & for indirections must be together with the variable
sp_after_byref = remove
# Remove spacing around ++ / -- operators.
sp_incdec = remove
# Enforce newlines between arguments at function declarations/definitions,
# enclosing ')' belongs in the last line
nl_func_decl_args = force
nl_func_def_args = force
nl_func_decl_end = remove
# Enforce the right spacing inside/around/after ( ) in typedefs and
# function calls
sp_inside_tparen = remove
sp_func_call_paren = force
sp_after_tparen_close = force
# Also enforce the correct multiline-ness of function
# definitions/declarations/calls
nl_func_decl_args = force
nl_func_def_args = force
nl_func_decl_end = remove
nl_func_call_end = remove
nl_func_call_empty = remove
# Add stars at the beginning of each line in multiline comments
cmt_star_cont = true
#################################################################################
# IGNORES
#
# The second part of this file controls what Uncrustify ignores.
#################################################################################
# Disable auto-alignment of macros, we often manually align the \ with
# spaces which uncrustify doesn't support.
align_nl_cont = false
# Ignore spacing in multiline comments.
cmt_indent_multi = false
# Ignore space after casts like `(int)foo`
sp_after_cast = ignore
# Ignore spaces after ; in for (; ; ;) statements.
sp_after_semi_for = ignore
sp_after_semi_for_empty = ignore
# Ignore Space after ! (not) operator, for example:
#
# if (!home) {
#
sp_not = ignore
# Ignore space around preprocessor '##' operator. We might want a space before
# and no space after, for example in this:
#
# #define trace(message, ...) \
# g_debug (message, ##__VA_ARGS__)
#
sp_pp_concat = ignore