From 320bbc1b14be61a289d28f948eae8966c9f085c6 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Wed, 19 May 2021 12:33:49 +0200 Subject: [PATCH] WIP: pipeline --- CMakeLists.txt | 3 +-- include/connection.h | 3 +++ include/libcaosdbConfig.h.in | 3 +++ src/caosdbcli.c | 1 + src/connection.c | 3 ++- test/test_connection.c | 7 ++++--- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de1c33a..b5b4f6c 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 0c36e48..fb0c6c6 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 2abf00b..de099a6 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 fc10c45..2d147f9 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 5c8ea1e..d8bef69 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 8ee7520..80ae6b2 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)); } -- GitLab