From 7dbabac60051ff9439183cd383461784dcfe114f Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Mon, 2 Aug 2021 11:39:22 +0200
Subject: [PATCH] MAINT: Add a lot of NOLINTs

---
 src/caosdb/configuration.cpp | 4 ++--
 test/test_configuration.cpp  | 7 +++++--
 test/test_connection.cpp     | 3 ++-
 test/test_entity.cpp         | 3 ++-
 test/test_protobuf.cpp       | 6 ++++--
 test/test_transaction.cpp    | 3 ++-
 test/test_utility.cpp        | 4 ++--
 7 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/caosdb/configuration.cpp b/src/caosdb/configuration.cpp
index eb54659..6cdd04c 100644
--- a/src/caosdb/configuration.cpp
+++ b/src/caosdb/configuration.cpp
@@ -468,9 +468,9 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT
 
   // find the configuration file...
   std::unique_ptr<path> configuration_file_path;
-  for (const std::string &configuration_file :
+  for (const char* const &configuration_file :
        caosdb::LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE) {
-    if (configuration_file == "$CAOSDB_CLIENT_CONFIGURATION") {
+    if (strcmp(configuration_file, "$CAOSDB_CLIENT_CONFIGURATION") == 0) {
       // user specified a file via the environment variable
       // TODO(tf) make this thread-secure (concurrency-mt-unsafe)
       const auto *from_env_var =
diff --git a/test/test_configuration.cpp b/test/test_configuration.cpp
index abc797f..3c04785 100644
--- a/test/test_configuration.cpp
+++ b/test/test_configuration.cpp
@@ -38,7 +38,8 @@ protected:
   void TearDown() override { ConfigurationManager::Clear(); }
 };
 
-TEST_F(test_configuration, load_json) {
+// TODO(tf) cogintive complexity > 25 (threshold)
+TEST_F(test_configuration, load_json) { // NOLINT
   ConfigurationManager::LoadSingleJSONConfiguration(TEST_DATA_DIR +
                                                     "/test_caosdb_client.json");
   EXPECT_THROW_MESSAGE(
@@ -52,7 +53,9 @@ TEST_F(test_configuration, load_json) {
   ConfigurationManager::Clear();
 }
 
-TEST_F(test_configuration, get_default_connection_configuration_error) {
+// TODO(tf) cognitive complexity again
+TEST_F(test_configuration,                           // NOLINT
+       get_default_connection_configuration_error) { // NOLINT
   EXPECT_THROW_MESSAGE(ConfigurationManager::GetDefaultConnectionName(),
                        ConfigurationError,
                        "This CaosDB client has not been configured.");
diff --git a/test/test_connection.cpp b/test/test_connection.cpp
index 7c2efab..6c5fa0b 100644
--- a/test/test_connection.cpp
+++ b/test/test_connection.cpp
@@ -65,7 +65,8 @@ TEST_F(test_connection, configure_ssl_localhost_8080) {
   EXPECT_TRUE(sslcc != nullptr);
 }
 
-TEST_F(test_connection, connection_manager_unknown_connection) {
+// TODO(tf) cognitive complexity > 25 (threshold)
+TEST_F(test_connection, connection_manager_unknown_connection) { // NOLINT
   EXPECT_THROW_MESSAGE(ConnectionManager::GetConnection("test"),
                        caosdb::exceptions::UnknownConnectionError,
                        "No connection named 'test' present.");
diff --git a/test/test_entity.cpp b/test/test_entity.cpp
index d604c53..e34e073 100644
--- a/test/test_entity.cpp
+++ b/test/test_entity.cpp
@@ -73,7 +73,8 @@ TEST(test_entity, test_insert_entity) {
   EXPECT_EQ(entity.GetVersionId(), "version_id");
 }
 
-TEST(test_entity, test_from_id_response) {
+// TODO(tf) cognitive complexity > 25 (threshold)
+TEST(test_entity, test_from_id_response) { // NOLINT
   IdResponse idResponse;
   idResponse.set_id("entity_id");
   auto *error = idResponse.add_entity_errors();
diff --git a/test/test_protobuf.cpp b/test/test_protobuf.cpp
index 9dc957a..61b85c8 100644
--- a/test/test_protobuf.cpp
+++ b/test/test_protobuf.cpp
@@ -29,7 +29,8 @@ namespace caosdb {
 using caosdb::entity::v1alpha1::Entity;
 using caosdb::entity::v1alpha1::Message;
 
-TEST(test_protobuf, test_swap_trivial) {
+// TODO(tf) cognitive complexity > 25 (threshold)
+TEST(test_protobuf, test_swap_trivial) { // NOLINT
   Message message_source;
   message_source.set_code(1234);
   message_source.set_description("desc");
@@ -49,7 +50,8 @@ TEST(test_protobuf, test_swap_trivial) {
   EXPECT_EQ(message_destination.description(), "desc");
 }
 
-TEST(test_protobuf, test_swap_nested) {
+// TODO(tf) cognitive complexity again
+TEST(test_protobuf, test_swap_nested) { // NOLINT
   Entity entity_source;
   entity_source.set_id("entity_id");
   auto *version_source = entity_source.mutable_version();
diff --git a/test/test_transaction.cpp b/test/test_transaction.cpp
index ab1979f..6f27f61 100644
--- a/test/test_transaction.cpp
+++ b/test/test_transaction.cpp
@@ -40,7 +40,8 @@ using caosdb::exceptions::ConnectionError;
 using caosdb::transaction::UniqueResult;
 using ProtoEntity = caosdb::entity::v1alpha1::Entity;
 
-TEST(test_transaction, create_transaction) {
+// TODO(tf) cognitive complexity > 25 (threshold)
+TEST(test_transaction, create_transaction) { // NOLINT
   const auto *host = "localhost";
   auto configuration = InsecureConnectionConfiguration(host, 8000);
   Connection connection(configuration);
diff --git a/test/test_utility.cpp b/test/test_utility.cpp
index eec6264..cb6021d 100644
--- a/test/test_utility.cpp
+++ b/test/test_utility.cpp
@@ -20,12 +20,12 @@
  *
  */
 
+#include "gmock/gmock-matchers.h"             // for ElementsAre, EXPECT_THAT
+#include "boost/beast/core/detail/base64.hpp" // for encoded_size
 #include "boost/json/object.hpp"              // for object
 #include "boost/json/value.hpp"               // for value
 #include "caosdb/utility.h"                   // for base64_encode, load_js...
 #include "caosdb_test_utility.h"              // for TEST_DATA_DIR
-#include "gmock/gmock-matchers.h"             // for ElementsAre, EXPECT_THAT
-#include <boost/beast/core/detail/base64.hpp> // for encoded_size
 #include <gtest/gtest-message.h>              // for Message
 #include <gtest/gtest-test-part.h>            // for TestPartResult, SuiteA...
 #include <gtest/gtest_pred_impl.h>            // for Test, EXPECT_EQ, TestInfo
-- 
GitLab