From cf7b0bb5b6129889a70f8916c24933062adc9ec8 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Fri, 4 Oct 2019 16:00:13 +0100 Subject: [PATCH] [clang-format] switch - indent case and default --- .clang-format | 2 +- docs/CODE_GUIDELINES.md | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.clang-format b/.clang-format index 02f730e6d6932..c70b27c2afdfa 100644 --- a/.clang-format +++ b/.clang-format @@ -51,7 +51,7 @@ IncludeCategories: - Regex: '.*' Priority: 1 IncludeIsMainRegex: '$' -IndentCaseLabels: false +IndentCaseLabels: true IndentWidth: 2 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave diff --git a/docs/CODE_GUIDELINES.md b/docs/CODE_GUIDELINES.md index 07c12991fe194..e66b8a3989f17 100644 --- a/docs/CODE_GUIDELINES.md +++ b/docs/CODE_GUIDELINES.md @@ -120,8 +120,6 @@ public: } ``` -**Exception:** Do not increase indentation after a `switch` statements. - ### 3.3. Control statements Insert a new line before every: * else in an if statement @@ -148,21 +146,20 @@ else ``` #### 3.3.2. switch case -Do not indent `case` and `default`. ```cpp switch (cmd) { -case x: -{ - doSomething(); - break; -} -case x: -case z: - return true; -default: - doSomething(); + case x: + { + doSomething(); + break; + } + case x: + case z: + return true; + default: + doSomething(); } ```