diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2018-04-13 15:37:20 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2018-04-13 15:37:20 -0400 |
commit | cd0e1e91dd6d020263433d85526a91181180471d (patch) | |
tree | c8be7dbad9c614bf8415d1abbb357632320255e7 /src/.clang-format | |
parent | 3cf76c23fbfc8500fa494f8cef8068a67a1388c3 (diff) |
Fix inconsistent namespace formatting guidelines
Suggested formatting for namespaces in the developer guide is currently
inconsistent. This commit updates the developer guide and clang-format
configuration to consistently put "namespace" and opening/closing braces
on the same line. Example:
```c++
namespace boost {
namespace signals2 {
class connection;
} // namespace signals2
} // namespace boost
```
Currently the "Source code organization" section has an example like the one
above, but the "Coding style" section example and description put a newline
between the opening "namespace foo" and brace (but oddly no newline between
closing namespace and brace).
Avoiding newlines before namespace opening braces makes nested declarations
less verbose and also avoids asymmetry with closing braces. It's also a
common style used in other codebases:
* https://google.github.io/styleguide/cppguide.html#Namespaces
* https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
* https://llvm.org/docs/CodingStandards.html#namespace-indentation
Diffstat (limited to 'src/.clang-format')
-rw-r--r-- | src/.clang-format | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/.clang-format b/src/.clang-format index 2d2ee67035..38e19edf2c 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -12,7 +12,10 @@ AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: true BinPackParameters: false BreakBeforeBinaryOperators: false -BreakBeforeBraces: Linux +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterFunction: true BreakBeforeTernaryOperators: false BreakConstructorInitializersBeforeComma: false ColumnLimit: 0 |