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

Aaron Griffin aaronmgriffin at gmail.com
Mon Feb 15 10:37:31 EST 2010


On Sat, Feb 13, 2010 at 5:29 PM, Allan McRae <allan at archlinux.org> wrote:
>> We could also talk about using `` or $(); source vs. .; $foo vs. ${bar}
>> etc..
>> But that's probably too much.
>
> Backticks suck because they are non-nestable.  Always $().  Braces I do not
> care about.

Additionally, backticks are kinda-sorta deprecated. This means that
all the people who write the standards have said "Yeah, backticks suck
and the next standard will deprecate them" but standards bodies are
slow as hell, so they haven't made a new standard that deprecates them
yet


> This was added to the guidelines wiki page:
> Add these lines at the bottom of the document to enforce our guideline:
>
> # vim: set noexpandtab tabstop=8 shiftwidth=8 textwidth=132 autoindent
> # kate: indent-mode normal; indent-width 8; tab-indents on; tab-width 8;
> word-wrap on; word-wrap-column 132
>
> What about adding ones for emacs, geany, eclipse, ...    I.e., I think
> adding these a waste of time as it will always be an incomplete list.

I think we need at least vim and emacs, though we can trim the vim line:
# vim: set noet ts=8 sw=8 tw=132

Aside: setting autoindent in a modeline is missing the point of
modelines. They're intended to describe the FORMAT of the file, not
how you should edit it.

> How about test style:
> FOO=0
> if [ $FOO - eq 0 ]
> vs
> if (( ! $FOO ))
> makepkg has switched to the later.
>
> In then end, none of our coding projects is really big (apart from pacman
> which has its own guidelines) so as long as indentation is consistent within
> a project (tabs vs spaces), I could not care less...

This is bash specific, is it not? In projects such as initscripts we'd
want to steer away from this as, in theory, we could swtich to dash
some day.


More information about the arch-dev-public mailing list