Skip to content

Commit 9db6d5c

Browse files
committed
build(cxx-cuda): update clang-format configuration for consistency
- Update .clang-format files in both CUDA and CXX templates - Improve code structure and readability settings - Adjust spacing and alignment configurations - Enhance pointer and reference formatting - Refine comment and include sorting
1 parent c914485 commit 9db6d5c

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
---
2-
# Base Style and Modern Practices
2+
# Base Style
33
BasedOnStyle: Google # Based on Google style guidelines
4-
Standard: c++17 # Use C++17 standard
54
Language: Cpp # Explicitly specify C++
5+
Standard: c++17 # Use C++17 standard
66

77
# Code Layout
8-
ColumnLimit: 180 # Recommended max line length
8+
ColumnLimit: 180 # Recommended maximum line length
99
IndentWidth: 4 # 4-space indentation
10-
UseTab: Never # Always use spaces instead of tabs
1110
InsertNewlineAtEOF: true # Ensure newline at end of file
11+
UseTab: Never # Exclusively use spaces for indentation
1212

1313
# Code Structure
14-
BreakBeforeBraces: Attach # Attach braces to code block
15-
AllowShortFunctionsOnASingleLine: Inline # Allow short functions on single line
1614
AllowShortIfStatementsOnASingleLine: Never # Prevent single-line if statements
15+
AllowShortFunctionsOnASingleLine: Inline # Allow short functions on single line
1716
AllowShortLoopsOnASingleLine: false # Prevent single-line loops
17+
BreakBeforeBraces: Attach # Attach braces to code block
1818
BreakBeforeBinaryOperators: NonAssignment # Break before non-assignment operators
1919
BreakBeforeTernaryOperators: true # Break before ternary operators
20-
BreakConstructorInitializers: BeforeColon # Break before initializer colon
20+
BreakConstructorInitializers: BeforeColon # Break constructor initializers before colon
2121
BreakInheritanceList: BeforeColon # Break inheritance list before colon
22+
InsertBraces: true # Automatically insert braces for clarity
2223

2324
# Language Features
24-
IndentCaseLabels: true # Indent switch case labels
25-
NamespaceIndentation: Inner # Indent inside namespaces
2625
AccessModifierOffset: -4 # Offset for access modifiers
2726
CompactNamespaces: false # Keep namespaces readable
2827
FixNamespaceComments: true # Properly format namespace comments
28+
IndentCaseLabels: true # Indent switch case labels
29+
NamespaceIndentation: All # Indent inside namespaces
2930

3031
# Pointers and References
3132
DerivePointerAlignment: false # Manually set pointer alignment
3233
PointerAlignment: Left # Left-align pointers and references
3334

3435
# Spacing and Alignment
35-
SpaceBeforeParens: ControlStatements # Spaces before parentheses in control statements
36+
SpaceAroundPointerQualifiers: Default # Consistent space around pointer qualifiers
37+
SpaceBeforeParens: ControlStatements # Space before parentheses in control statements
38+
SpaceBeforeCtorInitializerColon: true # Space before constructor initializer colon
39+
SpaceBeforeInheritanceColon: true # Space before inheritance colon
40+
SpaceBeforeRangeBasedForLoopColon: true # Space before range-based for loop colon
41+
SpacesBeforeTrailingComments: 2 # Two spaces before trailing comments
42+
SpacesInContainerLiterals: false # No extra spaces in container literals
3643
SpacesInParensOptions:
3744
InEmptyParentheses: false # No spaces in empty parentheses
3845
SpacesInSquareBrackets: false # No extra spaces in square brackets
39-
SpacesBeforeTrailingComments: 2 # Two spaces before trailing comments
40-
SpaceBeforeCtorInitializerColon: true # Space before constructor initializer colon
41-
SpaceBeforeInheritanceColon: true # Space before inheritance colon
42-
SpaceAroundPointerQualifiers: Default # Consistent space around pointer qualifiers
4346

4447
# Comments and Includes
45-
SortIncludes: CaseSensitive # Sort includes in case-sensitive manner
4648
AlignTrailingComments:
4749
Kind: Always # Strictly align trailing comments
4850
ReflowComments: true # Reflow comments to fit column limit
49-
50-
# Initialization and Constructors
51-
SpaceBeforeRangeBasedForLoopColon: true # Space before range-based for loop colon
52-
SpacesInContainerLiterals: false # No extra spaces in container literals
51+
SortIncludes: CaseSensitive # Sort includes in case-sensitive manner
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
---
2-
# Base Style and Modern Practices
2+
# Base Style
33
BasedOnStyle: Google # Based on Google style guidelines
4-
Standard: c++17 # Use C++17 standard
54
Language: Cpp # Explicitly specify C++
5+
Standard: c++17 # Use C++17 standard
66

77
# Code Layout
8-
ColumnLimit: 180 # Recommended max line length
8+
ColumnLimit: 180 # Recommended maximum line length
99
IndentWidth: 4 # 4-space indentation
10-
UseTab: Never # Always use spaces instead of tabs
1110
InsertNewlineAtEOF: true # Ensure newline at end of file
11+
UseTab: Never # Exclusively use spaces for indentation
1212

1313
# Code Structure
14-
BreakBeforeBraces: Attach # Attach braces to code block
15-
AllowShortFunctionsOnASingleLine: Inline # Allow short functions on single line
1614
AllowShortIfStatementsOnASingleLine: Never # Prevent single-line if statements
15+
AllowShortFunctionsOnASingleLine: Inline # Allow short functions on single line
1716
AllowShortLoopsOnASingleLine: false # Prevent single-line loops
17+
BreakBeforeBraces: Attach # Attach braces to code block
1818
BreakBeforeBinaryOperators: NonAssignment # Break before non-assignment operators
1919
BreakBeforeTernaryOperators: true # Break before ternary operators
20-
BreakConstructorInitializers: BeforeColon # Break before initializer colon
20+
BreakConstructorInitializers: BeforeColon # Break constructor initializers before colon
2121
BreakInheritanceList: BeforeColon # Break inheritance list before colon
22+
InsertBraces: true # Automatically insert braces for clarity
2223

2324
# Language Features
24-
IndentCaseLabels: true # Indent switch case labels
25-
NamespaceIndentation: Inner # Indent inside namespaces
2625
AccessModifierOffset: -4 # Offset for access modifiers
2726
CompactNamespaces: false # Keep namespaces readable
2827
FixNamespaceComments: true # Properly format namespace comments
28+
IndentCaseLabels: true # Indent switch case labels
29+
NamespaceIndentation: All # Indent inside namespaces
2930

3031
# Pointers and References
3132
DerivePointerAlignment: false # Manually set pointer alignment
3233
PointerAlignment: Left # Left-align pointers and references
3334

3435
# Spacing and Alignment
35-
SpaceBeforeParens: ControlStatements # Spaces before parentheses in control statements
36+
SpaceAroundPointerQualifiers: Default # Consistent space around pointer qualifiers
37+
SpaceBeforeParens: ControlStatements # Space before parentheses in control statements
38+
SpaceBeforeCtorInitializerColon: true # Space before constructor initializer colon
39+
SpaceBeforeInheritanceColon: true # Space before inheritance colon
40+
SpaceBeforeRangeBasedForLoopColon: true # Space before range-based for loop colon
41+
SpacesBeforeTrailingComments: 2 # Two spaces before trailing comments
42+
SpacesInContainerLiterals: false # No extra spaces in container literals
3643
SpacesInParensOptions:
3744
InEmptyParentheses: false # No spaces in empty parentheses
3845
SpacesInSquareBrackets: false # No extra spaces in square brackets
39-
SpacesBeforeTrailingComments: 2 # Two spaces before trailing comments
40-
SpaceBeforeCtorInitializerColon: true # Space before constructor initializer colon
41-
SpaceBeforeInheritanceColon: true # Space before inheritance colon
42-
SpaceAroundPointerQualifiers: Default # Consistent space around pointer qualifiers
4346

4447
# Comments and Includes
45-
SortIncludes: CaseSensitive # Sort includes in case-sensitive manner
4648
AlignTrailingComments:
4749
Kind: Always # Strictly align trailing comments
4850
ReflowComments: true # Reflow comments to fit column limit
49-
50-
# Initialization and Constructors
51-
SpaceBeforeRangeBasedForLoopColon: true # Space before range-based for loop colon
52-
SpacesInContainerLiterals: false # No extra spaces in container literals
51+
SortIncludes: CaseSensitive # Sort includes in case-sensitive manner

0 commit comments

Comments
 (0)