On 08/16/2012 12:45 PM, Jessica Tomechak wrote:

-----Original Message-----
From: Wido den Hollander [mailto:[email protected]]
Sent: Saturday, August 11, 2012 1:25 PM
To: [email protected]
Subject: Re: [DOCS] Indentation



On 08/10/2012 01:02 PM, Rohit Yadav wrote:
Hi,

On 10-Aug-2012, at 3:29 PM, Wido den Hollander <[email protected]> wrote:

Hi,

Most of the documentation (/docs) currently uses tabs instead of 4
spaces.

Do we want to use tabs or 4 spaces here?

Good point Wido! I was going to email about this earlier but thought no
would care.

So, we should follow coding conventions seriously:
http://docs.cloudstack.org/CloudStack_Documentation/Design_Documents/C
oding_Conventions

Use space; 1 tab = 4 spaces, in /docs and throughout the source code. I
tried a git filter that replaces all tabs to spaces, the patch was around
8-9MB so dropped the idea.


I did it for the agent directory a while ago. We should just do this
directory per directory, but announce it, so we don't screw up local
branches of people.

We can define [0] clean (when files are staged) and smudge (applied on
checkout) filters in git to expand tabs to spaces: [1]

Add in file .git/info/attributes:
*.java  filter=tabspace

Set git vars:
git config --global filter.tabspace.smudge 'expand -t 4'
git config --global filter.tabspace.clean 'expand -t 4'

Checkout HEAD to apply smudge/expand tabs:
git checkout HEAD -- **

We should also handle trailing whitespaces [2], CRLF and sign-off our
patches.
May be we should create and use a check-patch script [3] like GNU/Linux
committers do?


I agree on signing off, but a check-patch script would be hard in this
stage. Everything goes so rapid at this point that there is no way we get
everybody to use that script.

A commit hook was also 'denied' by Apache infra since that could use to
much CPU power (iirc).

I would vote for doing this replace in the docs directory, that has been
rather quite and can be done safely I think.

Wido

Refs:
[0] http://git-scm.com/book/ch7-2.html
[1]
http://stackoverflow.com/questions/2316677/can-git-automatically-switc
h-between-spaces-and-tabs/ [2]
http://snipplr.com/view/28523/git-precommit-hook-to-fix-trailing-white
space/ [3]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=tree;f=
scripts;h=6c1b648550f84d4af8d66d31a635db990d71e5ca;hb=f4ba394c1b02e7fc
2179fda8d3941a5b3b65efb6

Regards,
Rohit



Wido



I also care. I just added more authoring guidelines to the README file in
the docs directory, including that files should use spaces for indentation.
It looks like somebody's XML authoring tool (probably mine!) assumes tab
characters for indentation, so I will look into changing that setting in
the tool. If you can do a scripted cleanup of the existing files, that will
be awesome.


Yes, I can fix that. I'll check the docs directory again tonight, so be aware of a commit coming in that might change a lot.

Wido


Jessica T.
CloudStack Tech Pubs


Reply via email to