diff --git a/.github/workflows/keyvi.yml b/.github/workflows/keyvi.yml index 2024dd91a..945dc2016 100644 --- a/.github/workflows/keyvi.yml +++ b/.github/workflows/keyvi.yml @@ -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: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 8076362d7..cc00d911b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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/") diff --git a/keyvi/.clang-tidy b/keyvi/.clang-tidy new file mode 100644 index 000000000..994895618 --- /dev/null +++ b/keyvi/.clang-tidy @@ -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 diff --git a/keyvi/tests/.clang-tidy b/keyvi/tests/.clang-tidy new file mode 100644 index 000000000..2978af83b --- /dev/null +++ b/keyvi/tests/.clang-tidy @@ -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, +" \ No newline at end of file