diff --git a/.clang-tidy b/.clang-tidy index ad644244..518490b0 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,57 @@ --- -Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-misc-non-private-member-variables-in-classes,-modernize-avoid-c-arrays,-modernize-use-default-member-init,-modernize-use-using,-readability-braces-around-statements,-readability-function-size,-readability-implicit-bool-conversion,-readability-isolate-declaration,-readability-magic-numbers,-readability-simplify-boolean-expr,-readability-uppercase-literal-suffix,-modernize-use-auto,-modernize-use-trailing-return-type,-bugprone-branch-clone,-modernize-pass-by-value,-modernize-loop-convert,-modernize-use-emplace,-modernize-use-equals-default,-performance-noexcept-move-constructor,-modernize-use-equals-delete,-readability-identifier-length,-readability-function-cognitive-complexity,-modernize-return-braced-init-list,-misc-no-recursion,-bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-concurrency-mt-unsafe,-modernize-loop-convert,-clang-analyzer-*,-performance-move-constructor-init,-performance-inefficient-string-concatenation,-performance-no-automatic-move,-modernize-use-override,-misc-use-anonymous-namespace,-modernize-use-nodiscard' +Checks: > + *, + -abseil-*, + -altera-*, + -android-*, + -cert-*, + -clang-analyzer-*, + -cppcoreguidelines-*, + -fuchsia-*, + -google-*, + -hicpp-*, + -linuxkernel-*, + -llvm-*, + -llvmlibc-*, + -mpi-*, + -objc-*, + -openmp-*, + -zircon-*, + -bugprone-branch-clone, + -bugprone-easily-swappable-parameters, + -bugprone-narrowing-conversions, + -bugprone-switch-missing-default-case, + -concurrency-mt-unsafe, + -misc-no-recursion, + -misc-non-private-member-variables-in-classes, + -misc-use-anonymous-namespace, + -modernize-avoid-c-arrays, + -modernize-loop-convert, + -modernize-pass-by-value, + -modernize-return-braced-init-list, + -modernize-use-auto, + -modernize-use-emplace, + -modernize-use-equals-default, + -modernize-use-equals-delete, + -modernize-use-default-member-init, + -modernize-use-nodiscard, + -modernize-use-override, + -modernize-use-trailing-return-type, + -modernize-use-using, + -readability-braces-around-statements, + -readability-function-cognitive-complexity, + -readability-function-size, + -readability-implicit-bool-conversion, + -readability-identifier-length, + -readability-isolate-declaration, + -readability-magic-numbers, + -readability-simplify-boolean-expr, + -readability-uppercase-literal-suffix, + -performance-avoid-endl, + -performance-inefficient-string-concatenation, + -performance-move-constructor-init, + -performance-no-automatic-move, + -performance-noexcept-move-constructor HeaderFilterRegex: '.*' WarningsAsErrors: '*' CheckOptions: diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 84a7c338..4fb98b0f 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -21,15 +21,19 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 16 - sudo apt-get install clang-tidy-16 + sudo ./llvm.sh 17 + sudo apt-get install clang-tidy-17 + + - name: Verify clang-tidy configuration + run: | + clang-tidy-17 --verify-config - name: Prepare CMake run: | cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DDISABLE_CPP03_SYNTAX_CHECK=ON env: - CXX: clang-16 + CXX: clang-17 - name: Clang-Tidy run: | - run-clang-tidy-16 -q -j $(nproc) -p=cmake.output + run-clang-tidy-17 -q -j $(nproc) -p=cmake.output diff --git a/main.cpp b/main.cpp index 7516085f..da66f59e 100644 --- a/main.cpp +++ b/main.cpp @@ -18,9 +18,14 @@ #include "simplecpp.h" +#include +#include #include #include -#include +#include +#include +#include +#include int main(int argc, char **argv) { diff --git a/simplecpp.cpp b/simplecpp.cpp index ced7ab93..48b8c6f1 100755 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -20,11 +20,14 @@ #define SIMPLECPP_WINDOWS #define NOMINMAX #endif + #include "simplecpp.h" #include #include +#include #include +#include #include #include #include @@ -33,13 +36,18 @@ #include // IWYU pragma: keep #include #include +#include +#include +#include #include // IWYU pragma: keep #include #include +#include #if __cplusplus >= 201103L #include #endif #include +#include #ifdef SIMPLECPP_WINDOWS #include @@ -3132,6 +3140,7 @@ static void getLocaltime(struct tm <ime) time_t t; time(&t); #ifndef _WIN32 + // NOLINTNEXTLINE(misc-include-cleaner) - false positive localtime_r(&t, <ime); #else localtime_s(<ime, &t); diff --git a/test.cpp b/test.cpp index 4d38db37..5c7142c0 100644 --- a/test.cpp +++ b/test.cpp @@ -16,11 +16,18 @@ * License along with this library. If not, see . */ +#include "simplecpp.h" + +#include +#include +#include +#include #include -#include +#include #include +#include +#include #include -#include "simplecpp.h" static int numberOfFailedAssertions = 0;