From 55aece23c66e09e72747eb570a3e514bb01b5063 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 13 Dec 2021 11:12:22 +0100 Subject: [PATCH] docs: update style guidelines --- CONTRIBUTING.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d05d8e2f..489b7bc0a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,6 +62,29 @@ Try to avoid global variables, if possible declare them as `static` in the module you're using them. Changes to original game functionality most often should be configurable. +Other things: + +- We use clang-format to automatically format the code +- We do not omit `{` and `}` +- We use K&R brace style +- We condense `if` expressions into one, so: + ``` + if (a && b) { + } + ``` + + and not: + + ``` + if (a) { + if (b) { + } + } + ``` + + If the expressions are extraordinarily complex, we refactor these into + smaller conditions or functions. + ## Code formatting This project uses `clang-format` to take care of automatic code formatting. To