diff --git a/src/caosdb/configuration.cpp b/src/caosdb/configuration.cpp index eb5465967d2703f5536f9ca3116e695972fabdcc..6cdd04c2a2d05bc1082821b24af18f48899f87b5 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 abc797fbe97fb408e0ff05ea5deab2a8581f194a..3c047850e82da2a30039cc0c46361542284af38b 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 7c2efab9566d58c709c060e4206fc0d193ac75df..6c5fa0b58f224233a1826d7605a8c94e8270a7e9 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 d604c53e1c27055a2eaf5652dc34c49eacba4731..e34e073f1d0245fe27d1d3d5beb0a72e6aabc048 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 9dc957a2f85cd95ce3ead5f59ab8c10868582003..61b85c89ae1fc1f5ee0a101ff4f8b4438275648f 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 ab1979f7e455d8b1b9fd7e8d672bd1b8ab1f5775..6f27f6159a17dbb7de24205c4796c2048f5fc308 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 eec62641af4b2c704ad121cf83d3450cafc5aa2a..cb6021dc631c90b49ab8c3538f2b09fcc47723a3 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