Skip to content

Commit

Permalink
workflows/lint: add clang-format on changed files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kasper93 committed Oct 21, 2024
1 parent ca7006a commit 3630129
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
BasedOnStyle: Google
BreakBeforeBraces: Linux
IndentWidth: 4
PPIndentWidth: 1
IndentPPDirectives: AfterHash
IndentCaseLabels: false
IncludeBlocks: Preserve
SortIncludes: true
SpaceAfterCStyleCast: false
AllowShortIfStatementsOnASingleLine : Never
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlignArrayOfStructures: Right
AlignConsecutiveAssignments: true
AllowAllParametersOfDeclarationOnNextLine: false
Cpp11BracedListStyle: true
InsertNewlineAtEOF: true
SpacesInContainerLiterals: false
BinPackArguments: true
BinPackParameters: true
16 changes: 16 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,19 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1

clang-format-lint:
runs-on: ubuntu-24.04
container:
image: "registry.opensuse.org/home/mia/images/images/mpv-ci:stable-deps"
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Configure git
# Workaround to avoid "fatal: detected dubious ownership in repository" error.
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Check Formatting
run: |
git clang-format ${{ github.event.pull_request.base.sha }} --diff

0 comments on commit 3630129

Please sign in to comment.