Skip to content

Commit a69584b

Browse files
committed
add .clang-format and use mirrors-clang-format
1 parent fb655e0 commit a69584b

3 files changed

Lines changed: 44 additions & 9 deletions

File tree

.clang-format

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
BasedOnStyle: LLVM
2+
3+
AccessModifierOffset: -4
4+
5+
AlignConsecutiveMacros: true
6+
AlignConsecutiveBitFields: true
7+
AlignEscapedNewlines: Right
8+
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: Empty
11+
12+
AlwaysBreakTemplateDeclarations: Yes
13+
14+
BinPackParameters: false
15+
16+
BraceWrapping:
17+
AfterCaseLabel: true
18+
AfterClass: true
19+
AfterControlStatement: Never
20+
AfterEnum: true
21+
AfterFunction: true
22+
AfterNamespace: true
23+
AfterObjCDeclaration: false
24+
AfterStruct: true
25+
AfterUnion: true
26+
AfterExternBlock: true
27+
BeforeCatch: false
28+
BeforeElse: true
29+
BeforeLambdaBody: false
30+
BeforeWhile: false
31+
IndentBraces: false
32+
SplitEmptyFunction: true
33+
SplitEmptyRecord: true
34+
SplitEmptyNamespace: true
35+
BreakBeforeBraces: Custom
36+
37+
ColumnLimit: 80
38+
39+
IndentWidth: 4
40+
IndentWrappedFunctionNames: true
41+
42+
Standard: c++17

.github/workflows/pre-commit.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,5 @@ jobs:
3030
codespell
3131
pylint
3232
33-
- name: Set up clang-format
34-
run: |
35-
sudo apt-get install -y clang-format-18
36-
sudo unlink /usr/bin/clang-format
37-
sudo ln -s /usr/bin/clang-format-18 /usr/bin/clang-format
38-
clang-format --version
39-
4033
- name: Run pre-commit checks
4134
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ repos:
4949
- id: black
5050
exclude: "_vendored/conv_template.py"
5151

52-
- repo: https://github.com/pocc/pre-commit-hooks
53-
rev: v1.3.5
52+
- repo: https://github.com/pre-commit/mirrors-clang-format
53+
rev: v22.1.0
5454
hooks:
5555
- id: clang-format
5656
args: ["-i"]

0 commit comments

Comments
 (0)