diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000000..b79600ba099de --- /dev/null +++ b/.clang-format @@ -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 +--- diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 06515adcabae4..ad4d69ad5a48c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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