summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Griffis <pgriffis@igalia.com>2020-03-26 21:36:47 -0700
committerPatrick Griffis <pgriffis@igalia.com>2020-09-19 15:41:24 -0700
commitb25195aebded53ee2b2f3e4e4d9baf18e4cbf529 (patch)
tree1ae2e6e501063f0fb563ad8f838f95cf7253d754
parentfa4594924f341a339c99134110096d077a019b6f (diff)
downloadlibsoup-b25195aebded53ee2b2f3e4e4d9baf18e4cbf529.tar.gz
Update coding style and add clang-format config
-rw-r--r--.clang-format8
-rw-r--r--HACKING50
2 files changed, 28 insertions, 30 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..bfa115fd
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,8 @@
+---
+BasedOnStyle: WebKit
+IndentWidth: 8
+BreakBeforeBraces: WebKit
+AlignAfterOpenBracket: Align
+SpaceBeforeParens: Always
+PointerAlignment: Right
+---
diff --git a/HACKING b/HACKING
index 51269e51..4e50d7c6 100644
--- a/HACKING
+++ b/HACKING
@@ -4,14 +4,14 @@ CODE STYLE
Please use the style used by the rest of the code. Among other things,
this means:
- * Tabs, not spaces, for indentation
+ * 8 spaces for indentation. Note that tabs are still found in the codebase.
* Put spaces:
* around binary operators
- * between if/while/for/switch and "("
- * between function name and "("
+ * between if/while/for/switch and "("
+ * between function name and "("
* between ")" and "{"
- * after ","
+ * after ","
* if/for/while bodies:
@@ -22,45 +22,35 @@ this means:
the body is only a single statement and the braces are not
syntactically necessary.
- * Eg:
+ * Eg:
- for (i = 0; i < len; i++) {
- if (find (i, something))
- break;
- else {
- function_with_big_name (i, something,
- something_else);
- }
- }
-
- * C89, not C99. (In particular, don't declare variables in the
- middle of blocks.)
+ for (i = 0; i < len; i++) {
+ if (find (i, something))
+ break;
+ else {
+ function_with_big_name (i, something,
+ something_else);
+ }
+ }
* Do not use gint, gchar, glong, and gshort. (Other g-types, such
as gpointer and the unsigned types are fine.)
+ * There is a clang-format config file that can be used on new code.
+ Avoid reformatting entire files.
+
CORRECTNESS
-----------
* libsoup builds with lots of -W options by default, and should
- not print any warnings while compiling (unless they're caused by
- #included files from other projects, eg, proxy.h). You can use
- "make > /dev/null" to do a full compile showing only the
- warnings/errors, to make sure your patch does not introduce any
- more.
+ not print any warnings while compiling.
* There are a number of regression tests in the tests/ directory.
- Running "make check" will run all of them (or at least, all of
+ Running "ninja test" will run all of them (or at least, all of
the ones that it can run based on what software you have
installed. Eg, some tests require apache to be installed.) You
- should run "make check" before submitting a patch that could
- potentially change libsoup's behavior. ("make check" will warn
- you if it was not able to run all of the tests. If you are
+ should run "ninja test" before submitting a patch that could
+ potentially change libsoup's behavior. If you are
making extensive changes, or changing very low-level functions,
you may want to install all of the optional pieces so you can
run all of the regression tests.)
-
- * libsoup ought to build correctly from outside its source tree,
- so if you make large changes to the Makefiles, try a "make
- distcheck" to verify that an out-of-source-tree build still
- works.