summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPheenoh <pheenoh@gmail.com>2021-01-31 20:55:56 -0500
committerGitHub <noreply@github.com>2021-01-31 20:55:56 -0500
commitb595f0d0bf2bde1d0e55cc1f6cfc5df71cb07d98 (patch)
tree6915f8a899fae0c67737fad7f7f7274a0b48ab2c
parentf1924e91f4a1ea1dea62b4fb0a1342f94a55ccfe (diff)
fix clang-format check (#110)
-rw-r--r--.clang-format2
-rw-r--r--.github/workflows/clang-format-check.yml10
-rw-r--r--tools/clang-format-check.sh14
3 files changed, 20 insertions, 6 deletions
diff --git a/.clang-format b/.clang-format
index 3b3c1e3076..79d9ae3b2e 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 789f7ca5c9..5cc17399d8 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 0000000000..52f09a1332
--- /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