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 Nov 7, 2024
1 parent 46fe3cd commit 2c02f66
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
Language: Cpp
BasedOnStyle: Google
IndentWidth: 4
PPIndentWidth: 1
IndentPPDirectives: AfterHash
IndentCaseLabels: false
IncludeBlocks: Preserve
SortIncludes: true
SpaceAfterCStyleCast: false
AllowShortIfStatementsOnASingleLine : Never
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlignConsecutiveMacros: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
Cpp11BracedListStyle: false
InsertNewlineAtEOF: true
SpacesInContainerLiterals: false
BinPackArguments: true
BinPackParameters: true
AlignAfterOpenBracket: Align
BracedInitializerIndentWidth: 4
SeparateDefinitionBlocks: Always
BreakBeforeBraces: Custom
AllowShortCaseLabelsOnASingleLine: true
BraceWrapping:
AfterControlStatement: MultiLine
AfterCaseLabel: false
AfterEnum: true
AfterFunction: true
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
PackConstructorInitializers: Never
BreakConstructorInitializers: BeforeComma
---
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ jobs:
- uses: actions/checkout@v4
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker -config .editorconfig-checker.json

clang-format-lint:
runs-on: ubuntu-latest
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: Check Formatting
run: git clang-format ${{ github.event.pull_request.base.sha }} --diff

0 comments on commit 2c02f66

Please sign in to comment.