You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _doc/manual/conventions.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,9 @@ In general, the contents of a class are sorted in the following order:
34
34
35
35
Do not sort the function declarations alphabetically, and do not separate regular functions from extension methods. Instead, put related stuff together, so that someone reading the class from top to bottom would be able to follow the logic of what's happening. Choose an order (either higher-level stuff first, or vice versa) and stick to it. The API of a package should be at the top, immediately visible once opening it, including a hot doc description.
36
36
37
-
Put nested classes next to the code that uses those classes. If the classes are intended to be used externally and aren't referenced inside the class, put them in the end, after the companion object.
37
+
Put nested classes next to the code that uses those classes. If the classes are intended to be used externally and aren't referenced inside the class, put them in the end.
38
38
39
-
#### Interface implementation
39
+
#### Interface implementation
40
40
41
41
When implementing an interface, keep the implementing members in the same order as members of the interface (if necessary, interspersed with additional private methods used for the implementation)
42
42
@@ -80,7 +80,7 @@ Put spaces around binary operators (`a + b`).
80
80
81
81
Do not put spaces around unary operators (`a++`)
82
82
83
-
Put spaces between control flow keywords (`if`, `switch`, `for` and `while`) and the corresponding opening parenthesis.
83
+
Put single spaces between control flow keywords (`if`, `switch`, `for` and `while`) and the following expression. Do not use parenthesis unless it improves the readability of big bool terms.
84
84
85
85
Do not put a space before an opening parenthesis in a method declaration or method call.
86
86
@@ -106,11 +106,11 @@ As a general rule, avoid horizontal alignment of any kind. Renaming an identifie
106
106
In lambda expressions, spaces should be used around the `begin` and `end` keywords, as well as around the arrow which separates the parameters from the body. If a call takes a single lambda, it should be passed outside of parentheses whenever possible. Prefer putting lambda parameters as the last argument, so it can be written without `begin` and `end`.
107
107
108
108
```wurst
109
-
list.filter(t -> t > 10)
109
+
list.filter(t -> t > 10)
110
110
111
-
execute() ->
112
-
hash = hash()
113
-
```
111
+
execute() ->
112
+
hash = hash()
113
+
```
114
114
115
115
### Documentation comments (hot doc)
116
116
@@ -149,4 +149,4 @@ When making a choice between a complex expression using multiple higher-order fu
149
149
Prefer test driven development if the feature is not too dependent on wc3 game mechanics. Create small, self-contained functions, annotate them with `@Test` individually and give them a descriptive name.
150
150
Make sure to have at least one **assertion** inside your test to verify the behavior.
151
151
152
-
Tests should either be placed at the end of a package, or into a separate package suffixed `Tests` which will be ignored for autocomplete suggestions. Code and Tests should not be mixed.
152
+
Tests should either be placed at the end of a package, or into a separate package suffixed `Tests` which will be ignored for autocomplete suggestions. Code and Tests should not be mixed.
0 commit comments