[gnome-control-center] docs: Document more of the code style



commit baf161085f20b6c7b1332a5c4b0c9c5d174bc1bc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jun 19 14:44:57 2018 +0000

    docs: Document more of the code style

 docs/HACKING.md | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
---
diff --git a/docs/HACKING.md b/docs/HACKING.md
index 880c3fcd5..8983e962a 100644
--- a/docs/HACKING.md
+++ b/docs/HACKING.md
@@ -7,6 +7,12 @@ rules. Please read them carefully and, if in doubt, ask a maintainer for directi
 
 The most important rule is: **see the surrounding code, and copy its style**.
 
+That said, GNOME Settings assumes:
+
+ * 2 spaces of indentation
+ * 120 columns of line width
+ * Newline before `{`
+
 Another rule that applies to function declarations is that all parameters are
 aligned by the last '*'. There are plenty of examples below.
 
@@ -23,6 +29,36 @@ Comment blocks should be formatted as following:
  */
 ```
 
+## Conditionals
+
+Conditionals should either be all in one line, or one per line. Newlines inside
+conditionals are aligned by the last parenthesis.
+
+
+Some examples below:
+
+```c
+// Single line if
+if (a || b || (c && d))
+  return;
+
+// Multiline if with nested parenthesis
+if (long_boolean_variable_used_in_this_condition_a || 
+    long_boolean_variable_used_in_this_condition_b ||
+    (long_boolean_variable_used_in_this_condition_c &&
+     long_boolean_variable_used_in_this_condition_d))
+  {
+    return;
+  }
+
+// Another single line example with do {} while (...)
+do
+  {
+    /* something */
+  }
+while (a || b || (c && d));
+```
+
 ## Structs and Enums
 
 Structures and enums are formatted as following:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]