diff --git a/CMakeLists.txt b/CMakeLists.txt index de1c33a3ddb234071603bf5b7f4c36b6524a3f90..b5b4f6c6a56033fa1e951907cfb90e67a41c1131 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,8 +23,7 @@ if(NOT clang_tidy) message(STATUS "clang-tidy: Not found") else() message(STATUS "clang-tidy: ${clang_tidy}") - set(CMAKE_C_CLANG_TIDY "${clang_tidy}" "--header-filter=." "--checks=*" "--warnings-as-errors=*") - set(CMAKE_CXX_CLANG_TIDY "${clang_tidy}" "--header-filter=." "--checks=*" "--warnings-as-errors=*") + set(CMAKE_C_CLANG_TIDY "${clang_tidy}" "--header-filter=." "--checks=*,-llvm-include-order,-llvmlibc-restrict-system-libc-headers" "--warnings-as-errors=*") endif() add_subdirectory(src) diff --git a/include/connection.h b/include/connection.h index 0c36e48e3aae74477975424c6dece046a92e9df0..fb0c6c6d74806f42c380cea3f935867998145339 100644 --- a/include/connection.h +++ b/include/connection.h @@ -1,3 +1,5 @@ +#ifndef CONNECTION_H +#define CONNECTION_H /** * @file connection.h * @author Timm Fitschen @@ -12,3 +14,4 @@ * @return 0 if everything is ok. */ int configure_connection(char host[], int port); +#endif diff --git a/include/libcaosdbConfig.h.in b/include/libcaosdbConfig.h.in index 2abf00b7d0bd9ceb3316f1d12d904faa4d720a19..de099a6773c3fd36c378f5ad79351ad7ee38163b 100644 --- a/include/libcaosdbConfig.h.in +++ b/include/libcaosdbConfig.h.in @@ -1,5 +1,8 @@ +#ifndef LIBCAOSDBCONFIG_H +#define LIBCAOSDBCONFIG_H // clang-format off #define LIBCAOSDB_VERSION_MAJOR @libcaosdb_VERSION_MAJOR@ #define LIBCAOSDB_VERSION_MINOR @libcaosdb_VERSION_MINOR@ #define LIBCAOSDB_VERSION_PATCH @libcaosdb_VERSION_PATCH@ // clang-format on +#endif diff --git a/src/caosdbcli.c b/src/caosdbcli.c index fc10c4574868698344cb0791fb8c916ba06372e0..2d147f937e83387b4193bcbe23726671a242e6c3 100644 --- a/src/caosdbcli.c +++ b/src/caosdbcli.c @@ -9,6 +9,7 @@ int main(void) { LIBCAOSDB_VERSION_MINOR, LIBCAOSDB_VERSION_PATCH); printf("We don't miss the H of caos.\n"); + // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers) configure_connection("localhost", 8080); return 0; diff --git a/src/connection.c b/src/connection.c index 5c8ea1ef516f7ef6cc7465119bfcd05120cb448c..d8bef694c30ce40cdb31f201900d261e93a816e5 100644 --- a/src/connection.c +++ b/src/connection.c @@ -2,8 +2,9 @@ #include <stdio.h> int configure_connection(char host[], int port) { + // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers) if (port > 666 && port < 668) { - printf("667 - One step ahead of the Devil!"); + printf("667 - One step ahead of the Devil!"); } printf("Configure connection: %s:%d\n", host, port); return 0; diff --git a/test/test_connection.c b/test/test_connection.c index 8ee7520bfb3537d31e5be8ca722d94dc630cae26..80ae6b2a84c0108d3f886328fcc78db74d3c2521 100644 --- a/test/test_connection.c +++ b/test/test_connection.c @@ -1,9 +1,10 @@ -#include <setjmp.h> -#include <stdarg.h> +#include "connection.h" +#include <setjmp.h> // IWYU pragma: keep +#include <stdarg.h> // IWYU pragma: keep #include <stddef.h> #include <cmocka.h> -#include "connection.h" +// NOLINTNEXTLINE(misc-unused-parameters) static void test_configure_connection(void **state) { assert_int_equal(0, configure_connection("localhost", 8080)); }