Skip to content

Commit bad57d3

Browse files
committed
Add clang-tidy job/script
Add GithubActions job and script which compiles and checks clang-tidy with minimal set of tidy configs Relates-To: OCMAM-143 Signed-off-by: Yaroslav Stefinko <ext-yaroslav.stefinko@here.com>
1 parent 6363d4f commit bad57d3

3 files changed

Lines changed: 82 additions & 0 deletions

File tree

‎.clang-tidy‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Checks: 'boost-*,bugprone-*,clang-diagnostic*,cppcoreguidelines-*,modernize-*,misc-*,performance-*,readability-*,-bugprone-easily-swappable-parameters,-cppcoreguidelines-avoid-do-while,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-vararg,-modernize-use-trailing-return-type,-misc-include-cleaner,-misc-non-private-member-variables-in-classes'
2+
Checks: 'cppcoreguidelines-*'
3+
WarningsAsErrors: '*'
4+
HeaderFilterRegex: '.*\/(olp-cpp-sdk-core|olp-cpp-sdk-authentication|olp-cpp-sdk-dataservice-read|olp-cpp-sdk-dataservice-write)\/.*'
5+
FormatStyle: 'file'
6+
CheckOptions:
7+
- key: readability-function-cognitive-complexity.IgnoreMacros
8+
value: true
9+
- key: readability-identifier-naming.ClassCase
10+
value: CamelCase
11+
- key: readability-identifier-naming.MethodCase
12+
value: CamelCase
13+
- key: readability-identifier-naming.MemberCase
14+
value: lower_case
15+
- key: readability-identifier-naming.PrivateMemberSuffix
16+
value: _
17+
- key: readability-identifier-naming.ProtectedMemberSuffix
18+
value: _
19+
- key: readability-identifier-naming.FunctionCase
20+
value: CamelCase
21+
- key: readability-identifier-naming.ConstexprVariableCase
22+
value: CamelCase
23+
- key: readability-identifier-naming.ConstexprVariablePrefix
24+
value: k
25+
- key: readability-identifier-naming.StaticConstantCase
26+
value: CamelCase
27+
- key: readability-identifier-naming.StaticConstantPrefix
28+
value: k
29+
- key: readability-identifier-naming.GlobalConstantCase
30+
value: CamelCase
31+
- key: readability-identifier-naming.GlobalConstantPrefix
32+
value: k
33+
- key: readability-identifier-naming.EnumConstantCase
34+
value: CamelCase
35+
- key: readability-identifier-naming.EnumConstantPrefix
36+
value: k
37+
- key: readability-identifier-naming.ParameterCase
38+
value: lower_case
39+
- key: readability-identifier-naming.VariableCase
40+
value: lower_case

‎.github/workflows/psv_pipelines.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ jobs:
2626
run: ./scripts/misc/cpplint_ci.sh
2727
shell: bash
2828

29+
psv-linux-24-04-clang17-build-clang-tidy:
30+
name: PSV.Linux.24.04.clang17.ClangTidy
31+
if: github.event_name == 'pull_request'
32+
runs-on: ubuntu-24.04
33+
steps:
34+
- name: Check out repository
35+
uses: actions/checkout@v7
36+
- name: Install dependencies
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y \
40+
libboost-all-dev \
41+
libcurl4-openssl-dev
42+
shell: bash
43+
- name: Run clang-tidy
44+
run: ./scripts/misc/clang-tidy-17-check.sh
45+
shell: bash
46+
2947
psv-linux-22-04-gcc9-build-test-codecov:
3048
name: PSV.Linux.22.04.gcc9.Tests.CodeCov
3149
runs-on: ubuntu-22.04
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -ex
2+
3+
BUILD_DIR="build-clang-tidy"
4+
5+
rm -rf "${BUILD_DIR}"
6+
mkdir "${BUILD_DIR}"
7+
8+
cmake -S . -B "${BUILD_DIR}" -G Ninja \
9+
-DCMAKE_BUILD_TYPE=Debug \
10+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
11+
-DCMAKE_CXX_COMPILER=clang++-17 \
12+
-DCMAKE_C_COMPILER=clang-17 \
13+
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \
14+
-DOLP_SDK_ENABLE_TESTING=OFF \
15+
-DOLP_SDK_BUILD_EXAMPLES=OFF
16+
17+
cmake --build "${BUILD_DIR}" -- -j"$(nproc)"
18+
19+
run-clang-tidy-17.py -p "${BUILD_DIR}" \
20+
-config-file="${PWD}/.clang-tidy" \
21+
"${PWD}/olp-cpp-sdk-core/.*" \
22+
"${PWD}/olp-cpp-sdk-authentication/.*" \
23+
"${PWD}/olp-cpp-sdk-dataservice-read/.*" \
24+
"${PWD}/olp-cpp-sdk-dataservice-write/.*"

0 commit comments

Comments
 (0)