aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2022-03-02 15:34:51 +0100
committerIsaac Freund <mail@isaacfreund.com>2022-03-02 15:34:51 +0100
commit238c39379d461a97619241e0daf0a437eb60bbc3 (patch)
tree4280ad227739d4123d14912a9d88d7becf989392
parent7b4c9c39eec2d7fc534541a31fa72a9e3e7a6b7a (diff)
downloadriver-238c39379d461a97619241e0daf0a437eb60bbc3.tar.gz
river-238c39379d461a97619241e0daf0a437eb60bbc3.tar.xz
doc: Add additional style rule to CONTRIBUTING.md
-rw-r--r--CONTRIBUTING.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b296807..acf6f08 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -41,6 +41,25 @@ strict limit. Note that inserting a trailing comma after the last parameter in
function calls, struct declarations, etc. will cause `zig fmt` to wrap those
lines. I highly recommend configuring your editor to run `zig fmt` on write.
+The single additional style rule is to avoid writing `if` statements and
+similar across multiple lines without braces:
+
+```zig
+test {
+ // avoid this
+ if (foo)
+ bar();
+
+ // prefer this
+ if (foo) bar();
+
+ // or this
+ if (foo) {
+ bar();
+ }
+}
+```
+
On a higher level, prioritize simplicity of code over nearly everything else.
Performance is only a valid reason for code complexity if there are profiling
results to back it up which demonstrate a significant benefit.