summaryrefslogtreecommitdiff
path: root/utils/uncrustify.cfg
blob: 86d9a03f5cd073b04f308f0ab7ec5a6c0c17ca0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Configuration for formatting Tracker source code using the
# 'uncrustify' indent tool.
#
# Run `uncrustify --show-config` to see documentation for these options.
#
# See also: https://wiki.gnome.org/Projects/Tracker/Documentation/CodingStyle

#################################################################################
# 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 tabs to indent up to brace level, but spaces to align continuation
# lines. For example:
#
#     int main() {
#     --->printf ("This is a long string "
#     --->        "which continues onto a second line.");
#     };
#
align_with_tabs = false
indent_with_tabs = 1

# We align parameters in function definitions, like this:
#
#     gdouble tracker_string_to_date (const gchar  *date_string,
#                                     gint         *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:
#
#    tracker_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 Tracker's source code, for example we can keep this:
#
#    tracker_string_to_date (const gchar  *date_string,
#                            gint         *offset_p,
#                            GError      **error)
#
# Instead of it being changed to this:
#
#    tracker_string_to_date (const gchar *date_string,
#                            gint        *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

# Ensure there is space between '*' and '(', e.g.:
# typedef GNode* (* ForeachFunc) (...);
sp_ptr_star_paren = remove

# Remove spaces between '*', e.g.:
# gchar **foo;
sp_between_ptr_star = remove

#################################################################################
# IGNORES
#
# The second part of this file controls what Uncrustify ignores.
#################################################################################

# Disable auto-alignment of macros, we manually align the \ with
# spaces which uncrustify doesn't support.
align_nl_cont = false

# Ignore spacing multiline comments.
cmt_indent_multi = false

# Ignore spacing around = operator (and -=, etc).
sp_after_assign = ignore
sp_before_assign = ignore

# Ignore space after casts like `(int)foo`
sp_after_cast = ignore

# Ignore spacing around pointer stars.
sp_after_ptr_star = ignore

# Ignore spaces after ; in for (; ; ;) statements.
sp_after_semi_for = ignore
sp_after_semi_for_empty = ignore

# Ignore spacing around ++ / -- operators.
sp_incdec = 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