Let's end the formatting mess

David Nolden david.nolden.kdevelop at art-master.de
Wed Nov 9 16:24:59 UTC 2011

2011/11/9 Andreas Pakulat <apaku at gmx.de>:
>> Thank you, but I prefer my pretty 4-space indentation in the code
>> that I wrote.
> Great bike-shedding topic. I agree with Alex on the 4-spaces thing,
> especially since horizontal space is cheap these days.

Well, some people like to use the increased resources available these
days for useful things, for example for split-views or tiled windows,
instead of wasting it for whitespace.

> IMHO the codebase actually is quite well formatted in general. Things

It's not terrible, but it's also not good. I can point you at tons of
files which even have 4-space and 2-space indentation mixed. I agree
that it's not such a huge problem for reading, but it's very annoying
when writing small portions of code in many different places, each
with a different kind of formatting which I must adapt to. Therefore,
we should at least have a way to automatically format newly inserted
code. Uncrustify is perfect for this, because it can largely
"normalize" the code. We simply have to define which formatting
configurations we want to use for what portions of our code, and then
define a rule that every committer must format the code before
committing it.

It's also annoying to always tell new contributors to remove training
whitespaces, add/remove whitespace here and there, or whatever. In
future we can simply tell them "run the formatting script before
before creating the patch", or simply do it by ourselves.

In general, a human shouldn't be forced to do something which a
machine can do better (eg. format the code in a consistent exactly
defined way depending on the current context). Of course we can define
different formattings for different parts of the codebase, although
one consistent formatting would be better.

Greetings, David

More information about the KDevelop-devel mailing list