2024-02-20 21:16:07 +01:00
|
|
|
---
|
|
|
|
title: PR Guidelines
|
|
|
|
---
|
|
|
|
|
|
|
|
## PR Requirements
|
2022-09-04 13:13:24 +02:00
|
|
|
|
|
|
|
- Clean, not hacky code
|
2022-10-23 16:35:39 +02:00
|
|
|
- Described changes and _why_ they were there
|
2022-09-04 13:13:24 +02:00
|
|
|
- Following the style (see below)
|
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
## Code Style
|
2022-09-04 13:13:24 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
Please read this if you are submitting a PR, in order to minimize the amount of style nits received, and save
|
|
|
|
the time for the maintainers.
|
2022-10-23 16:35:39 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
### Before you submit
|
2022-09-04 13:13:24 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
Make sure you ran clang-format: `clang-format -i src/**/*{cpp,hpp}`
|
2022-09-04 13:13:24 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
Check if your changes don't violate `clang-tidy`. Usually this is built into your IDE.
|
2022-09-04 13:13:24 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
### Clang-format
|
2022-10-23 16:35:39 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
This is non-negotiable. Your code **must** be formatted.
|
2024-10-03 20:20:43 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
### Clang-tidy
|
2022-10-23 16:35:39 +02:00
|
|
|
|
2024-12-07 18:58:53 +01:00
|
|
|
Clang-tidy violations are not hard requirements, but please try to minimize them, and
|
|
|
|
_only_ ignore them if it's absolutely necessary.
|
|
|
|
|
|
|
|
I've tweaked it so that in 99% of cases you absolutely should fix it.
|
|
|
|
|
|
|
|
### Other
|
|
|
|
|
|
|
|
Some stuff clang-tidy / clang-format won't catch:
|
|
|
|
- No uninitialized _primitives_ (int, float, double, size_t, etc.)
|
|
|
|
- No short ifs. if your if/else body contains 1 _line_ (not 1 statement) do not put `{}` around it.
|
|
|
|
- The above rule does not apply to loops / etc
|
|
|
|
- Consider adding a `;` inside of empty function bodies
|
|
|
|
- Use utilities. Do not invent new types where one already exists.
|
|
|
|
- Consider the usage of the STL
|
|
|
|
- Minimize manual memory management to an absolute minimum. You have tons of tools at your disposal to do so
|
|
|
|
- Whenever you're initializing vectors arrays or maps with a lot of elements, add a `,` after the last element to make the styling nicer
|