Let's end the formatting mess

Ciprian Ciubotariu cheepeero at gmx.net
Wed Nov 9 11:29:39 UTC 2011

I apologize for my intrusion into this topic, but it relates to a
question I have asked a few times on the IRC channel.

The question I was asking was if KDevelop has a system for distributing
the source formatting settings across the development team. I am talking
about the editor style, or the astyle formatter settings, or both.

Would you think KDevelop would benefit from such a feature?

My thoughts for implementing it go to either

- export/import buttons on the relevant config pages
- place the format configuration in the project file and distribute it
along with the sources (since one individual may be involved in multiple
projects, each with its own coding standards)

Please ignore this message if you feel it interferes with the real
purpose of the thread.



On Wed, 2011-11-09 at 02:44 +0000, David Nolden wrote:
> 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
> command.
> 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
> screen real-estate.
> 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.
> Greetings, David

More information about the KDevelop-devel mailing list