Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 03b05c7

Browse files
hvoigtgitster
authored andcommitted
Documentation/CodingGuidelines: spell out more shell guidelines
In earlier days, "imitate the style in the neibouring code" was sufficient to keep the coherent style, but over time some parts of the codebase have drifted enough to make it ineffective. Spell some of the guidelines out. Signed-off-by: Heiko Voigt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b0fa280 commit 03b05c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Documentation/CodingGuidelines

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,19 @@ For shell scripts specifically (not exhaustive):
7676

7777
- We do not use Process Substitution <(list) or >(list).
7878

79+
- Do not write control structures on a single line with semicolon.
80+
"then" should be on the next line for if statements, and "do"
81+
should be on the next line for "while" and "for".
82+
7983
- We prefer "test" over "[ ... ]".
8084

8185
- We do not write the noiseword "function" in front of shell
8286
functions.
8387

88+
- We prefer a space between the function name and the parentheses. The
89+
opening "{" should also be on the same line.
90+
E.g.: my_function () {
91+
8492
- As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
8593
[::], [==], nor [..]) for portability.
8694

0 commit comments

Comments
 (0)