CodingGuidelines: give an example for shell function preamble
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Apr 30, 2014 at 14:25 UTC
6117a3d4946e35c7d4a38c0b443891c81808a838
1 file changed
+11
-3
Documentation/CodingGuidelines
+11
-3
@@ -123,9 +123,17 @@ For shell scripts specifically (not exhaustive):
123
- We do not write the noiseword "function" in front of shell
124
functions.
125
126
- - We prefer a space between the function name and the parentheses. The
127
- opening "{" should also be on the same line.
128
- E.g.: my_function () {
126
+ - We prefer a space between the function name and the parentheses,
127
+ and no space inside the parentheses. The opening "{" should also
128
+ be on the same line.
129
+
130
+ (incorrect)
131
+ my_function(){
132
+ ...
133
+
134
+ (correct)
135
+ my_function () {
136
+ ...
137
138
- As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
139
[::], [==], or [..]) for portability.