Skip to content

Commit bf12a3a

Browse files
committed
clang-format
I tried for a while to come up with a config that perfectly matched the existing style and the closest I could get changed about 15% of the lines and looked bad on moderately indented blocks because of the use of tabs. Moving away from tabs changes more lines, but looks better.
1 parent d29c687 commit bf12a3a

37 files changed

+13429
-12760
lines changed

.clang-format

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
AlignAfterOpenBracket: Align
2+
AlignArrayOfStructures: Left
3+
AlignConsecutiveDeclarations: AcrossEmptyLines
4+
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
5+
AllowShortBlocksOnASingleLine: false
6+
AllowShortFunctionsOnASingleLine: false
7+
AllowShortIfStatementsOnASingleLine: false
8+
AllowShortLoopsOnASingleLine: false
9+
AlwaysBreakAfterReturnType: AllDefinitions
10+
BinPackArguments: true
11+
BinPackParameters: false
12+
BraceWrapping:
13+
AfterCaseLabel: true
14+
AfterControlStatement: Always
15+
AfterEnum: true
16+
AfterFunction: true
17+
AfterStruct: true
18+
AfterExternBlock: false
19+
BeforeElse: true
20+
BeforeWhile: true
21+
BreakBeforeBraces: Custom
22+
BreakStringLiterals: false
23+
ColumnLimit: 80
24+
IndentExternBlock: NoIndent
25+
IndentWidth: 4
26+
PenaltyBreakAssignment: 100
27+
PenaltyReturnTypeOnItsOwnLine: 150
28+
SpaceAfterCStyleCast: true
29+
TabWidth: 4
30+
UseTab: Never

.editorconfig

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ insert_final_newline = true
77
charset = utf-8
88

99
[*.{c,h}]
10-
indent_style = tab
10+
indent_style = space
11+
indent_size = 4
1112

1213
[*.py]
1314
indent_style = space

.github/workflows/build.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ on:
44
pull_request:
55

66
jobs:
7+
clang_format:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out code
11+
uses: actions/checkout@v4
12+
13+
- name: Lint code formatting
14+
run: |
15+
clang-format-15 -i */*.[ch]
16+
git diff
17+
git status --porcelain | grep -q '^ M' && exit 1 || exit 0
18+
719
flake8:
820
runs-on: ubuntu-latest
921
steps:
@@ -26,7 +38,7 @@ jobs:
2638
run: sudo apt update
2739

2840
- name: Install dependencies
29-
run: sudo apt install libbsd-dev libjansson-dev libmilter-dev libssl-dev
41+
run: sudo apt install libbsd-dev libidn2-dev libjansson-dev libmilter-dev libssl-dev
3042

3143
- name: Install Python dependencies
3244
run: sudo pip install pytest miltertest

0 commit comments

Comments
 (0)