[arch-dev-public] Let's agree on a common coding style
Thomas Bächler
thomas at archlinux.org
Sat Feb 13 13:57:27 EST 2010
Am 13.02.2010 16:55, schrieb Dieter Plaetinck:
>> * indent with tabs
> +1
>> * tabs have 8 characters
>
> isn't the point of indentation with tabs just that everyone can choose
> the width of the representation for himself?
> unless you plan to use tabs for alignment, which i don't like.
> tabs for indentation, spaces for alignment imho.
This affects how exactly you count the "number of columns" in the next
rule. A tab is then counted as 8 characters (although it will still show
as 2 in my editor).
>> * don't use more than 132 columns
> where does this number come from?
>> * opening braces are top right, closing are bottom left:
> +1
>>
>> function foo() {
>> echo bar
>> }
>
> only for bash/C.
> for sh, leave out the 'function' part (it's a bashism)
>
>> * if and for statements are like this:
>>
>> if true; then
>> do something
>> else
>> do something else
>> fi
>>
>> for i in a b c; do
>> echo $i
>> done
>
> fine by me
>
>> * use single quotes if a string does not parseable content
>
> +1
>
>> We could also talk about using `` or $(); source vs. .; $foo vs.
>> ${bar} etc.. But that's probably too much.
Never use `...`, always $(...), always use the braces for variable names
and always quote paths that contain variables.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-dev-public/attachments/20100213/8a4b1ef7/attachment.bin>
More information about the arch-dev-public
mailing list