coding-guidelines.md 1.8 KB

Coding Guidelines

This document describes the rules to be followed when contributing to this code base.

Code Format

The code format for this library is defined via ClangFormat configured in the .clang-format file.
This format must be used for the code.

Clean Code

Clean code rules are defined via ClangTidy configured in the .clang-tidy file. This rules must be followed.

Naming Convention

The following naming conventions must be met for code contribution:

  1. Class names follow the CamelCase convention, where the first letter is an upper case letter.
  2. Class methods follow the CamelCase convention, where the first letter is a lower case letter, when the method is public.
  3. Class methods follow the CamelCase convention, where the first letter is an underscore letter, followed by a lower case letter, when the method is private.
  4. Method and function parameter follow the CamelCase convention, where the first letter is an underscore letter, followed by a lower case letter.
  5. Private class members follow the CamelCase convention, where the first letter starts with a lower case letter.
  6. Header or source files of classes must meet the same naming convention as for class names, followed by the class extension (.cpp for source files, .hpp for header files).
  7. Class methods with a return type other than void must be declared with [[nodiscard]].
  8. Class methods with an optional return type other than void must be declared with [[maybe_unused]].

Source Code Creation

The following source code creation guidelines must be followed:

  1. In source code (.cpp files) namespaces must not be used throughout the code and must be announced through the using keyword after the imports (e.g. using ls::std::boxing::Integer). The only exception is when the same class name is being used in more than one namespace.