Skip to content

Commit

Permalink
add clang-tidy checks (#307)
Browse files Browse the repository at this point in the history
add some basic clang-tidy checks
  • Loading branch information
hendrikmuhs authored Jun 28, 2024
1 parent fa79e10 commit 57243dd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/keyvi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev clang-tidy
- name: install macOS deps
if: runner.os == 'macOS'
run: |
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ if (CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
endif()

#### Linting
find_program(CLANGTIDY clang-tidy)
if(CLANGTIDY)
message ("-- Found clang-tidy")
set(CMAKE_CXX_CLANG_TIDY clang-tidy; --extra-arg-before=-std=c++17)
else()
message ("-- clang-tidy not found")
endif()

#### Cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")

Expand Down
18 changes: 18 additions & 0 deletions keyvi/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
Checks: "*,
-abseil-*,
-altera-*,
-android-*,
-fuchsia-*,
-google-*,
-llvm*,
-modernize-use-trailing-return-type,
-zircon-*,
-readability-else-after-return,
-readability-static-accessed-through-instance,
-readability-avoid-const-params-in-decls,
-cppcoreguidelines-non-private-member-variables-in-classes,
-misc-non-private-member-variables-in-classes,
"
HeaderFilterRegex: ''
FormatStyle: none
9 changes: 9 additions & 0 deletions keyvi/tests/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# be less strict for tests
InheritParentConfig: true
Checks: "-cppcoreguidelines-avoid-magic-numbers,
-readability-function-cognitive-complexity,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-magic-numbers,
"

0 comments on commit 57243dd

Please sign in to comment.