[tracker/wip/carlosg/code-style-checks: 2/4] utils: Improve uncrustify configuration a bit further
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/code-style-checks: 2/4] utils: Improve uncrustify configuration a bit further
- Date: Wed, 16 Jun 2021 23:01:30 +0000 (UTC)
commit 40a49da8856dd0325a5407829d064247bf9b40e0
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jun 17 00:16:22 2021 +0200
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.
utils/uncrustify.cfg | 33 +++++++++++++++++++++------------
1 file 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]