diff --git a/Documentation/development/coding-style-policy.md b/Documentation/development/coding-style-policy.md index 9d75678cd0..35b8da200a 100644 --- a/Documentation/development/coding-style-policy.md +++ b/Documentation/development/coding-style-policy.md @@ -467,6 +467,20 @@ The case statement is to be indented to the same level as the switch. } ~~~~~~~~~~~~~ +It is permitted to place all cases on a single line each, if that makes the +code more readable. This is often done for look-ups or translation functions. In +this case, you will have to manually align for readability as appropriate and +reject clang-format's suggested changes, if you use it: + +~~~~~~~~~~~~~{.cpp} + switch( m_orientation ) + { + case PIN_RIGHT: m_orientation = PIN_UP; break; + case PIN_UP: m_orientation = PIN_LEFT; break; + case PIN_LEFT: m_orientation = PIN_DOWN; break; + case PIN_DOWN: m_orientation = PIN_RIGHT; break; + } +~~~~~~~~~~~~~ # 5. License Statement # {#license_statement} There is a the file copyright.h which you can copy into the top of diff --git a/_clang-format b/_clang-format index 1a4179264e..413c8b5717 100644 --- a/_clang-format +++ b/_clang-format @@ -7,7 +7,7 @@ AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false