[arch-dev-public] Let's agree on a common coding style

Pierre Schmitz pierre at archlinux.de
Sat Feb 13 11:33:26 EST 2010


Am Samstag, 13. Februar 2010 16:55:57 schrieb Dieter Plaetinck:
> > * 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.

If everybody could use his own interpretation of how width tabs are shown the 
maximum column restriction gets pointless.

> > * don't use more than 132 columns
> 
> where does this number come from?

historical like the 80 columns from the vt100 and such terminals

> only for bash/C.
> for sh, leave out the 'function' part (it's a bashism)

of course I meant without the function part; no idea why I wrote it there.


> > We could also talk about using `` or $(); source vs. .; $foo vs.
> > ${bar} etc.. But that's probably too much.
> 
> source is a bashism. '.' is sh, but source is easier to grep for, so i
> suggest to use 'source' when the script is bash and you're pretty sure
> it will stay bash. '.' otherwise.

good point

> ${bar} should only be used when it's needed.

I have setup a wiki page: 
http://wiki.archlinux.org/index.php/DeveloperWiki:Bash_Coding_Style

And yes, this should just for bash and should appy to all our scripts 
including init scripts etc.. For PKGBUILD we might want to add some more 
specific extensions to this (I suggest a separate page for these)

-- 

Pierre Schmitz, https://users.archlinux.de/~pierre


More information about the arch-dev-public mailing list