incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wido den Hollander <w...@widodh.nl>
Subject Re: [DOCS] Indentation
Date Sat, 11 Aug 2012 20:24:40 GMT


On 08/10/2012 01:02 PM, Rohit Yadav wrote:
> Hi,
>
> On 10-Aug-2012, at 3:29 PM, Wido den Hollander <wido@widodh.nl> 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/Coding_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-switch-between-spaces-and-tabs/
> [2] http://snipplr.com/view/28523/git-precommit-hook-to-fix-trailing-whitespace/
> [3] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=tree;f=scripts;h=6c1b648550f84d4af8d66d31a635db990d71e5ca;hb=f4ba394c1b02e7fc2179fda8d3941a5b3b65efb6
>
> Regards,
> Rohit
>
>
>>
>> Wido
>

Mime
View raw message