From f5db3cb165c2b77b4cfa2a339433823258d53011 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Fri, 19 Feb 2016 19:06:26 +0100 Subject: [PATCH] Update code style guidelines --- documentation/CONTRIBUTING-CODE.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/documentation/CONTRIBUTING-CODE.md b/documentation/CONTRIBUTING-CODE.md index 4ab6bd3..3bb784b 100644 --- a/documentation/CONTRIBUTING-CODE.md +++ b/documentation/CONTRIBUTING-CODE.md @@ -36,6 +36,7 @@ Create a new topic branch, based on either master or develop. Code! Try to follow these simple rules: - Always use parentheses when calling functions. +- Always use braces for object literals. - Always use explicit `return`s, unless the function is a one-liner. - Always use single quotes, unless you use interpolation. - Prefer interpolation over concatenation, both for strings and regexes. @@ -44,7 +45,11 @@ Code! Try to follow these simple rules: - `==` and `!=` - `and` and `or` - `not` +- Never use `++` and `--`. - Never put spaces directly inside `[]` and `{}`. +- Never put spaces before or more than one space after `:` in object literals. +- Never use `when ... then` in `switch`es; replace `then` with a newline. +- Avoid vertical alignment of code (such as aligning `=`s). - Comment when necessary. Comments should be full sentences. - Keep lines at most 80 characters long. - Indent using two spaces. -- 2.39.3