From 5fec463bf67d7ec11d13fda48d82db5e9b8fd70e Mon Sep 17 00:00:00 2001
From: Joscha Schmiedt <joscha@schmiedt.dev>
Date: Wed, 18 Sep 2024 18:14:29 +0200
Subject: [PATCH] STY: auto-format with clang-format-16

---
 include/linkahead/authentication.h     |  4 ++--
 include/linkahead/configuration.h      | 14 +++++++-------
 include/linkahead/connection.h         |  4 ++--
 include/linkahead/entity.h             | 24 ++++++++++++------------
 include/linkahead/info.h               |  2 +-
 include/linkahead/logging.h            |  2 +-
 include/linkahead/transaction.h        |  8 ++++----
 include/linkahead/transaction_status.h |  8 ++++----
 include/linkahead/utility.h            |  4 ++--
 include/linkahead/value.h              |  4 ++--
 src/linkahead/acm/user.cpp             |  4 ++--
 src/linkahead/acm/user_impl.h          |  2 +-
 src/linkahead/authentication.cpp       |  9 +++++----
 src/linkahead/result_table_impl.h      |  4 ++--
 src/linkahead/transaction.cpp          | 12 +++++++-----
 test/test_entity.cpp                   |  6 ++++--
 16 files changed, 58 insertions(+), 53 deletions(-)

diff --git a/include/linkahead/authentication.h b/include/linkahead/authentication.h
index c09fe42..2770bcf 100644
--- a/include/linkahead/authentication.h
+++ b/include/linkahead/authentication.h
@@ -51,8 +51,8 @@ using linkahead::utility::base64_encode;
 class Authenticator {
 public:
   virtual ~Authenticator() = default;
-  [[nodiscard]] virtual auto
-  GetCallCredentials() const -> std::shared_ptr<grpc::CallCredentials> = 0;
+  [[nodiscard]] virtual auto GetCallCredentials() const
+    -> std::shared_ptr<grpc::CallCredentials> = 0;
 };
 
 /**
diff --git a/include/linkahead/configuration.h b/include/linkahead/configuration.h
index d86658a..bdb87fd 100644
--- a/include/linkahead/configuration.h
+++ b/include/linkahead/configuration.h
@@ -58,8 +58,8 @@ private:
 public:
   ConnectionConfiguration(std::string host, int port);
   virtual ~ConnectionConfiguration() = default;
-  friend auto operator<<(std::ostream &out,
-                         const ConnectionConfiguration &configuration) -> std::ostream &;
+  friend auto operator<<(std::ostream &out, const ConnectionConfiguration &configuration)
+    -> std::ostream &;
 
   [[nodiscard]] auto virtual ToString() const -> std::string = 0;
   [[nodiscard]] auto GetHost() const -> std::string;
@@ -125,16 +125,16 @@ public:
   /**
    * See mGetConnectionConfiguration.
    */
-  inline static auto
-  GetConnectionConfiguration(const std::string &name) -> std::unique_ptr<ConnectionConfiguration> {
+  inline static auto GetConnectionConfiguration(const std::string &name)
+    -> std::unique_ptr<ConnectionConfiguration> {
     return GetInstance().mGetConnectionConfiguration(name);
   }
 
   /**
    * Return the ConnectionConfiguration for the default connection.
    */
-  inline static auto
-  GetDefaultConnectionConfiguration() -> std::unique_ptr<ConnectionConfiguration> {
+  inline static auto GetDefaultConnectionConfiguration()
+    -> std::unique_ptr<ConnectionConfiguration> {
     return GetInstance().mGetConnectionConfiguration(GetInstance().mGetDefaultConnectionName());
   }
 
@@ -156,7 +156,7 @@ private:
   static ConfigurationManager mInstance;
 
   inline ConfigurationManager() noexcept
-    : json_configuration(nullptr) {
+    : json_configuration(nullptr){
         // InitializeDefaults();
       };
 
diff --git a/include/linkahead/connection.h b/include/linkahead/connection.h
index f3c5564..1f47a42 100644
--- a/include/linkahead/connection.h
+++ b/include/linkahead/connection.h
@@ -111,8 +111,8 @@ public:
    */
   // TODO(tf) find a way to deal with this:
   // NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
-  [[nodiscard]] auto RetrieveSingleUser(const std::string &realm,
-                                        const std::string &name) const -> User;
+  [[nodiscard]] auto RetrieveSingleUser(const std::string &realm, const std::string &name) const
+    -> User;
 
   /**
    * Create a new user.
diff --git a/include/linkahead/entity.h b/include/linkahead/entity.h
index e4dae82..fd08014 100644
--- a/include/linkahead/entity.h
+++ b/include/linkahead/entity.h
@@ -157,7 +157,7 @@ public:
 
   friend class Entity;
 
-  virtual ~RepeatedPtrFieldWrapper() {};
+  virtual ~RepeatedPtrFieldWrapper(){};
 
   inline auto ToString() const noexcept -> const std::string override {
     if (this->size() == 0) {
@@ -202,7 +202,7 @@ public:
   }
 
 protected:
-  RepeatedPtrFieldWrapper() : ProtoMessageWrapper<RepeatedPtrField<P>>() {};
+  RepeatedPtrFieldWrapper() : ProtoMessageWrapper<RepeatedPtrField<P>>(){};
   explicit inline RepeatedPtrFieldWrapper(RepeatedPtrField<P> *wrapped)
     : ProtoMessageWrapper<RepeatedPtrField<P>>(wrapped) {}
 
@@ -349,7 +349,7 @@ public:
 
 private:
   explicit inline Message(ProtoMessage *wrapped)
-    : ScalarProtoMessageWrapper<ProtoMessage>(wrapped) {};
+    : ScalarProtoMessageWrapper<ProtoMessage>(wrapped){};
 };
 
 /**
@@ -363,7 +363,7 @@ public:
   // friend class Property;
 
 private:
-  inline Messages() : RepeatedPtrFieldWrapper<Message, ProtoMessage>() {};
+  inline Messages() : RepeatedPtrFieldWrapper<Message, ProtoMessage>(){};
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -378,8 +378,8 @@ private:
  */
 class Parent : public ScalarProtoMessageWrapper<ProtoParent> {
 public:
-  explicit inline Parent(ProtoParent *wrapped) : ScalarProtoMessageWrapper<ProtoParent>(wrapped) {};
-  Parent() : ScalarProtoMessageWrapper<ProtoParent>() {};
+  explicit inline Parent(ProtoParent *wrapped) : ScalarProtoMessageWrapper<ProtoParent>(wrapped){};
+  Parent() : ScalarProtoMessageWrapper<ProtoParent>(){};
   ~Parent() = default;
 
   /**
@@ -481,9 +481,9 @@ public:
   friend class Entity;
 
 private:
-  inline Parents() : RepeatedPtrFieldWrapper<Parent, ProtoParent>() {};
+  inline Parents() : RepeatedPtrFieldWrapper<Parent, ProtoParent>(){};
   explicit inline Parents(::google::protobuf::RepeatedPtrField<caosdb::entity::v1::Parent> *wrapped)
-    : RepeatedPtrFieldWrapper<Parent, ProtoParent>(wrapped) {};
+    : RepeatedPtrFieldWrapper<Parent, ProtoParent>(wrapped){};
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -522,10 +522,10 @@ public:
       value(this->wrapped->has_value() ? this->wrapped->mutable_value()
                                        : static_cast<ProtoValue *>(nullptr)),
       data_type(this->wrapped->has_data_type() ? this->wrapped->mutable_data_type()
-                                               : static_cast<ProtoDataType *>(nullptr)) {};
+                                               : static_cast<ProtoDataType *>(nullptr)){};
   inline Property()
     : ScalarProtoMessageWrapper<ProtoProperty>(), value(static_cast<ProtoValue *>(nullptr)),
-      data_type(static_cast<ProtoDataType *>(nullptr)) {};
+      data_type(static_cast<ProtoDataType *>(nullptr)){};
 
   ~Property() = default;
 
@@ -666,9 +666,9 @@ public:
   friend class Entity;
 
 private:
-  inline Properties() {};
+  inline Properties(){};
   explicit inline Properties(RepeatedPtrField<ProtoProperty> *wrapped)
-    : RepeatedPtrFieldWrapper<Property, ProtoProperty>(wrapped) {};
+    : RepeatedPtrFieldWrapper<Property, ProtoProperty>(wrapped){};
 };
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/include/linkahead/info.h b/include/linkahead/info.h
index be613b2..237564a 100644
--- a/include/linkahead/info.h
+++ b/include/linkahead/info.h
@@ -53,7 +53,7 @@ public:
    * LinkAheadConnection::GetVersionInfo() instead to get the version of the
    * server behind the given connection.
    */
-  explicit inline VersionInfo(ProtoVersionInfo *info) : info(info) {};
+  explicit inline VersionInfo(ProtoVersionInfo *info) : info(info){};
   [[nodiscard]] inline auto GetMajor() const -> int32_t { return this->info->major(); }
   [[nodiscard]] inline auto GetMinor() const -> int32_t { return this->info->minor(); }
   [[nodiscard]] inline auto GetPatch() const -> int32_t { return this->info->patch(); }
diff --git a/include/linkahead/logging.h b/include/linkahead/logging.h
index 3bafc93..3b70c1a 100644
--- a/include/linkahead/logging.h
+++ b/include/linkahead/logging.h
@@ -88,7 +88,7 @@ private:
  */
 class LevelConfiguration {
 public:
-  LevelConfiguration(int level) : level(level) {};
+  LevelConfiguration(int level) : level(level){};
   [[nodiscard]] inline auto GetLevel() const -> int { return this->level; }
 
 private:
diff --git a/include/linkahead/transaction.h b/include/linkahead/transaction.h
index 19becfc..84e7829 100644
--- a/include/linkahead/transaction.h
+++ b/include/linkahead/transaction.h
@@ -226,8 +226,8 @@ public:
    * If the file cannot be downloaded due to unsufficient permissions an error
    * is appended.
    */
-  auto RetrieveAndDownloadFileById(const std::string &id,
-                                   const std::string &local_path) noexcept -> StatusCode;
+  auto RetrieveAndDownloadFileById(const std::string &id, const std::string &local_path) noexcept
+    -> StatusCode;
 
   /**
    * Add an entity id to this transaction for retrieval.
@@ -479,8 +479,8 @@ private:
 };
 
 template <class InputIterator>
-inline auto Transaction::RetrieveById(InputIterator begin,
-                                      InputIterator end) noexcept -> StatusCode {
+inline auto Transaction::RetrieveById(InputIterator begin, InputIterator end) noexcept
+  -> StatusCode {
   ASSERT_CAN_ADD_RETRIEVAL
 
   auto next = begin;
diff --git a/include/linkahead/transaction_status.h b/include/linkahead/transaction_status.h
index 83d53dd..6ef62a9 100644
--- a/include/linkahead/transaction_status.h
+++ b/include/linkahead/transaction_status.h
@@ -40,7 +40,7 @@ using linkahead::exceptions::TransactionTypeError;
  * Define static factory method in the TransactionStatus class.
  */
 #define LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(_StatusName, _StatusCode)                     \
-  inline static auto _StatusName() -> const TransactionStatus & {                                  \
+  inline static auto _StatusName()->const TransactionStatus & {                                    \
     static const TransactionStatus instance(_StatusCode,                                           \
                                             linkahead::get_status_description(_StatusCode));       \
     return instance;                                                                               \
@@ -194,8 +194,8 @@ public:
     TransactionStatus::ThrowExceptionIfError(this->code, this->description);
   }
 
-  inline static auto ThrowExceptionIfError(StatusCode code,
-                                           const std::string &description) -> void {
+  inline static auto ThrowExceptionIfError(StatusCode code, const std::string &description)
+    -> void {
     if (!IsError(code)) {
       return;
     }
@@ -243,7 +243,7 @@ public:
   inline auto GetCode() const -> StatusCode { return this->code; }
 
   TransactionStatus(StatusCode code, const std::string &description)
-    : code(code), description(description) {};
+    : code(code), description(description){};
 
 private:
   /**
diff --git a/include/linkahead/utility.h b/include/linkahead/utility.h
index faaabe6..1b739d7 100644
--- a/include/linkahead/utility.h
+++ b/include/linkahead/utility.h
@@ -88,8 +88,8 @@ inline auto get_env_fallback(const char *key, const char *fallback) -> const cha
  * @brief Return the value of an environment variable or - if undefined - the
  * fallback value.
  */
-inline auto get_env_fallback(const std::string &key,
-                             const std::string &fallback) -> const std::string {
+inline auto get_env_fallback(const std::string &key, const std::string &fallback)
+  -> const std::string {
   const char *val = get_env_fallback(key.c_str(), fallback.c_str());
 
   auto const result = std::string(val);
diff --git a/include/linkahead/value.h b/include/linkahead/value.h
index d87f504..78407a3 100644
--- a/include/linkahead/value.h
+++ b/include/linkahead/value.h
@@ -170,7 +170,7 @@ public:
   /**
    * Destructor.
    */
-  inline ~ScalarValue() {};
+  inline ~ScalarValue(){};
   /**
    * Copy constructor.
    */
@@ -180,7 +180,7 @@ public:
   /**
    * Move constructor.
    */
-  inline ScalarValue(ScalarValue &&other) : ScalarValue(std::move(other.wrapped)) {};
+  inline ScalarValue(ScalarValue &&other) : ScalarValue(std::move(other.wrapped)){};
   /**
    * Copy assignment operator.
    */
diff --git a/src/linkahead/acm/user.cpp b/src/linkahead/acm/user.cpp
index 392c7e6..39c88f1 100644
--- a/src/linkahead/acm/user.cpp
+++ b/src/linkahead/acm/user.cpp
@@ -19,9 +19,9 @@
  *
  */
 #include "linkahead/acm/user.h"
-#include "linkahead/acm/user_impl.h"        // for UserImpl
+#include "linkahead/acm/user_impl.h"     // for UserImpl
 #include "caosdb/acm/v1alpha1/main.pb.h" // for ProtoUser
-#include "linkahead/protobuf_helper.h"      // for ProtoMessageWrapper
+#include "linkahead/protobuf_helper.h"   // for ProtoMessageWrapper
 #include <utility>                       // for move
 
 namespace linkahead::acm {
diff --git a/src/linkahead/acm/user_impl.h b/src/linkahead/acm/user_impl.h
index 5cbe1ab..3ba072f 100644
--- a/src/linkahead/acm/user_impl.h
+++ b/src/linkahead/acm/user_impl.h
@@ -20,7 +20,7 @@
  */
 #include "linkahead/acm/user.h"
 #include "caosdb/acm/v1alpha1/main.pb.h" // for ProtoUser
-#include "linkahead/protobuf_helper.h"      // for ProtoMessageWrapper
+#include "linkahead/protobuf_helper.h"   // for ProtoMessageWrapper
 #include <memory>                        // for unique_ptr
 #include <utility>                       // for move
 
diff --git a/src/linkahead/authentication.cpp b/src/linkahead/authentication.cpp
index feafae4..bebe747 100644
--- a/src/linkahead/authentication.cpp
+++ b/src/linkahead/authentication.cpp
@@ -38,10 +38,11 @@ using linkahead::utility::base64_encode;
 MetadataCredentialsPluginImpl::MetadataCredentialsPluginImpl(std::string key, std::string value)
   : key(std::move(key)), value(std::move(value)) {}
 
-auto MetadataCredentialsPluginImpl::GetMetadata(
-  string_ref /*service_url*/, string_ref /*method_name*/,
-  const AuthContext & /*channel_auth_context*/,
-  std::multimap<grpc::string, grpc::string> *metadata) -> Status {
+auto MetadataCredentialsPluginImpl::GetMetadata(string_ref /*service_url*/,
+                                                string_ref /*method_name*/,
+                                                const AuthContext & /*channel_auth_context*/,
+                                                std::multimap<grpc::string, grpc::string> *metadata)
+  -> Status {
 
   metadata->insert(std::make_pair(this->key, this->value));
   return Status::OK;
diff --git a/src/linkahead/result_table_impl.h b/src/linkahead/result_table_impl.h
index 9c68fc1..62d7fa1 100644
--- a/src/linkahead/result_table_impl.h
+++ b/src/linkahead/result_table_impl.h
@@ -76,8 +76,8 @@ class ResultTableImpl : public ScalarProtoMessageWrapper<ProtoSelectQueryResult>
   friend class ResultTable;
   friend class ResultTable::HeaderIterator;
   friend class ResultTableColumn;
-  friend auto
-  ProcessSelectResponse(ProtoSelectQueryResult *select_result) -> std::unique_ptr<ResultTable>;
+  friend auto ProcessSelectResponse(ProtoSelectQueryResult *select_result)
+    -> std::unique_ptr<ResultTable>;
 };
 
 } // namespace linkahead::transaction
diff --git a/src/linkahead/transaction.cpp b/src/linkahead/transaction.cpp
index 7abd06e..5fafb34 100644
--- a/src/linkahead/transaction.cpp
+++ b/src/linkahead/transaction.cpp
@@ -75,8 +75,9 @@ auto Transaction::RetrieveById(const std::string &id) noexcept -> StatusCode {
   return this->status.GetCode();
 }
 
-auto Transaction::RetrieveAndDownloadFileById(
-  const std::string &id, const std::string &local_path) noexcept -> StatusCode {
+auto Transaction::RetrieveAndDownloadFileById(const std::string &id,
+                                              const std::string &local_path) noexcept
+  -> StatusCode {
   ASSERT_CAN_ADD_RETRIEVAL
 
   auto *retrieve_request = this->request->add_requests()->mutable_retrieve_request();
@@ -293,9 +294,10 @@ auto ProcessSelectResponse(ProtoSelectQueryResult *select_result) -> std::unique
   return ResultTableImpl::create(select_result);
 }
 
-auto Transaction::ProcessRetrieveResponse(
-  RetrieveResponse *retrieve_response, std::vector<std::unique_ptr<Entity>> *entities,
-  bool *set_error) const noexcept -> std::unique_ptr<Entity> {
+auto Transaction::ProcessRetrieveResponse(RetrieveResponse *retrieve_response,
+                                          std::vector<std::unique_ptr<Entity>> *entities,
+                                          bool *set_error) const noexcept
+  -> std::unique_ptr<Entity> {
   std::unique_ptr<Entity> result;
   switch (retrieve_response->retrieve_response_case()) {
   case RetrieveResponseCase::kEntityResponse: {
diff --git a/test/test_entity.cpp b/test/test_entity.cpp
index 857e662..3eab1a7 100644
--- a/test/test_entity.cpp
+++ b/test/test_entity.cpp
@@ -737,11 +737,13 @@ TEST(test_entity, test_remove_property) {
   entity.AppendProperty(property10);
   ASSERT_EQ(entity.GetProperties().size(), 9);
 
-  std::cout << "[" << "\n";
+  std::cout << "["
+            << "\n";
   for (int i = 0; i < 9; i++) {
     std::cout << "  " << entity.GetProperties().at(i).GetName() << ",\n";
   }
-  std::cout << "]" << "\n";
+  std::cout << "]"
+            << "\n";
 
   for (int i = 0; i < 3; i++) {
     auto name = "PROPERTY-" + std::to_string(i);
-- 
GitLab