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

Pierre Schmitz pierre at archlinux.de
Sun Feb 14 02:59:19 EST 2010


Am Sonntag, 14. Februar 2010 00:29:02 schrieb Allan McRae:
> 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.

Yes, I wasn't sure about that either. Those lines should cover most editors 
though as some are compatible to the one or other.

But I think I'll remove that as it's not that important and might even be too 
strict. We should rather go with "Use what ever you like as long as the 
resulting patch applies to our coding guideline".
 
> How about test style:
> FOO=0
> if [ $FOO - eq 0 ]
> vs
> if (( ! $FOO ))
> makepkg has switched to the later.

Are those tests really equivalent? Doesn't the second match also if FOO is 
false, an empty string or is not set at all? (but I might mix this up with 
other languages)

> 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...

I beg to differ. I would really like to end up with at least a recommondation 
for all bash scripts we have written in Arch. This not only include devtools, 
dbscripts and makepkg but also initscripts, wrapper scripts and in the end 
even PKGBUILDs.

Of course, none of those files are really complex on its own; but a coding 
guide line is really helpful if more than one person contributes.

ATM we have all kinds of different styles even within one source file. It just 
makes maintenance and reading the code harder. It also looks ugly ;-)

One thing I have seen a lot (I might be guilty here myself) is e.g. if a 
packages was adopted by another maintainer one of the first commits is about 
changing indention etc..

-- 

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


More information about the arch-dev-public mailing list