feat(cpp-convention): Add Tilmann requirements

This commit is contained in:
2025-09-15 08:08:54 +02:00
parent 248031254d
commit 013e1609d9

View File

@@ -1,5 +1,5 @@
# C++ Code Conventions
> Rev. 1, 12-09-2025, Wessel T <contact@wessel.gg>
> Rev. 2, 15-09-2025, Wessel T <contact@wessel.gg>
> Proposals can be made in the form of a merge request to the `main` branch.
> Don't forget to update the [Changelog](#Changelog) when doing so.
@@ -89,6 +89,16 @@ For C++ file types we use the following conventions:
Using C libraries is allowed, but any includes must be in an `extern c` block.
### ROS2 specific naming conventions
> **NOTE** Year is always in YYYY format (2025)
* Workspace names are snake_case, named as `<groupname>_<year>_ws`.
* Package names are snake_case, named as `<groupname>_<year>_<functional_name>_pkg`.
This name has to be approved by the project manager.
* Interface package names are snake_case, named as either `<groupname>_<year>_machine_interfaces`
or `<groupname>_<year>_assessment_interfaces`
## Comments
* Comments are lines starting with `//`.
@@ -160,6 +170,7 @@ nested if statements are 4)
`if (is_charging && (!is_free || moving))`). Instead wrap parts in a variable
or simplify the if statement by removing the second part and wrapping that and
the underlying code in a function.
* Any relevant calculation should output a log message of severity `DEBUG`.
## Variables
@@ -175,6 +186,11 @@ nested if statements are 4)
3. ternary statements (e.g. int module = is_connected ? 5 : 4)
4. boundary condition in loops (e.g. uint loop_end = vector.size() - 1)
* Prefer constexpr variables over macros.
* Avoid double pointers.
## Dates
Dates should always be written in `DD[-/]MM[-/]YYYY HH[:]mm[:]ss` or epoch format.
## Example file
@@ -249,4 +265,7 @@ void ComplexIdea::some_function(int lower_limit) {
## Changelog
[15-09-2025] Wessel T: Add ROS2 naming standard
[12-09-2025] Wessel T: Create initial document