Coding style

Stephen Gallagher sgallagh at redhat.com
Wed Nov 6 17:28:27 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/06/2013 07:24 AM, Marius Vollmer wrote:
> Hi,
> 
> let's nail down our coding style guidelines.  I have this so far, 
> discuss!
> 
> 
> Cockpit Coding Guidelines =========================
> 
> * General
> 
> - No trailing whitespace, no tab characters - Maximum line length
> is 120 characters.
> 

Could we make this 80 characters? I for one like being able to display
two files side-by-side in vim or eclipse, and 120 characters makes
this difficult.


> * C
> 
> - Gtk+ coding standards. - C99 is allowed and the default. -
> __attribute((cleanup)) is allowed, via libgsystem.
> 

I realize I'm likely to get outvoted on this, but I dislike any
mechanism that encourages lazy memory management. It's twelve o'clock;
do you know where your pointers are?


> * JavaScript
> 
> - Crockford
> 
> * Python
> 
> - PEP 8

+1[000]

> 
> * CSS / HTML
> 
> - XXX dashes vs underscores in ids.

I vote underscores


> - XXX namespacing of ids.
> 
> * Emacs
> 
> (setq indent-tabs-mode nil) (add-hook 'before-save-hook
> 'delete-trailing-whitespace) (setq whitespace-style '(face trailing
> lines-tail empty)) (setq whitespace-line-column 120) 
> (global-whitespace-mode)

 * Vim

autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
set hlsearch
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\t\|\r\|\S.*\s\+$\|^\s\s\+$\|\%>79v.\+/
set si
set ts=4
set sw=4
set sta
set sts=4
set et
set tabstop=4
set shiftwidth=4
set expandtab
set guifont=Monospace\ 12
set tw=79


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlJ6fDsACgkQeiVVYja6o6NfFwCgi8kiGubOXPIp0gMuBh+8v826
9xYAoKD+kKrIBy1vYck6buKCL1pj9+KO
=5K06
-----END PGP SIGNATURE-----


More information about the cockpit-devel mailing list