-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.clang-format
54 lines (48 loc) · 2.95 KB
/
.clang-format
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
52
53
54
---
# Base Style
BasedOnStyle: Google # Based on Google style guidelines
Language: Cpp # Explicitly specify C++
Standard: c++17 # Use C++17 standard
# Code Layout
ColumnLimit: 180 # Recommended maximum line length
IndentWidth: 4 # 4-space indentation
InsertNewlineAtEOF: true # Ensure newline at end of file
UseTab: Never # Exclusively use spaces for indentation
# Code Structure
AllowShortIfStatementsOnASingleLine: Never # Prevent single-line if statements
AllowShortFunctionsOnASingleLine: Inline # Allow short functions on single line
AllowShortLoopsOnASingleLine: false # Prevent single-line loops
BinPackArguments: false
BinPackParameters: OnePerLine
BreakBeforeBraces: Attach # Attach braces to code block
BreakBeforeBinaryOperators: NonAssignment # Break before non-assignment operators
BreakBeforeTernaryOperators: true # Break before ternary operators
BreakConstructorInitializers: BeforeColon # Break constructor initializers before colon
BreakInheritanceList: BeforeColon # Break inheritance list before colon
InsertBraces: true # Automatically insert braces for clarity
PackConstructorInitializers: Never
# Language Features
AccessModifierOffset: -4 # Offset for access modifiers
CompactNamespaces: false # Keep namespaces readable
FixNamespaceComments: true # Properly format namespace comments
IndentCaseLabels: true # Indent switch case labels
NamespaceIndentation: All # Indent inside namespaces
# Pointers and References
DerivePointerAlignment: false # Manually set pointer alignment
PointerAlignment: Left # Left-align pointers and references
# Spacing and Alignment
SpaceAroundPointerQualifiers: Default # Consistent space around pointer qualifiers
SpaceBeforeParens: ControlStatements # Space before parentheses in control statements
SpaceBeforeCtorInitializerColon: true # Space before constructor initializer colon
SpaceBeforeInheritanceColon: true # Space before inheritance colon
SpaceBeforeRangeBasedForLoopColon: true # Space before range-based for loop colon
SpacesBeforeTrailingComments: 2 # Two spaces before trailing comments
SpacesInContainerLiterals: false # No extra spaces in container literals
SpacesInParensOptions:
InEmptyParentheses: false # No spaces in empty parentheses
SpacesInSquareBrackets: false # No extra spaces in square brackets
# Comments and Includes
AlignTrailingComments:
Kind: Always # Strictly align trailing comments
ReflowComments: true # Reflow comments to fit column limit
SortIncludes: CaseSensitive # Sort includes in case-sensitive manner