Skip to content

Commit

Permalink
Improve the .clang-format file a bit
Browse files Browse the repository at this point in the history
* add include sorting and grouping
* allow some short blocks to be on a single line
  • Loading branch information
horenmar committed Nov 7, 2022
1 parent 297a175 commit fdea5a5
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .clang-format
@@ -1,4 +1,26 @@
---
Language: Cpp
Standard: c++14

# Note that we cannot use IncludeIsMainRegex functionality, because it
# does not support includes in angle brackets (<>)
SortIncludes: True
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '<catch2/.*\.hpp>'
Priority: 1
- Regex: '<.*/.*\.hpp>'
Priority: 2
- Regex: '<.*>'
Priority: 3


AllowShortBlocksOnASingleLine: Always
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: Inline

AccessModifierOffset: '-4'
AlignEscapedNewlines: Left
AllowAllConstructorInitializersOnNextLine: 'true'
Expand All @@ -8,17 +30,14 @@ BreakConstructorInitializers: AfterColon
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
DerivePointerAlignment: 'false'
FixNamespaceComments: 'true'
IncludeBlocks: Regroup
IndentCaseLabels: 'false'
IndentPPDirectives: AfterHash
IndentWidth: '4'
Language: Cpp
NamespaceIndentation: All
PointerAlignment: Left
SpaceBeforeCtorInitializerColon: 'false'
SpaceInEmptyParentheses: 'false'
SpacesInParentheses: 'true'
Standard: Cpp11
TabWidth: '4'
UseTab: Never

Expand Down

0 comments on commit fdea5a5

Please sign in to comment.