From f91d7b5335cddb8bf4597f21cb44a7a24420d4a3 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Sat, 25 Nov 2023 17:46:16 +0100 Subject: [PATCH] Add clang format and corresponding ci action --- .clang-format | 28 ++++++++++++++++++++++++++++ .gitea/workflows/clang-format.yaml | 19 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .clang-format create mode 100644 .gitea/workflows/clang-format.yaml diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..806794c --- /dev/null +++ b/.clang-format @@ -0,0 +1,28 @@ +BasedOnStyle: LLVM +Language: Cpp + +IndentWidth: 4 +UseTab: Never +#NamespaceIndentation: All + +PointerAlignment: Left +AccessModifierOffset: -4 +AlwaysBreakTemplateDeclarations: true +LambdaBodyIndentation: Signature + +MaxEmptyLinesToKeep: 3 +#ColumnLimit: 128 + +CompactNamespaces: true +FixNamespaceComments: true + +AllowShortFunctionsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: true + +AlignConsecutiveAssignments: true +AlignConsecutiveBitFields: true +AlignConsecutiveDeclarations: true +AlignConsecutiveMacros: true + +#BraceWrapping: +# BeforeElse: true diff --git a/.gitea/workflows/clang-format.yaml b/.gitea/workflows/clang-format.yaml new file mode 100644 index 0000000..918ddbd --- /dev/null +++ b/.gitea/workflows/clang-format.yaml @@ -0,0 +1,19 @@ +name: clang-format Check +on: [push, pull_request] +jobs: + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + strategy: + matrix: + path: + - 'components' + - 'main' + steps: + - uses: actions/checkout@v2 + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.4.1 + with: + clang-format-version: '13' + check-path: ${{ matrix.path }} + fallback-style: 'Mozilla' # optional