Skip to content

Commit 122937c

Browse files
committed
workflows/lint: add clang-format on changed files
The entire codebase is not ready to be clang-formatted and probably never will be, but we can at least check if the changes in new pull requests follow our coding style.
1 parent 37159a8 commit 122937c

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.clang-format

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
BasedOnStyle: Google
2+
BreakBeforeBraces: Linux
3+
IndentWidth: 4
4+
PPIndentWidth: 1
5+
IndentPPDirectives: AfterHash
6+
IndentCaseLabels: false
7+
IncludeBlocks: Preserve
8+
SortIncludes: true
9+
SpaceAfterCStyleCast: false
10+
AllowShortIfStatementsOnASingleLine : Never
11+
AllowShortLoopsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: false
13+
AlignArrayOfStructures: Right
14+
AlignConsecutiveAssignments: true
15+
AllowAllParametersOfDeclarationOnNextLine: false
16+
Cpp11BracedListStyle: true
17+
InsertNewlineAtEOF: true
18+
SpacesInContainerLiterals: false
19+
BinPackArguments: true
20+
BinPackParameters: true

.github/workflows/lint.yml

+18
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,21 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v4
4141
- uses: chartboost/ruff-action@v1
42+
43+
clang-format-lint:
44+
runs-on: ubuntu-24.04
45+
if: github.event_name == 'pull_request'
46+
# container:
47+
# image: "registry.opensuse.org/home/mia/images/images/mpv-ci:stable-deps"
48+
steps:
49+
- run: |
50+
sudo apt-get update
51+
sudo apt-get install -y clang-format
52+
53+
- uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 50
56+
- name: Check Formatting
57+
run: |
58+
git clang-format ${{ github.event.pull_request.base.sha }} --diff
59+
echo $?

0 commit comments

Comments
 (0)