PLEASE READ: Whitespace rules

Blair Zajac blair at orcaware.com
Fri Sep 7 10:44:10 PDT 2007


Kevin Ballard wrote:
> Last time this was brought up only one person complained, but it really 
> is a serious problem and we need standards. Therefore I propose the 
> following:
> 
>  * All source code files MUST use soft tabs at a tabstop of 4. No hard 
> tabs are allowed.
>  * All source code files SHOULD have the following as the first line of 
> the file:
>         # -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; 
> c-basic-offset: 4 -*- vim:et:sw=4:ts=4:sts=4
>     This is a modeline that works for both emacs and vim.
>  * Portfiles SHOULD use soft tabs at a tabstop of 4, but implementation 
> of this is left up to the discretion of the maintainer.
>  * Portfiles SHOULD use the given modeline
>  * Makefiles MUST use tabs as it is required by the syntax. Makefiles 
> SHOULD use a tab stop of 4.

I suggest using a tab stop of 8.  I never have modelines in my Makefile's so 
seeing a tab stop of 4 would look odd.

>  * Makefiles MAY use a modeline. The following works for emacs and vim:
>         # -*- Mode: Makefile; tab-width: 4; indent-tabs-mode: t -*- 
> vim:noet:sw=4:ts=4
>  * All other files (documentation, etc) SHOULD use soft tabs at a 
> tabstop of 4 if the document format allows.
>  * All other files (documentation, etc) SHOULD NOT use a modeline as it 
> is probably meant for human consumption.
> 
> Does anybody have suggestions for any changes? If not, I recommend 
> implementing this immediately. Every time I edit a file I will be 
> converting it to this format and committing in a separate changeset to 
> keep the svn history and diffs clean. I recommend everybody do this.

The thing we edit the most here is Portfile's, so I would suggest changing all 
the SHOULD's for Portfile's to MUST's, as that's where I'd like to see the most 
standardization.

Regards,
Blair

-- 
Blair Zajac, Ph.D.
<blair at orcaware.com>
http://www.orcaware.com/training/



More information about the macports-dev mailing list