Let's end the formatting mess
david.nolden.kdevelop at art-master.de
Wed Nov 9 02:44:20 UTC 2011
In the last days I've added a script and matching configurations to
KDevelop which allows defining shared fine-grained formatting scripts
right within the source directory structure.
"format_sources" files can be placed in the source directory, which
assign formatting-script calls to wildcard patterns. The
"kdev_format_source.sh" script uses these files to match
file-patterns, and format sources with the according formatting
I've added a predefined config for "kdev_format_sources.sh" in the
custom-script plugin, which means that everything required to use
these formatting files is activating that config, and making sure that
the underlying formatting-scripts (eg. uncrustify) are functional.
Uncrustify is a very powerful source-formatter with much more options
than astyle, and performing much more extensive reformatting. I've
found a configuration which mostly resembles the coding-style in
kdevplatform/language and kdevelop/languages/cpp, and attached this
configuration to all the C++ files in these directories using
"format_sources" files. Soon I will reformat all the files, and from
then on, we can easily enforce a consistent coding style there.
As a next step, I think we should do the same for all of KDevelop and
KDevplatform, to finally get rid the inconsistent formatting all
around. The question is, if we can find an uncrustify config which
satisfies all of us. Personally I would like to use the 2-spaces
indent style used in kdevplatform/language and kdevelop/languages/cpp
in all of KDevelop, because 2-spaces is more economical regarding
And another thing: What is the sense of all the kate modelines around?
It seems like kate inherits these options just fine from the source
files, so the modelines aren't required.
More information about the KDevelop-devel