diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a418472 --- /dev/null +++ b/.clang-format @@ -0,0 +1,12 @@ +BasedOnStyle: Google + +AccessModifierOffset: -1 +DerivePointerAlignment: false + +IndentWidth: 2 +ColumnLimit: 100 + +IncludeBlocks: Preserve +SortIncludes: false + +AllowShortFunctionsOnASingleLine: Empty diff --git a/.gitea/workflows/check-format.yml b/.gitea/workflows/check-format.yml new file mode 100644 index 0000000..303ba05 --- /dev/null +++ b/.gitea/workflows/check-format.yml @@ -0,0 +1,25 @@ +name: Clang-format Check + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + clang-format-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install clang-format + run: sudo apt-get install -y clang-format + + - name: Check code formatting + run: | + find . -type f -regex '.*\.\(cpp\|hpp\|c\|h\)' -exec clang-format -style=file -i {} \; + git diff --exit-code