diff --git a/.clang-format b/.clang-format index 3b3c1e30760..79d9ae3b2e5 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,6 @@ --- Language: Cpp -Standard: c++03 +Standard: C++03 AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 789f7ca5c97..5cc17399d83 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -8,8 +8,8 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: DoozyX/clang-format-lint-action@v0.11 - with: - source: '.' - extensions: 'h,cpp' - clangFormatVersion: 11 \ No newline at end of file + - name: Install clang-format + run: sudo apt-get install clang-format-10 + - name: Run clang-format-check + run: sh tools/clang-format-check.sh + \ No newline at end of file diff --git a/tools/clang-format-check.sh b/tools/clang-format-check.sh new file mode 100644 index 00000000000..52f09a1332c --- /dev/null +++ b/tools/clang-format-check.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +clangFormatTargets=$(find . -type f -regex '.*\.\(cpp\|hpp\|h\|cc\|cxx\)') + +for inputFile in $clangFormatTargets +do + clang-format-10 -style=file $inputFile > $inputFile-formatted + diff $inputFile $inputFile-formatted + if [ $? != 0 ] ; then + exit 1 + else + rm $inputFile-formatted + fi +done