mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 00:53:59 +00:00
Enable clang tidy in CI (#314)
* add clang tidy check * test * check * check * test * check * test * header filter * fix header filter * check * check * check * recheck * re-check * undo removing ci
This commit is contained in:
30
.clang-tidy
30
.clang-tidy
@@ -1,19 +1,19 @@
|
||||
Checks: >
|
||||
-*,
|
||||
bugprone-*,
|
||||
google-*,
|
||||
misc-*,
|
||||
modernize-*,
|
||||
performance-*,
|
||||
portability-*,
|
||||
readability-*,
|
||||
-google-readability-namespace-comments,
|
||||
-google-runtime-int,
|
||||
-google-runtime-references,
|
||||
*,
|
||||
-abseil-*,
|
||||
-altera-*,
|
||||
-cppcoreguidelines-avoid-goto,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-fuchsia-*,
|
||||
-hicpp-*,
|
||||
-llvm-*,
|
||||
-llvmlibc-*,
|
||||
-misc-non-private-member-variables-in-classes,
|
||||
-readability-named-parameter,
|
||||
-readability-braces-around-statements,
|
||||
-readability-magic-numbers
|
||||
-modernize-*,
|
||||
-readability-function-cognitive-complexity,
|
||||
-readability-identifier-length
|
||||
|
||||
# Turn all the warnings from the checks above into errors.
|
||||
WarningsAsErrors: ""
|
||||
HeaderFilterRegex: '.*/include/inja/.*\.hpp$'
|
||||
UseColor: true
|
||||
WarningsAsErrors: ''
|
||||
|
||||
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -19,6 +19,11 @@ jobs:
|
||||
os: ubuntu-22.04
|
||||
compiler: clang
|
||||
|
||||
- name: ubuntu-22.04-clang-tidy
|
||||
os: ubuntu-22.04
|
||||
compiler: clang
|
||||
cmake_vars: "-DINJA_ENABLE_CLANG_TIDY=ON"
|
||||
|
||||
- name: ubuntu-22.04-clang-15-no-exceptions
|
||||
os: ubuntu-22.04
|
||||
compiler: clang-15
|
||||
@@ -56,7 +61,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Cpp
|
||||
uses: aminya/setup-cpp@v0.44.0
|
||||
uses: aminya/setup-cpp@v0.46.1
|
||||
with:
|
||||
compiler: ${{ matrix.compiler }}
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ cmake_policy(SET CMP0077 NEW)
|
||||
project(inja LANGUAGES CXX VERSION 3.4.0)
|
||||
|
||||
|
||||
option(INJA_USE_EMBEDDED_JSON "Use the shipped json header if not available on the system" ON)
|
||||
option(BUILD_TESTING "Build unit tests" ON)
|
||||
option(COVERALLS "Generate coveralls data" OFF)
|
||||
option(INJA_BUILD_TESTS "Build unit tests when BUILD_TESTING is enabled." ON)
|
||||
option(INJA_ENABLE_CLANG_TIDY "Enable clang-tidy" OFF)
|
||||
option(INJA_EXPORT "Export the current build tree to the package registry" ON)
|
||||
option(INJA_INSTALL "Generate install targets for inja" ON)
|
||||
option(INJA_INSTALL_SINGLE_HEADER "Install the single header instead" OFF)
|
||||
option(INJA_EXPORT "Export the current build tree to the package registry" ON)
|
||||
option(BUILD_TESTING "Build unit tests" ON)
|
||||
option(INJA_BUILD_TESTS "Build unit tests when BUILD_TESTING is enabled." ON)
|
||||
option(COVERALLS "Generate coveralls data" OFF)
|
||||
option(INJA_USE_EMBEDDED_JSON "Use the shipped json header if not available on the system" ON)
|
||||
|
||||
|
||||
set(INJA_INSTALL_INCLUDE_DIR "include")
|
||||
@@ -94,6 +95,12 @@ if(BUILD_TESTING AND INJA_BUILD_TESTS)
|
||||
target_compile_options(inja_test PRIVATE -Wall -Wextra -Werror)
|
||||
endif()
|
||||
|
||||
if(INJA_ENABLE_CLANG_TIDY)
|
||||
find_program(CLANG_TIDY_EXE NAMES "clang-tidy" REQUIRED)
|
||||
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "-config-file=${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy")
|
||||
set_target_properties(inja_test PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
|
||||
endif()
|
||||
|
||||
|
||||
add_library(single_inja INTERFACE)
|
||||
target_compile_features(single_inja INTERFACE cxx_std_17)
|
||||
@@ -106,8 +113,7 @@ if(BUILD_TESTING AND INJA_BUILD_TESTS)
|
||||
add_test(single_inja_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/single_inja_test)
|
||||
|
||||
|
||||
add_executable(inja_benchmark test/benchmark.cpp
|
||||
test/test-common.hpp)
|
||||
add_executable(inja_benchmark test/benchmark.cpp test/test-common.hpp)
|
||||
target_link_libraries(inja_benchmark PRIVATE inja)
|
||||
target_include_directories(inja_benchmark PRIVATE third_party/include)
|
||||
endif()
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
clang-tidy test/test.cpp -- -Iinclude -Ithird_party/include
|
||||
Reference in New Issue
Block a user