From 8a75657c1a701e977297081097aa6900bd20e878 Mon Sep 17 00:00:00 2001
From: Joscha Schmiedt <joscha@schmiedt.dev>
Date: Sun, 15 Sep 2024 20:38:30 +0200
Subject: [PATCH] STY: auto-format

---
 include/linkahead/authentication.h     |  4 ++--
 include/linkahead/configuration.h      | 15 +++++++--------
 include/linkahead/connection.h         |  6 +++---
 include/linkahead/info.h               |  2 +-
 include/linkahead/logging.h            |  2 +-
 include/linkahead/transaction.h        |  8 ++++----
 include/linkahead/transaction_status.h |  6 +++---
 include/linkahead/utility.h            |  4 ++--
 include/linkahead/value.h              |  4 ++--
 src/linkahead/authentication.cpp       |  9 ++++-----
 src/linkahead/configuration.cpp        |  2 +-
 src/linkahead/connection.cpp           |  5 +----
 src/linkahead/result_table_impl.h      |  4 ++--
 src/linkahead/transaction.cpp          | 12 +++++-------
 test/test_file_transmission.cpp        |  4 ++--
 15 files changed, 40 insertions(+), 47 deletions(-)

diff --git a/include/linkahead/authentication.h b/include/linkahead/authentication.h
index d4596ae..1f2ffa8 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 a25727d..90378d1 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;
@@ -104,7 +104,6 @@ public:
 class ConfigurationManager {
 public:
   static ConfigurationManager &GetInstance();
-  ;
 
   /**
    * See mReset.
@@ -126,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());
   }
 
@@ -157,7 +156,7 @@ private:
   static ConfigurationManager mInstance;
 
   inline ConfigurationManager()
-    : json_configuration(nullptr){
+    : json_configuration(nullptr) {
         // InitializeDefaults();
       };
 
diff --git a/include/linkahead/connection.h b/include/linkahead/connection.h
index 97fdcd9..086821c 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.
@@ -173,7 +173,7 @@ private:
 
   static ConnectionManager mInstance;
 
-  inline ConnectionManager(){};
+  inline ConnectionManager() {};
 
   auto mHasConnection(const std::string &name) const -> bool;
 
diff --git a/include/linkahead/info.h b/include/linkahead/info.h
index 237564a..be613b2 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 3b70c1a..3bafc93 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 efe2ae0..442d536 100644
--- a/include/linkahead/transaction.h
+++ b/include/linkahead/transaction.h
@@ -228,8 +228,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.
@@ -481,8 +481,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 4653b2a..83d53dd 100644
--- a/include/linkahead/transaction_status.h
+++ b/include/linkahead/transaction_status.h
@@ -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 1b739d7..faaabe6 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 78407a3..d87f504 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/authentication.cpp b/src/linkahead/authentication.cpp
index 2d3cd96..ec67c5e 100644
--- a/src/linkahead/authentication.cpp
+++ b/src/linkahead/authentication.cpp
@@ -37,11 +37,10 @@ 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/configuration.cpp b/src/linkahead/configuration.cpp
index 1c60cfe..d992006 100644
--- a/src/linkahead/configuration.cpp
+++ b/src/linkahead/configuration.cpp
@@ -55,7 +55,7 @@
     throw ConfigurationError("This LinkAhead client has not been configured.");                    \
   }                                                                                                \
   assert(WRAPPED_JSON_CONFIGURATION(this)->is_object());                                           \
-  const auto &configuration = WRAPPED_JSON_CONFIGURATION(this) -> as_object();                     \
+  const auto &configuration = WRAPPED_JSON_CONFIGURATION(this)->as_object();                       \
   if (!configuration.contains("connections")) {                                                    \
     throw ConfigurationError("This LinkAhead client hasn't any configured connections.");          \
   }                                                                                                \
diff --git a/src/linkahead/connection.cpp b/src/linkahead/connection.cpp
index bff799b..717f7d9 100644
--- a/src/linkahead/connection.cpp
+++ b/src/linkahead/connection.cpp
@@ -66,12 +66,9 @@ using linkahead::info::VersionInfo;
 using linkahead::transaction::Transaction;
 using linkahead::transaction::TransactionStatus;
 
-
 ConnectionManager ConnectionManager::mInstance;
 
-ConnectionManager &ConnectionManager::GetInstance() {
-  return mInstance;
-}
+ConnectionManager &ConnectionManager::GetInstance() { return mInstance; }
 
 Connection::Connection(const ConnectionConfiguration &configuration) {
   const std::string target =
diff --git a/src/linkahead/result_table_impl.h b/src/linkahead/result_table_impl.h
index 62d7fa1..9c68fc1 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 2af4cad..bf81008 100644
--- a/src/linkahead/transaction.cpp
+++ b/src/linkahead/transaction.cpp
@@ -79,9 +79,8 @@ 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();
@@ -298,10 +297,9 @@ 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_file_transmission.cpp b/test/test_file_transmission.cpp
index b337a24..27cac56 100644
--- a/test/test_file_transmission.cpp
+++ b/test/test_file_transmission.cpp
@@ -47,11 +47,11 @@ TEST_F(test_file_transmission, test_file_writer_reader) {
     FileWriter writer(test_file_name);
     std::string buffer_out(1024, 'c');
     for (int i = 0; i < 8; i++) {
-      writer.write(buffer_out);      
+      writer.write(buffer_out);
     }
   }
   EXPECT_EQ(fs::file_size(test_file_name), 1024 * 8);
-  
+
   {
     FileReader reader(test_file_name);
     std::string buffer_in(1024, '\0');
-- 
GitLab