-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.clang-format
More file actions
51 lines (46 loc) · 1.83 KB
/
.clang-format
File metadata and controls
51 lines (46 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# .clang-format
BasedOnStyle: Google # Use Google C++ style guide as the base
IndentWidth: 4 # Set the number of spaces per indentation level
TabWidth: 4 # Define tab width
UseTab: Never # Always use spaces instead of tabs
ColumnLimit: 100 # Maximum characters per line
AllowShortIfStatementsOnASingleLine: false # Always put 'if' statements on separate lines
AllowShortFunctionsOnASingleLine: InlineOnly # Only inline short functions on a single line
BreakBeforeBraces: Allman # Use Allman style for braces (open braces on a new line)
SpaceBeforeParens: ControlStatements # Add space before parentheses in control statements
AlignConsecutiveAssignments: true # Align variable assignments for readability
AlignConsecutiveDeclarations: true # Align declarations for consistency
SortIncludes: true # Sort `#include` statements
PointerAlignment: Left # Place the '*' next to the type (e.g., `int* ptr` instead of `int *ptr`)
Standard: Cpp11 # Use C++11 as the standard
# Customize comments styling
CommentPragmas: '^ IWYU pragma:' # Ignore 'Include What You Use' pragmas
# Customize brace wrapping
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
# Make constructor initializer lists more readable
ConstructorInitializerIndentWidth: 4
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# Format macros correctly
AlwaysBreakBeforeMultilineStrings: true
AllowAllArgumentsOnNextLine: true
# Enable include sorting with quotation marks before angle brackets
IncludeBlocks: Regroup
IncludeIsMainRegex: '(Test)?$'
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^".*\.h"'
Priority: 2
- Regex: '^<.*>'
Priority: 3
- Regex: '^".*"'
Priority: 4