summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-06-17 00:16:22 +0200
committerCarlos Garnacho <carlosg@gnome.org>2021-06-17 00:58:01 +0200
commit40a49da8856dd0325a5407829d064247bf9b40e0 (patch)
tree3a6141b5c674fbb2e28e9aa6443432fadc369e2b
parent960a13df52074c681a7c4d74d03565fdad0828e0 (diff)
downloadtracker-40a49da8856dd0325a5407829d064247bf9b40e0.tar.gz
utils: Improve uncrustify configuration a bit further
- Remove the bits for alignment of variable definition and struct members. This was unreliable, and is likely the most unhonored code style rule. - Ensure utf8 and linux style newlines - Enforce some bits of spacing, around arithmetic operators, assigments, etc. There's still some issues left (e.g. inline struct definitions for GOptionEntry), but let's consider these minor.
-rw-r--r--utils/uncrustify.cfg33
1 files changed, 21 insertions, 12 deletions
diff --git a/utils/uncrustify.cfg b/utils/uncrustify.cfg
index deddbc6b4..86d9a03f5 100644
--- a/utils/uncrustify.cfg
+++ b/utils/uncrustify.cfg
@@ -11,6 +11,12 @@
# 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:
#
@@ -61,20 +67,23 @@ align_var_def_star_style = 2 # dangling
# rerunning uncrustify with different settings might remove those extra spaces.
align_keep_extra_space = true
-# Align variable definitions in function bodies, at the toplevel, and inside
-# structs.
-#
-# The 'thresh' (threshold) values define the maximum number of extra spaces
-# uncrustify will insert. So align will be done with a maximum of 1 extra
-# space, otherwise the variable will not be aligned with its neighbour.
-align_var_def_thresh = 1
-align_var_struct_thresh = 1
+# 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
-# The 'span' values define how many lines uncrustify will 'jump' in order to
-# consider two variable definitions as neighbours.
-align_var_def_span = 1
-align_var_struct_span = 4
+# 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