Skip to content

Commit 9dd8175

Browse files
committed
Merge branch 'hv/coding-guidelines' into maint-1.7.11
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. * hv/coding-guidelines: Documentation/CodingGuidelines: spell out more shell guidelines
2 parents 74b819a + 03b05c7 commit 9dd8175

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)