kdelibs coding style

Adam Treat treat at kde.org
Thu Jul 20 17:05:34 BST 2006


On Wednesday 31 December 1969 7:00 pm, Zack Rusin wrote:
> With much love from Russia comes temperature checker (prediction: it's
> hot! flaming hot!) in the form of a proposal for a common coding style
> in kdelibs.
>
> It's something we talked about during the KDE Four meeting. The reason
> for it is that it's a pain in a butt to read through kdelibs code.
> Indention differs within files which makes a lot of them unreadable
> (oh, and btw shoutouts to George and Lubos for having indention styles
> that make grown may cry and baby jesus swear). Since KDE uses this
> thing called Qt, which also happens to be a library, it was agreed that
> it makes natural sense to adopt the style used in Qt. Attached is a
> file which describes Qt coding style. The idea is that it would be
> adopted for kdelibs.
>
> To make it clear, no mass reindenting would take place.. For already
> existing code the indention would be changed when a person would be
> editting it. So if you fix a bug in already existing code, you simply
> indent your code with the standard indention. This way history won't be
> messed up and we'll end up with consistant style in all files by the
> time KDE4 is out. The style is obviously mandatory for all new files.
>
> No exceptions. Either everything or nothing.
>
> Well, the only exception are libraries that are not maintained in the
> KDE SVN (for example, if it ever happens, integrated KHTML/WebKit would
> be maintained outside KDE SVN and the coding style that applies to it
> is one chosen for this project - interestingly enough WebKit coding
> style is basically exactly like Qt coding style so that's not going to
> be an issue).
>
> Oh, and this is of course only for kdelibs, in your apps/modules you can
> still use the 2.3 tabs indention or whatever your sick mind desires.
>
> with not a whole lot love but a lot of perseverance
> your boy toy

I'm all for this although I personally don't like the Qt style.  I can get 
used to it though.  Especially if we have consistency. 

However, applying this rule in patches for newly modified code is going to 
make the situation worse.  The style will differ from method to method for a 
very long time.   I doubt every method will be touched in time for KDE4 
release.

OTOH, applying this to all of kdelibs via astyle or something will totally 
break svn blame unless someone can figure out a workaround.  I'm still think 
it is a net win.

Can we also get a kate modeline at the bottom?

Adam




More information about the kde-core-devel mailing list