| OLD | NEW |
| 1 Sky Style Guide | 1 Sky Style Guide |
| 2 =============== | 2 =============== |
| 3 | 3 |
| 4 In general, follow our [Design Principles](design.md) for all code. | 4 In general, follow our [Design Principles](design.md) for all code. |
| 5 | 5 |
| 6 The primary goal of this style guide is to improve code readability so | 6 The primary goal of this style guide is to improve code readability so |
| 7 that everyone, whether reading the code for the first time or | 7 that everyone, whether reading the code for the first time or |
| 8 maintaining it for years, can quickly determine what the code does. A | 8 maintaining it for years, can quickly determine what the code does. A |
| 9 secondary goal is avoiding arguments when there are disagreements. | 9 secondary goal is avoiding arguments when there are disagreements. |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 When breaking a parameter list into multiple lines, do the same. | 81 When breaking a parameter list into multiple lines, do the same. |
| 82 | 82 |
| 83 Use // and ///, not /* */ and /** */. | 83 Use // and ///, not /* */ and /** */. |
| 84 | 84 |
| 85 Don't put the statement part of an "if" statement on the same line as | 85 Don't put the statement part of an "if" statement on the same line as |
| 86 the expression, even if it is short. (Doing so makes it unobvious that | 86 the expression, even if it is short. (Doing so makes it unobvious that |
| 87 there is relevant code there. This is especially important for early | 87 there is relevant code there. This is especially important for early |
| 88 returns.) | 88 returns.) |
| 89 | 89 |
| 90 If a flow control structure has just one statement, then don't use | 90 If a flow control structure's statement is one line long, then don't |
| 91 braces around it except where doing so would help readability or avoid | 91 use braces around it. (Keeping the code free of boilerplate or |
| 92 the dangling-else problem. Keeping the code free of boilerplate or | 92 redundant punctuation keeps it concise and readable.) |
| 93 redundant punctuation keeps it concise and readable. | |
| 94 | 93 |
| 95 > For example, | 94 > For example, |
| 96 > ```dart | 95 > ```dart |
| 97 > if (children != null) | 96 > if (children != null) { |
| 98 > for (RenderBox child in children) | 97 > for (RenderBox child in children) |
| 99 > add(child); | 98 > add(child); |
| 99 > } |
| 100 > ``` | 100 > ``` |
| 101 > ...rather than: | 101 > ...rather than: |
| 102 > ```dart | 102 > ```dart |
| 103 > if (children != null) { | 103 > if (children != null) { |
| 104 > for (RenderBox child in children) { | 104 > for (RenderBox child in children) { |
| 105 > add(child); | 105 > add(child); |
| 106 > } | 106 > } |
| 107 > } | 107 > } |
| 108 > ``` | 108 > ``` |
| 109 | 109 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 127 | 127 |
| 128 C++ | 128 C++ |
| 129 --- | 129 --- |
| 130 | 130 |
| 131 Put spaces around operators in expressions. | 131 Put spaces around operators in expressions. |
| 132 | 132 |
| 133 | 133 |
| 134 Java | 134 Java |
| 135 ---- | 135 ---- |
| 136 | 136 |
| OLD | NEW |