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:
- Class names follow the CamelCase convention, where the first letter is an upper case letter.
- Class methods follow the CamelCase convention, where the first letter is a lower case letter, when the method is public.
- 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.
- Method and function parameter follow the CamelCase convention, where the first letter is an underscore letter, followed by a lower case letter.
- Private class members follow the CamelCase convention, where the first letter starts with a lower case letter.
- 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).
- Class methods with a return type other than void must be declared with [[nodiscard]].
- 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:
- 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.