Skip to content

Commit ceab6e8

Browse files
committed
Apply consistent code formatting across the repo. Add clang-format and pre-commit hooks.
1 parent 2cd58fb commit ceab6e8

File tree

782 files changed

+110010
-109328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

782 files changed

+110010
-109328
lines changed

.clang-format

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
AccessModifierOffset: -4
3+
AlignAfterOpenBracket: Align
4+
AlignConsecutiveAssignments: Consecutive
5+
AlignConsecutiveDeclarations: Consecutive
6+
AlignConsecutiveMacros: Consecutive
7+
AlignEscapedNewlines: Left
8+
AlignOperands: AlignAfterOperator
9+
AlignTrailingComments: true
10+
AllowAllParametersOfDeclarationOnNextLine: false
11+
BinPackArguments: false
12+
BinPackParameters: false
13+
BraceWrapping:
14+
AfterClass: true
15+
AfterControlStatement: false
16+
AfterExternBlock: true
17+
AfterFunction: true
18+
AfterStruct: true
19+
AfterUnion: true
20+
BeforeCatch: true
21+
BeforeElse: true
22+
IndentBraces: false
23+
BreakBeforeBraces: Custom
24+
BreakBeforeConceptDeclarations: true
25+
BreakBeforeBinaryOperators: NonAssignment
26+
BreakBeforeTernaryOperators: true
27+
BreakConstructorInitializers: BeforeComma
28+
BreakInheritanceList: BeforeComma
29+
ColumnLimit: 120
30+
DerivePointerAlignment: false
31+
FixNamespaceComments: true
32+
IncludeCategories:
33+
- Regex: '^<.*>'
34+
Priority: 1
35+
- Regex: '^".*"'
36+
Priority: 2
37+
SortIncludes: true
38+
IncludeBlocks: Regroup
39+
IndentWidth: 4
40+
MaxEmptyLinesToKeep: 2
41+
PointerAlignment: Right
42+
SortUsingDeclarations: true
43+
SpaceAfterCStyleCast: false
44+
SpaceBeforeAssignmentOperators: true
45+
SpaceBeforeParens: ControlStatements
46+
Standard: c++17
47+
TabWidth: 4
48+
UseTab: Never
49+
...

.pre-commit-config.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright (c) 2024, NVIDIA CORPORATION.
2+
ci:
3+
autofix_commit_msg: |
4+
[pre-commit.ci] auto code formatting
5+
autofix_prs: false
6+
autoupdate_branch: ''
7+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
8+
autoupdate_schedule: quarterly
9+
skip: []
10+
submodules: false
11+
12+
repos:
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v5.0.0
15+
hooks:
16+
- id: end-of-file-fixer
17+
exclude: |
18+
(?x)^(
19+
.*\.raw$|
20+
.*\.bin$|
21+
.*\.dat$|
22+
.*\.nv12$|
23+
data/.*|
24+
Common/.*
25+
)
26+
files: |
27+
(?x)^(
28+
.*\.txt$|
29+
.*\.md$|
30+
.*\.cpp$|
31+
.*\.cxx$|
32+
.*\.hpp$|
33+
.*\.h$|
34+
.*\.cu$|
35+
.*\.cuh$
36+
)
37+
- id: mixed-line-ending
38+
exclude: |
39+
(?x)^(
40+
.*\.raw$|
41+
.*\.bin$|
42+
.*\.dat$|
43+
.*\.nv12$|
44+
data/.*|
45+
Common/.*
46+
)
47+
files: |
48+
(?x)^(
49+
.*\.txt$|
50+
.*\.md$|
51+
.*\.cpp$|
52+
.*\.cxx$|
53+
.*\.hpp$|
54+
.*\.h$|
55+
.*\.cu$|
56+
.*\.cuh$
57+
)
58+
- id: trailing-whitespace
59+
exclude: |
60+
(?x)^(
61+
.*\.raw$|
62+
.*\.bin$|
63+
.*\.dat$|
64+
.*\.nv12$|
65+
data/.*|
66+
Common/.*
67+
)
68+
files: |
69+
(?x)^(
70+
.*\.txt$|
71+
.*\.md$|
72+
.*\.cpp$|
73+
.*\.cxx$|
74+
.*\.hpp$|
75+
.*\.h$|
76+
.*\.cu$|
77+
.*\.cuh$
78+
)
79+
- repo: https://github.com/pre-commit/mirrors-clang-format
80+
rev: v19.1.6
81+
hooks:
82+
- id: clang-format
83+
types_or: [file]
84+
files: |
85+
(?x)^(
86+
^.*\.c$|
87+
^.*\.cpp$|
88+
^.*\.cu$|
89+
^.*\.cuh$|
90+
^.*\.cxx$|
91+
^.*\.h$|
92+
^.*\.hpp$|
93+
^.*\.inl$|
94+
^.*\.mm$
95+
)
96+
exclude: |
97+
(?x)^(
98+
Common/.*
99+
)
100+
args: ["-fallback-style=none", "-style=file", "-i"]

0 commit comments

Comments
 (0)