Common code indentation (follow-up to 2007 discussion)

Tim Abell tim at timwise.co.uk
Thu Aug 13 16:56:48 EDT 2009


Late to the party, but currently I prefer tab indents to spaces as it 
allows each developer to decide for themselves how big the indent is.

Tim

Christian Stimming wrote:
> Now that we've come back to working on one single branch (trunk), we should 
> reconsider the idea from back in 2007: We should re-indent the whole code 
> into one single indentation scheme. See
> http://lists.gnucash.org/pipermail/gnucash-devel/2007-March/020099.html
>
> Quote from there: I'd like to propose the following "indent" options. 
>
> Indentation
>
> -nut	No tabs. Indentation is done with spaces.
> -i4	Add four spaces for each indent level
> -ci4	Continuation lines are indented by four spaces
> -cli4	Case labels are indented by four spaces
> -ppi4	Nested pre-processor defines are indented by four spaces
> -nbc	Do not force newlines after commas in declarations (default)
> -nbfda	Don´t put each argument in a function declaration
>         on a separate line (default)
> -lp	Line up continued lines at parentheses (default)
> -psl	Put the type of a procedure on the line before its name.
> -bbo	Prefer to break long lines before boolean operators.
>
> Blank Lines
>
> -nsob	Do not swallow optional blank lines (default)
> -bad	Force a blank line after a declaration.
> -bbb	Force a blank line before a block comment.
> -bap	Force blank lines after procedure bodies.
>
> Comments
>
> -fca	Reformat all comments except those starting in column 1
> -fc1	Reformat comments starting in column 1
> -sc	Continuation lines in a comments start with a '*'
> [Added from discussion:]
> -lc80 Comment line width of 80
>
> Statements
>
> -npcs	Do not put space after the function in function calls.
> -nprs	Do not put a space after every ´(´ and before every ´)´.
>
> -ncs	Do not put a space after cast operators.
> -saf	Put a space after each for.
> -sai	Put a space after each if.
> -saw	Put a space after each while.
> [Added from discussion:]
> -ss On one-line for and while statments, force a blank before the semicolon. 
>
> -brs	Put braces on struct declaration line.
> -br	Put braces on line with if, etc.
> -ce	Cuddle else and preceeding `}´.
> -cdw	Cuddle while of do {} while; and preceeding `}´.
>
> Other
>
> -l80	Line width of 80.
> [Discussion ended unclear on this one. Maybe -l95 instead.]
>
>
> If this is agreed upon, someone needs to actually apply this patch. (I'm 
> rather short on time to do this, but would do it if nobody else steps up.)
>
> In any case, right now is a good time to do this, so we should do it.
>
> Regards,
>
> Christian
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>   


More information about the gnucash-devel mailing list