From bbc88e2620588712fc0938907fd76eb3b9208b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Betto?= <niccolo.betto@skywarder.eu> Date: Fri, 6 Dec 2024 19:15:12 +0100 Subject: [PATCH] [Format] Update clang-format rules for version 18 Some deprecated options have been updated to the corresponding new ones. Some missing rules were added to fix inconsistencies in the code formatting: * Add new line ad EOF and trim additional ones * Trim empty lines at beginning of blocks * Allow brace-less single line if/else/for/while statements * Align pointer/reference to the type --- .clang-format | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/.clang-format b/.clang-format index 827c89b43..6fb27dd55 100644 --- a/.clang-format +++ b/.clang-format @@ -1,13 +1,24 @@ -{ - BasedOnStyle: Google, - AccessModifierOffset: -4, - AlignConsecutiveAssignments: true, - AllowShortIfStatementsOnASingleLine: false, - AllowShortLoopsOnASingleLine: false, - BreakBeforeBraces: Allman, - ColumnLimit: 80, - ConstructorInitializerAllOnOneLineOrOnePerLine: false, - IndentCaseLabels: true, - IndentWidth: 4, - KeepEmptyLinesAtTheStartOfBlocks: true, -} +BasedOnStyle: Google + +ColumnLimit: 80 +IndentWidth: 4 +AccessModifierOffset: -4 + +BreakBeforeBraces: Allman +# Allow braceless single line if/else/for/while statements +RemoveBracesLLVM: true + +AlignConsecutiveAssignments: Consecutive +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +PackConstructorInitializers: BinPack +IndentCaseLabels: true + +# Empty lines behavior +InsertNewlineAtEOF: true +KeepEmptyLinesAtEOF: true +KeepEmptyLinesAtTheStartOfBlocks: false + +# Align pointers/references to the type, not the variable +DerivePointerAlignment: false +PointerAlignment: Left -- GitLab