diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..0b68049a --- /dev/null +++ b/.clang-format @@ -0,0 +1,7 @@ +BreakBeforeBraces: Allman +ColumnLimit: 0 +IndentCaseLabels: true +IndentWidth: 8 +TabWidth: 8 +UseTab: Always +SortIncludes: false diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..55cef96a --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,16 @@ +name: Format sourcecode +on: [push, pull_request] +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Install dependencies + run: | + curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository -y 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' + sudo apt install clang-format-9 + - name: Format code + run: | + find src/ -type f -name '*.c' -name '*.c' | xargs clang-format-9 -i + git diff-index --quiet HEAD -- || (git diff && exit 1) diff --git a/src/thirdparty/.clang-format b/src/thirdparty/.clang-format new file mode 100644 index 00000000..9d159247 --- /dev/null +++ b/src/thirdparty/.clang-format @@ -0,0 +1,2 @@ +DisableFormat: true +SortIncludes: false