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

Dieter Plaetinck dieter at plaetinck.be
Sat Feb 13 17:05:11 EST 2010


On Sat, 13 Feb 2010 22:44:59 +0100
Thomas Bächler <thomas at archlinux.org> wrote:

> Am 13.02.2010 22:13, schrieb Dieter Plaetinck:
> >> If you use braces only when necessary, it will not be consistent -
> >> you have braces sometimes and other times you don't. I thought
> >> coding style was about consistency.
> >>
> > 
> > you can apply "only when needed" consistently.
> 
> This is very unintuitive. "only when needed" can even depend on the
> context, I am strictly against it.
> 

what do you mean context? it only depends on whether the first
character after the variablename is a valid character in a variablename
or not.  if it's valid, use braces. if it isn't, no need for braces.


On Sat, 13 Feb 2010 22:48:54 +0100
Jan de Groot <jan at jgc.homeip.net> wrote:

> On Sat, 2010-02-13 at 16:55 +0100, Dieter Plaetinck wrote:
> > 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.
> > ${bar} should only be used when it's needed. 
> 
> source is bashism and shouldn't be used if there's a plain posix-style
> alternative. Also, why would you grep for "source" in a PKGBUILD if it
> will just return all PKGBUILDs because they contain source= lines.

we were not talking about only PKGBUILDS, but about all bash code.


More information about the arch-dev-public mailing list