Skip to content

Commit 873203d

Browse files
authored
Merge pull request #255 from P403n1x87/style/clang-format
style: check C style
2 parents 5823eaf + 71e83b8 commit 873203d

Some content is hidden

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

65 files changed

+7084
-7676
lines changed

.clang-format

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
BasedOnStyle: LLVM
3+
4+
AlignAfterOpenBracket: BlockIndent
5+
6+
AlignArrayOfStructures: Left
7+
8+
AlignConsecutiveAssignments:
9+
Enabled: true
10+
AcrossComments: true
11+
AlignCompound: true
12+
13+
AlignConsecutiveDeclarations:
14+
Enabled: true
15+
AcrossComments: true
16+
17+
AlignConsecutiveMacros:
18+
Enabled: true
19+
AcrossComments: true
20+
21+
AlignEscapedNewlines: LeftWithLastLine
22+
23+
AlignOperands: AlignAfterOperator
24+
25+
AlignTrailingComments:
26+
Kind: Always
27+
28+
AllowShortBlocksOnASingleLine: Always
29+
30+
BreakAfterReturnType: All
31+
32+
BreakBeforeBinaryOperators: All
33+
34+
ColumnLimit: 120
35+
36+
ContinuationIndentWidth: 4
37+
38+
IndentWidth: 4
39+
40+
PointerAlignment: Left

.github/workflows/checks.yml

+12
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ jobs:
7878
- name: Check source code spelling
7979
run: codespell -I .github/workflows/wordlist.txt -S "src/python/*" src
8080

81+
formatting-sources:
82+
runs-on: ubuntu-24.04
83+
name: Formatting (sources)
84+
steps:
85+
- uses: actions/checkout@v3
86+
87+
- name: Install clang-format
88+
run: pip install clang-format
89+
90+
- name: Check formatting
91+
run: find src -name "*.c" -o -name "*.h" | xargs clang-format -style=file --dry-run --Werror
92+
8193
formatting-tests:
8294
runs-on: ubuntu-24.04
8395
name: Formatting (tests)

scripts/format.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
find src -iname '*.h' -o -iname '*.c' | xargs clang-format -i

0 commit comments

Comments
 (0)