Skip to content

Commit f673b64

Browse files
committed
chore: integrate clang-tidy for static code analysis via CMake and CI workflows
1 parent 37407e8 commit f673b64

3 files changed

Lines changed: 34 additions & 5 deletions

File tree

.clang-tidy

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .clang-tidy
2+
---
3+
Checks: >
4+
-*,
5+
bugprone-*,
6+
clang-analyzer-*,
7+
misc-*,
8+
modernize-*,
9+
performance-*,
10+
portability-*,
11+
readability-*
12+
13+
# Ensure we do not lint vendored dependency headers or test files with strict guidelines
14+
HeaderFilterRegex: '^src/(class|hydration|sha256)\.h$'
15+
16+
WarningsAsErrors: >
17+
bugprone-*,
18+
clang-analyzer-*,
19+
performance-*,
20+
portability-*

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
if: matrix.os == 'ubuntu-latest'
3838
run: |
3939
sudo apt-get update
40-
sudo apt-get install -y libcurl4-openssl-dev
40+
sudo apt-get install -y libcurl4-openssl-dev clang-tidy
4141
4242
- name: Install Dependencies (Windows)
4343
if: matrix.os == 'windows-latest'
@@ -74,7 +74,7 @@ jobs:
7474
- os: ubuntu-latest
7575
install-deps: |
7676
sudo apt-get update
77-
sudo apt-get install -y libcurl4-openssl-dev
77+
sudo apt-get install -y libcurl4-openssl-dev clang-tidy
7878
- os: macos-latest
7979
install-deps: |
8080
brew install curl
@@ -163,7 +163,7 @@ jobs:
163163
- name: Install Dependencies
164164
run: |
165165
sudo apt-get update
166-
sudo apt-get install -y libcurl4-openssl-dev
166+
sudo apt-get install -y libcurl4-openssl-dev clang-tidy
167167
168168
- name: Configure CMake
169169
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DARKILIAN_BUILD_EXAMPLES=ON
@@ -187,7 +187,7 @@ jobs:
187187
- name: Install Dependencies
188188
run: |
189189
sudo apt-get update
190-
sudo apt-get install -y libcurl4-openssl-dev
190+
sudo apt-get install -y libcurl4-openssl-dev clang-tidy
191191
192192
- name: Configure (ASAN + UBSAN, tests ON)
193193
run: |
@@ -218,7 +218,7 @@ jobs:
218218
- name: Install Dependencies
219219
run: |
220220
sudo apt-get update
221-
sudo apt-get install -y libcurl4-openssl-dev
221+
sudo apt-get install -y libcurl4-openssl-dev clang-tidy
222222
223223
- name: Configure (TSAN, tests ON)
224224
run: |

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ option(ARKILIAN_BUILD_STATIC "Build static library for embedded use" ON)
2020
option(ARKILIAN_BUILD_EXAMPLES "Build example programs" ON)
2121
option(ARKILIAN_BUILD_TESTS "Build test programs" OFF)
2222

23+
# Find clang-tidy for static code analysis
24+
find_program(CLANG_TIDY_EXE NAMES clang-tidy)
25+
if(CLANG_TIDY_EXE)
26+
message(STATUS "Found clang-tidy: ${CLANG_TIDY_EXE}")
27+
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}")
28+
else()
29+
message(WARNING "clang-tidy not found. Static code analysis will be skipped.")
30+
endif()
31+
2332
# Find CURL
2433
find_package(CURL REQUIRED)
2534

0 commit comments

Comments
 (0)