Skip to content

Commit

Permalink
[Format] Update clang-format rules for version 18
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nickbeth committed Dec 7, 2024
1 parent 5b89edc commit bbc88e2
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bbc88e2

Please sign in to comment.