Add a clang-tidy run (#214)

Adds a clang-tidy run in addition to the existing clang-format checks.
The clang-tidy checks are not enforced, but is potentially useful to
point to during review.
This commit is contained in:
Jerin Philip 2021-08-13 16:26:44 +01:00 committed by GitHub
parent 9994d4acdb
commit 972d8560b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 1 deletions

32
.clang-tidy Normal file
View File

@ -0,0 +1,32 @@
Checks: >
.*,
bugprone-*,
concurrency-*,
google-*,
portability-*,
performance-*,
clang-analyzer-*,
readability-*,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-uppercase-literal-suffix,
misc-*,
-misc-noexcept*,
modernize-*,
-modernize-deprecated-headers,
-modernize-use-nodiscard,
-modernize-raw-string-literal,
-modernize-return-braced-init-list,
-modernize-use-equals-delete,
-modernize-use-trailing-return-type,
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.ClassMethodCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
- { key: readability-identifier-naming.ParameterCase, value: camelBack }

View File

@ -1,5 +1,7 @@
name: "Coding Style" name: "Coding Style"
env:
clang_version: 10
on: on:
push: push:
branches: [ main, ci-sandbox ] branches: [ main, ci-sandbox ]
@ -19,8 +21,24 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y clang-format sudo apt-get install -y build-essential cmake
sudo apt-get install -y clang-format clang-tidy-${{ env.clang_version }}
- name: Run clang-format - name: Run clang-format
run: run:
python3 run-clang-format.py --style file -r src wasm python3 run-clang-format.py --style file -r src wasm
- name: Prepare build, compilation database etc.
run: |
mkdir -p build
cd build
cmake \
-DUSE_WASM_COMPATIBLE_SOURCE=off -DCMAKE_EXPORT_COMPILE_COMMANDS=on \
-DCMAKE_C_COMPILER=clang-${{ env.clang_version }} -DCMAKE_CXX_COMPILER=clang++-${{ env.clang_version }} \
..
- name: Run clang-tidy
run: |
run-clang-tidy-${{ env.clang_version }} -p build "$PWD/src/.*"
run-clang-tidy-${{ env.clang_version }} -p build "$PWD/app/.*"