[IMPROVEMENT] Clang format (#1222)

* Add .clang-format

* Add clang-format github action

* Set more explicit name to GitHub workflow

Co-Authored-By: Willem <github@canihavesome.coffee>

Co-authored-by: Willem <github@canihavesome.coffee>
This commit is contained in:
Nils ANDRÉ-CHANG 2020-01-30 17:00:00 +00:00 committed by GitHub
parent af6d8282cb
commit 722d52420c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

7
.clang-format Normal file
View File

@ -0,0 +1,7 @@
BreakBeforeBraces: Allman
ColumnLimit: 0
IndentCaseLabels: true
IndentWidth: 8
TabWidth: 8
UseTab: Always
SortIncludes: false

16
.github/workflows/format.yml vendored Normal file
View File

@ -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)

2
src/thirdparty/.clang-format vendored Normal file
View File

@ -0,0 +1,2 @@
DisableFormat: true
SortIncludes: false