diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1026fb78c..061ff9e23 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -143,8 +143,17 @@ Try to stay inline with the code that surrounds you, having an entire package or * Packages must be all lowercase, consecutive words should generally be avoided. (e.g. `io.github.thebusybiscuit.slimefun4.core.something`) #### 7. Style preferences * Use **Spaces**, not Tabs! -* Try to keep ternary operators to a minimum, only in return statements (e.g. avoid doing this: `int y = x == null ? 1: 2`) -* if/else statements should always include a bracket, please avoid one-line statements (e.g. Avoid doing: `if (x == 0) return;`) +* Try to keep ternary operators to a minimum, only in return statements. (e.g. avoid doing this: `int y = x == null ? 1: 2`) +* Try to keep so-called "guard blocks" to a minimum. One guard block is fine but having multiple guard blocks before getting to the actual code... Well, you might wanna refactor your code there. Example: +```java +// guard block +if (something) { + return; +} + +// Actual code... +``` +* if/else statements should always include a bracket, please avoid one-line statements. (e.g. Avoid doing: `if (x == 0) return;`) * We do not enforce any particular width or column limit, but try to prevent your lines from becoming too long. * Annotations for methods or fields should never go on the same line, place them on the line above. * Comments should never go on the same line as code! Always above or below. @@ -156,7 +165,7 @@ Try to stay inline with the code that surrounds you, having an entire package or * In variable assignments: `int x = 123;` * In a for-loop: `for (int i = 0; i < 10; i++) {` * Before and after statement parenthesis: `if (x != null) {` - * Inbetween array initializers: `int[] array = { 1, 2, 3 }; + * Inbetween array initializers: `int[] array = { 1, 2, 3 };` * After the double slash of a comment: `// This is a comment` * Slimefun follows the **1TBS / OTBS** Bracket-Style standard (One true brace style): ```java