diff options
author | Kai Sommerfeld <3226626+ksooo@users.noreply.github.com> | 2023-10-25 19:05:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 19:05:32 +0200 |
commit | 319a1aee39633259e7a3d4822dae0f24644df04c (patch) | |
tree | 8c875982323ad9cb5019edb4fbdfd930b27056c6 | |
parent | bd91412c0e0e0e613a71a38694e2908f0a419f92 (diff) | |
parent | 8f2c388d91ed13cc6ccc92153127fbfb9926937e (diff) |
Merge pull request #23998 from ksooo/coding-guidelines-changes
[docs] Coding guidelines changes
-rw-r--r-- | docs/CODE_GUIDELINES.md | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/CODE_GUIDELINES.md b/docs/CODE_GUIDELINES.md index c7cf298042..1af839e6a4 100644 --- a/docs/CODE_GUIDELINES.md +++ b/docs/CODE_GUIDELINES.md @@ -69,6 +69,8 @@ In the repository root directory, there is a [`.clang-format`](https://github.co When you create a pull request, the PR build job will run `clang-format` on your commits and provide patches for any parts that don't satisfy the current `.clang-format` rules. You should apply these patches and amend your pull request accordingly. +The coding guidelines should be met by every code change, be it editing existing code, adding new code to existing source files, or adding completely new source files. For changes in existing files, at least the changed code needs to pass the clang-format check. + Conventions can be bent or broken in the interest of making code more readable and maintainable. However, if you submit a patch that contains excessive style conflicts, you may be asked to improve your code before your pull request is reviewed. **[back to top](#table-of-contents)** @@ -88,7 +90,7 @@ The `ColumnLimit` in `.clang-format` is set to `100` which defines line length ( Curly braces always go on a new line. ```cpp -for (int i = 0; i < t; i++) +for (int i = 0; i < t; ++i) { [...] } @@ -201,7 +203,7 @@ a = (b + c) * d; Control statement keywords have to be separated from opening parentheses by one space. ```cpp while (true); -for (int i = 0; i < x; i++); +for (int i = 0; i < x; ++i); ``` When conditions are used without parentheses, it is preferable to add a new line, to make the next block of code more readable. ```cpp |