Code Formatting

Unfortunately, there is not much of accepted code formatting rules in the project. See for example Bug 1118.

Until a consistent style is applied, the following applies to new code:

Indentation: Use 4 characters per level, no tabs allowed. Set editor to insert spaces for tabs.

Comments: Self explanatory code with descriptive naming of methods and variables is preferred over comments.

Encoding: Source files should be restrained to 7-bit ascii.

Whitespace: No trailing whitespace.

Besides these rules, try to adapt to the surrounding layout when making patches.

For Eclipse users there is a Code Formatter template available here (Remove the .doc extension)
For Uncrustify users there is an uncrustify.cfg available here

FIXME

CMake Formatting

The main CMakeLists.txt + some (not all) support files has been successfully reformatted using https://github.com/cheshirekow/cmake_format. The configuration file (almost pristine) is available as https://raw.githubusercontent.com/OpenCPN/OpenCPN/master/.cmake-format.yaml.