Page tree
Skip to end of metadata
Go to start of metadata

This page documents how source code autoformatting tools can be used to enforce the Zubax C++ coding conventions.

There is no such thing as a decent autoformatter for C++, so the existing ones should be used with care. It is advised to enforce the coding conventions manually (e.g. during code review), and use autoformatters only if the code needs to be converted from a different codebase where a different set of formatting rules was used.

Uncrustify

Uncrustify can be used with the following configuration file to enforce the formatting conventions.

uncrustify.cfg

The file can be used as follows:

Invoking Uncrustify
uncrustify --replace --no-backup -c uncrustify.cfg src/*

Eclipse IDE autoformatter

Configuration file for the Eclipse autoformatter is attached below. Eclipse's embedded autoformatter is quite limited in its capabilities, so one should not rely on it too much.

eclipse_formatter.xml