diff mbox series

clang-format: set continuation indentation to 2

Message ID 20200515065012.206759-1-gprocida@google.com
State Committed
Headers show
Series clang-format: set continuation indentation to 2 | expand

Commit Message

Giuliano Procida May 15, 2020, 6:50 a.m. UTC
This is a further tweak to the clang-format rules, bringing them
(on average) closer to the existing corpus of code.

The existing code mostly uses an indentaton of 2 spaces, rather than
4, for expressions broken across lines. There are exceptions such as
conditional expressions that are initialisers but clang-format's
indentation may be preferable to emacs' zero indentation here.

	* .clang-format: Set ContinuationIndentWidth to 2.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 .clang-format | 1 +
 1 file changed, 1 insertion(+)

Comments

Matthias Maennich May 15, 2020, 8:09 a.m. UTC | #1
On Fri, May 15, 2020 at 07:50:12AM +0100, Giuliano Procida wrote:
>This is a further tweak to the clang-format rules, bringing them
>(on average) closer to the existing corpus of code.
>
>The existing code mostly uses an indentaton of 2 spaces, rather than
>4, for expressions broken across lines. There are exceptions such as
>conditional expressions that are initialisers but clang-format's
>indentation may be preferable to emacs' zero indentation here.
>
>	* .clang-format: Set ContinuationIndentWidth to 2.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>

Reviewed-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias

>---
> .clang-format | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/.clang-format b/.clang-format
>index f3a039c6..1dd679d4 100644
>--- a/.clang-format
>+++ b/.clang-format
>@@ -5,6 +5,7 @@ AlwaysBreakAfterReturnType: All
> BreakConstructorInitializers: BeforeColon
> ConstructorInitializerAllOnOneLineOrOnePerLine: true
> ConstructorInitializerIndentWidth: 2
>+ContinuationIndentWidth: 2
> BinPackParameters: false
> BreakStringLiterals: false
> PointerAlignment: Left
>-- 
>2.26.2.761.g0e0b3e54be-goog
>
Dodji Seketeli May 18, 2020, 8:48 a.m. UTC | #2
Giuliano Procida <gprocida@google.com> a écrit:

> This is a further tweak to the clang-format rules, bringing them
> (on average) closer to the existing corpus of code.
>
> The existing code mostly uses an indentaton of 2 spaces, rather than
> 4, for expressions broken across lines. There are exceptions such as
> conditional expressions that are initialisers but clang-format's
> indentation may be preferable to emacs' zero indentation here.
>
> 	* .clang-format: Set ContinuationIndentWidth to 2.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>
Acked-By: Dodji Seketeli <dodji@redhat.com>

Applied to master, thanks!

Cheers,
diff mbox series

Patch

diff --git a/.clang-format b/.clang-format
index f3a039c6..1dd679d4 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,6 +5,7 @@  AlwaysBreakAfterReturnType: All
 BreakConstructorInitializers: BeforeColon
 ConstructorInitializerAllOnOneLineOrOnePerLine: true
 ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
 BinPackParameters: false
 BreakStringLiterals: false
 PointerAlignment: Left