Re: [PATCH 4/8] CodingGuidelines: give an example for control statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller <stefanbeller@xxxxxxxxx> writes:

> On 30.04.2014 23:45, Junio C Hamano wrote:
>> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
>> ---
>>  Documentation/CodingGuidelines | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>> 
>> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
>> index 1e0c4cf..d72e912 100644
>> --- a/Documentation/CodingGuidelines
>> +++ b/Documentation/CodingGuidelines
>> @@ -97,6 +97,17 @@ For shell scripts specifically (not exhaustive):
>>     "then" should be on the next line for if statements, and "do"
>>     should be on the next line for "while" and "for".
>>  
>> +	(incorrect)
>
> At the other patches you used #comments behind oneliners,
> not sure if that's also suitable here for consistency of the documentation.

I think you meant this one (are there others?):

+	cat hello > world < universe	# incorrect
+	cat hello >world <universe	# correct
+
+	echo hello >$world		# incorrect
+	echo hello >"$world"		# correct
+

I can certainly go with this instead over there:

	(incorrect)
	cat hello > world < universe
	echo hello >$world

	(correct)
	cat hello >world <universe
	echo hello >"$world"

I do not think it is wise to use the trailing comment style on all
the incorrect/correct lines for these examples.

>> +	if test -f hello; then
>> +		do this
>> +	fi
>> +
>> +	(correct)
>> +	if test -f hello
>> +	then
>> +		do this
>> +	fi
>> +
>>   - We prefer "test" over "[ ... ]".
>>  
>>   - We do not write the noiseword "function" in front of shell
>> 

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]