From a6068caca561513137111ec84854958c89a78103 Mon Sep 17 00:00:00 2001 From: Tobias Prisching Date: Mon, 22 Jul 2024 02:22:25 +0200 Subject: [PATCH] Trying to integrate clang-format --- .clang-format | 52 +++++++++++++++++++++++++++++++++++++ .github/workflows/cmake.yml | 19 ++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..110bcaf --- /dev/null +++ b/.clang-format @@ -0,0 +1,52 @@ +--- +Language: Cpp + +BasedOnStyle: Google +BreakBeforeBraces: Allman + +ColumnLimit: 0 + +BreakBeforeBinaryOperators: None +AlignAfterOpenBracket: BlockIndent + +BinPackArguments: false +BinPackParameters: false + +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false +AlignConsecutiveDeclarations: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false + +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeParens: Custom +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterFunctionDeclarationName: true + AfterFunctionDefinitionName: true + +UseTab: Never +SpaceBeforeAssignmentOperators: true + +AlwaysBreakAfterDefinitionReturnType: All +AlwaysBreakAfterReturnType: All +AllowShortFunctionsOnASingleLine: Empty +AllowAllArgumentsOnNextLine: true +AllowShortBlocksOnASingleLine: true + +IndentWidth: 4 + +AccessModifierOffset: 0 +EmptyLineAfterAccessModifier: Leave +IndentAccessModifiers: true + +AlignOperands: true + +BreakBeforeTernaryOperators: true + +MaxEmptyLinesToKeep: 3 +--- diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a4c0391..48ee72b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -14,6 +14,25 @@ env: jobs: + check_formatting: + + runs-on: ubuntu-latest + + steps: + + # Check out the repository (basically downloads the source code) + - uses: actions/checkout@v3 + + - name: Install clang-format + run: | + sudo apt-get update + sudo apt-get install -y clang-format + + - name: Call clang-format + run: find src/ -name \*.c -o -name \*.h -print0 | xargs -0 -n 1 clang-format -n --Werror -n --verbose + + + build_and_publish: strategy: