clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version.  The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: I8d0072c279e4de87dc001190845d0ca6da233345
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
 IndentWrappedFunctionNames: true
 InsertNewlineAtEOF: true
 KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
 LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
@@ -98,13 +98,14 @@
 ObjCSpaceBeforeProtocolList: true
 PackConstructorInitializers: BinPack
 PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
 PointerAlignment: Left
 QualifierAlignment: Left
 ReferenceAlignment: Left
diff --git a/auth_algo.hpp b/auth_algo.hpp
index 7b12eff..a4dbcc4 100644
--- a/auth_algo.hpp
+++ b/auth_algo.hpp
@@ -51,8 +51,7 @@
   public:
     explicit Interface(integrity::Algorithms intAlgo,
                        crypt::Algorithms cryptAlgo) :
-        intAlgo(intAlgo),
-        cryptAlgo(cryptAlgo)
+        intAlgo(intAlgo), cryptAlgo(cryptAlgo)
     {}
 
     Interface() = delete;
diff --git a/command/channel_auth.cpp b/command/channel_auth.cpp
index 3308bf6..44d5cad 100644
--- a/command/channel_auth.cpp
+++ b/command/channel_auth.cpp
@@ -225,8 +225,8 @@
     static std::vector<uint8_t> supportedAlgorithms;
     static bool recordInit = false;
 
-    uint8_t rspChannel = ipmi::convertCurrentChannelNum(channelNumber,
-                                                        getInterfaceIndex());
+    uint8_t rspChannel =
+        ipmi::convertCurrentChannelNum(channelNumber, getInterfaceIndex());
 
     if (!ipmi::isValidChannel(rspChannel))
     {
@@ -253,8 +253,8 @@
         }
     }
 
-    const std::vector<uint8_t>& records = algoSelectBit ? cipherRecords
-                                                        : supportedAlgorithms;
+    const std::vector<uint8_t>& records =
+        algoSelectBit ? cipherRecords : supportedAlgorithms;
     static constexpr auto respSize = 16;
 
     // Session support is available in active LAN channels.
@@ -271,8 +271,8 @@
     // set of 16 and so on.
 
     // Calculate the number of record data bytes to be returned.
-    auto start = std::min(static_cast<size_t>(listIndex) * respSize,
-                          records.size());
+    auto start =
+        std::min(static_cast<size_t>(listIndex) * respSize, records.size());
     auto end = std::min((static_cast<size_t>(listIndex) * respSize) + respSize,
                         records.size());
     auto size = end - start;
diff --git a/command/guid.cpp b/command/guid.cpp
index a963f02..485d6b6 100644
--- a/command/guid.cpp
+++ b/command/guid.cpp
@@ -78,8 +78,8 @@
     ipmi::Value propValue;
     try
     {
-        const auto& [objPath, service] = ipmi::getDbusObject(bus, propInterface,
-                                                             subtreePath);
+        const auto& [objPath, service] =
+            ipmi::getDbusObject(bus, propInterface, subtreePath);
         // Read UUID property value from bmcObject
         // UUID is in RFC4122 format Ex: 61a39523-78f2-11e5-9862-e6402cfc3223
         propValue = ipmi::getDbusProperty(bus, service, objPath, propInterface,
@@ -120,28 +120,28 @@
             matchPtr = std::make_unique<sdbusplus::bus::match_t>(
                 bus, propertiesChangedNamespace(subtreePath, propInterface),
                 [](sdbusplus::message_t& m) {
-                try
-                {
-                    std::string iface{};
-                    std::map<std::string, ipmi::Value> pdict{};
-                    m.read(iface, pdict);
-                    if (iface != propInterface)
+                    try
                     {
-                        return;
+                        std::string iface{};
+                        std::map<std::string, ipmi::Value> pdict{};
+                        m.read(iface, pdict);
+                        if (iface != propInterface)
+                        {
+                            return;
+                        }
+                        auto guidStr = std::get<std::string>(pdict.at("UUID"));
+                        Guid tmpGuid{};
+                        rfcToGuid(guidStr, tmpGuid);
+                        guid = tmpGuid;
                     }
-                    auto guidStr = std::get<std::string>(pdict.at("UUID"));
-                    Guid tmpGuid{};
-                    rfcToGuid(guidStr, tmpGuid);
-                    guid = tmpGuid;
-                }
-                catch (const std::exception& e)
-                {
-                    // signal contained invalid guid; ignore it
-                    lg2::error(
-                        "Failed to parse propertiesChanged signal: {ERROR}",
-                        "ERROR", e);
-                }
-            });
+                    catch (const std::exception& e)
+                    {
+                        // signal contained invalid guid; ignore it
+                        lg2::error(
+                            "Failed to parse propertiesChanged signal: {ERROR}",
+                            "ERROR", e);
+                    }
+                });
         }
         catch (const std::exception& e)
         {
diff --git a/command/rakp12.cpp b/command/rakp12.cpp
index 2b7a925..7a5f198 100644
--- a/command/rakp12.cpp
+++ b/command/rakp12.cpp
@@ -29,9 +29,9 @@
                                  const std::optional<std::string>& messageArgs)
 {
     static constexpr std::string_view openBMCMessageRegistryVersion = "0.1.";
-    std::string messageID = "OpenBMC." +
-                            std::string(openBMCMessageRegistryVersion) +
-                            "InvalidLoginAttempted";
+    std::string messageID =
+        "OpenBMC." + std::string(openBMCMessageRegistryVersion) +
+        "InvalidLoginAttempted";
     lg2::error(
         "message: {MSG}, id: {REDFISH_MESSAGE_ID}, args: {REDFISH_MESSAGE_ARGS}",
         "MSG", journalMsg, "REDFISH_MESSAGE_ID", messageID,
@@ -75,8 +75,8 @@
         return outPayload;
     }
 
-    auto rakp1Size = sizeof(RAKP1request) -
-                     (userNameMaxLen - request->user_name_len);
+    auto rakp1Size =
+        sizeof(RAKP1request) - (userNameMaxLen - request->user_name_len);
 
     std::string message = "Invalid login attempted via RCMPP interface ";
     // Validate user name length in the message
@@ -154,8 +154,8 @@
     // be established with USER privilege as well as all other sessions are
     // initially set to USER privilege, regardless of the requested maximum
     // privilege.
-    if (!(static_cast<session::Privilege>(request->req_max_privilege_level &
-                                          session::reqMaxPrivMask) >
+    if (!(static_cast<session::Privilege>(
+              request->req_max_privilege_level & session::reqMaxPrivMask) >
           session::Privilege::CALLBACK))
     {
         response->rmcpStatusCode =
diff --git a/command_table.cpp b/command_table.cpp
index ee5fefc..c0e655a 100644
--- a/command_table.cpp
+++ b/command_table.cpp
@@ -79,25 +79,25 @@
         bus->async_method_call(
             [handler, this](const boost::system::error_code& ec,
                             const IpmiDbusRspType& response) {
-            if (!ec)
-            {
-                const uint8_t& cc = std::get<3>(response);
-                const std::vector<uint8_t>& responseData =
-                    std::get<4>(response);
-                std::vector<uint8_t> payload;
-                payload.reserve(1 + responseData.size());
-                payload.push_back(cc);
-                payload.insert(payload.end(), responseData.begin(),
-                               responseData.end());
-                handler->outPayload = std::move(payload);
-            }
-            else
-            {
-                std::vector<uint8_t> payload;
-                payload.push_back(IPMI_CC_UNSPECIFIED_ERROR);
-                handler->outPayload = std::move(payload);
-            }
-        },
+                if (!ec)
+                {
+                    const uint8_t& cc = std::get<3>(response);
+                    const std::vector<uint8_t>& responseData =
+                        std::get<4>(response);
+                    std::vector<uint8_t> payload;
+                    payload.reserve(1 + responseData.size());
+                    payload.push_back(cc);
+                    payload.insert(payload.end(), responseData.begin(),
+                                   responseData.end());
+                    handler->outPayload = std::move(payload);
+                }
+                else
+                {
+                    std::vector<uint8_t> payload;
+                    payload.push_back(IPMI_CC_UNSPECIFIED_ERROR);
+                    handler->outPayload = std::move(payload);
+                }
+            },
             "xyz.openbmc_project.Ipmi.Host", "/xyz/openbmc_project/Ipmi",
             "xyz.openbmc_project.Ipmi.Server", "execute", netFn, lun, cmd,
             commandData, options);
@@ -119,8 +119,8 @@
             }
         }
 
-        handler->outPayload = iterator->second->executeCommand(commandData,
-                                                               handler);
+        handler->outPayload =
+            iterator->second->executeCommand(commandData, handler);
 
         auto end = std::chrono::steady_clock::now();
 
diff --git a/command_table.hpp b/command_table.hpp
index 03e1a48..821a070 100644
--- a/command_table.hpp
+++ b/command_table.hpp
@@ -171,8 +171,7 @@
   public:
     NetIpmidEntry(CommandID command, CommandFunctor functor,
                   session::Privilege privilege, bool sessionless) :
-        Entry(command, privilege),
-        functor(functor), sessionless(sessionless)
+        Entry(command, privilege), functor(functor), sessionless(sessionless)
     {}
 
     /**
diff --git a/crypt_algo.cpp b/crypt_algo.cpp
index c51465f..75eea15 100644
--- a/crypt_algo.cpp
+++ b/crypt_algo.cpp
@@ -18,10 +18,9 @@
 constexpr std::array<uint8_t, AlgoAES128::AESCBC128BlockSize - 1>
     AlgoAES128::confPadBytes;
 
-std::vector<uint8_t>
-    AlgoAES128::decryptPayload(const std::vector<uint8_t>& packet,
-                               const size_t sessHeaderLen,
-                               const size_t payloadLen) const
+std::vector<uint8_t> AlgoAES128::decryptPayload(
+    const std::vector<uint8_t>& packet, const size_t sessHeaderLen,
+    const size_t payloadLen) const
 {
     // verify packet size minimal: sessHeaderLen + payloadLen
     // and payloadLen is more than AESCBC128ConfHeader
@@ -96,17 +95,16 @@
     return encryptData(payload.data(), payload.size());
 }
 
-std::vector<uint8_t> AlgoAES128::decryptData(const uint8_t* iv,
-                                             const uint8_t* input,
-                                             const int inputLen) const
+std::vector<uint8_t> AlgoAES128::decryptData(
+    const uint8_t* iv, const uint8_t* input, const int inputLen) const
 {
     // Initializes Cipher context
     EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
 
     auto cleanupFunc = [](EVP_CIPHER_CTX* ctx) { EVP_CIPHER_CTX_free(ctx); };
 
-    std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(ctx,
-                                                                  cleanupFunc);
+    std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(
+        ctx, cleanupFunc);
 
     /*
      * EVP_DecryptInit_ex sets up cipher context ctx for encryption with type
@@ -150,8 +148,8 @@
     return output;
 }
 
-std::vector<uint8_t> AlgoAES128::encryptData(const uint8_t* input,
-                                             const int inputLen) const
+std::vector<uint8_t>
+    AlgoAES128::encryptData(const uint8_t* input, const int inputLen) const
 {
     std::vector<uint8_t> output(inputLen + AESCBC128BlockSize);
 
@@ -166,8 +164,8 @@
 
     auto cleanupFunc = [](EVP_CIPHER_CTX* ctx) { EVP_CIPHER_CTX_free(ctx); };
 
-    std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(ctx,
-                                                                  cleanupFunc);
+    std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(
+        ctx, cleanupFunc);
 
     /*
      * EVP_EncryptInit_ex sets up cipher context ctx for encryption with type
diff --git a/crypt_algo.hpp b/crypt_algo.hpp
index 6a8c25d..e7af67f 100644
--- a/crypt_algo.hpp
+++ b/crypt_algo.hpp
@@ -61,10 +61,9 @@
      *
      * @return decrypted payload if the operation is successful
      */
-    virtual std::vector<uint8_t>
-        decryptPayload(const std::vector<uint8_t>& packet,
-                       const size_t sessHeaderLen,
-                       const size_t payloadLen) const = 0;
+    virtual std::vector<uint8_t> decryptPayload(
+        const std::vector<uint8_t>& packet, const size_t sessHeaderLen,
+        const size_t payloadLen) const = 0;
 
     /**
      * @brief Encrypt the outgoing payload
diff --git a/integrity_algo.cpp b/integrity_algo.cpp
index dc87625..acfc46f 100644
--- a/integrity_algo.cpp
+++ b/integrity_algo.cpp
@@ -18,8 +18,8 @@
     k1 = generateKn(sik, rmcp::const_1);
 }
 
-std::vector<uint8_t> AlgoSHA1::generateHMAC(const uint8_t* input,
-                                            const size_t len) const
+std::vector<uint8_t>
+    AlgoSHA1::generateHMAC(const uint8_t* input, const size_t len) const
 {
     std::vector<uint8_t> output(SHA_DIGEST_LENGTH);
     unsigned int mdLen = 0;
@@ -84,8 +84,8 @@
     k1 = generateKn(sik, rmcp::const_1);
 }
 
-std::vector<uint8_t> AlgoSHA256::generateHMAC(const uint8_t* input,
-                                              const size_t len) const
+std::vector<uint8_t>
+    AlgoSHA256::generateHMAC(const uint8_t* input, const size_t len) const
 {
     std::vector<uint8_t> output(SHA256_DIGEST_LENGTH);
     unsigned int mdLen = 0;
diff --git a/message.hpp b/message.hpp
index 69ef947..04dac27 100644
--- a/message.hpp
+++ b/message.hpp
@@ -205,9 +205,9 @@
         {
             outMessage->payloadType = PayloadType::IPMI;
 
-            outMessage->payload.resize(sizeof(LAN::header::Response) +
-                                       output.size() +
-                                       sizeof(LAN::trailer::Response));
+            outMessage->payload.resize(
+                sizeof(LAN::header::Response) + output.size() +
+                sizeof(LAN::trailer::Response));
 
             auto reqHeader =
                 reinterpret_cast<LAN::header::Request*>(payload.data());
diff --git a/message_handler.hpp b/message_handler.hpp
index f0d4848..c1a7032 100644
--- a/message_handler.hpp
+++ b/message_handler.hpp
@@ -21,8 +21,7 @@
     Handler(std::shared_ptr<udpsocket::Channel> channel,
             std::shared_ptr<boost::asio::io_context> io,
             uint32_t sessionID = message::Message::MESSAGE_INVALID_SESSION_ID) :
-        sessionID(sessionID),
-        channel(channel), io(io)
+        sessionID(sessionID), channel(channel), io(io)
     {
         if (sessionID != message::Message::MESSAGE_INVALID_SESSION_ID)
         {
@@ -35,8 +34,7 @@
      */
     Handler(std::shared_ptr<udpsocket::Channel> channel,
             uint32_t sessionID = message::Message::MESSAGE_INVALID_SESSION_ID) :
-        sessionID(sessionID),
-        channel(channel), io(nullptr)
+        sessionID(sessionID), channel(channel), io(nullptr)
     {
         if (sessionID != message::Message::MESSAGE_INVALID_SESSION_ID)
         {
diff --git a/message_parsers.cpp b/message_parsers.cpp
index 33b53c1..ef10b04 100644
--- a/message_parsers.cpp
+++ b/message_parsers.cpp
@@ -208,8 +208,8 @@
         throw std::runtime_error("Invalid data length");
     }
 
-    bool integrityMismatch = session->isIntegrityAlgoEnabled() &&
-                             !message->isPacketAuthenticated;
+    bool integrityMismatch =
+        session->isIntegrityAlgoEnabled() && !message->isPacketAuthenticated;
     bool encryptMismatch = session->isCryptAlgoEnabled() &&
                            !message->isPacketEncrypted;
 
@@ -232,14 +232,14 @@
     if (message->isPacketEncrypted)
     {
         // Assign the decrypted payload to the IPMI Message
-        message->payload = internal::decryptPayload(inPacket, message,
-                                                    payloadLen, session);
+        message->payload =
+            internal::decryptPayload(inPacket, message, payloadLen, session);
     }
     else
     {
-        message->payload.assign(inPacket.begin() + sizeof(SessionHeader_t),
-                                inPacket.begin() + sizeof(SessionHeader_t) +
-                                    payloadLen);
+        message->payload.assign(
+            inPacket.begin() + sizeof(SessionHeader_t),
+            inPacket.begin() + sizeof(SessionHeader_t) + payloadLen);
     }
 
     return message;
@@ -337,8 +337,8 @@
         return false;
     }
 
-    auto trailer = reinterpret_cast<const SessionTrailer_t*>(packet.data() +
-                                                             sessTrailerPos);
+    auto trailer = reinterpret_cast<const SessionTrailer_t*>(
+        packet.data() + sessTrailerPos);
 
     // Check trailer->padLength against paddingLen, both should match up,
     // return false if the lengths don't match
@@ -394,11 +394,10 @@
     packet.insert(packet.end(), integrityData.begin(), integrityData.end());
 }
 
-std::vector<uint8_t>
-    decryptPayload(const std::vector<uint8_t>& packet,
-                   const std::shared_ptr<Message>& /* message */,
-                   size_t payloadLen,
-                   const std::shared_ptr<session::Session>& session)
+std::vector<uint8_t> decryptPayload(
+    const std::vector<uint8_t>& packet,
+    const std::shared_ptr<Message>& /* message */, size_t payloadLen,
+    const std::shared_ptr<session::Session>& session)
 {
     return session->getCryptAlgo()->decryptPayload(
         packet, sizeof(SessionHeader_t), payloadLen);
diff --git a/message_parsers.hpp b/message_parsers.hpp
index d1873ea..a7d376a 100644
--- a/message_parsers.hpp
+++ b/message_parsers.hpp
@@ -234,10 +234,9 @@
  *
  * @return on successful completion, return the plain text payload
  */
-std::vector<uint8_t>
-    decryptPayload(const std::vector<uint8_t>& packet,
-                   const std::shared_ptr<Message>& message, size_t payloadLen,
-                   const std::shared_ptr<session::Session>& session);
+std::vector<uint8_t> decryptPayload(
+    const std::vector<uint8_t>& packet, const std::shared_ptr<Message>& message,
+    size_t payloadLen, const std::shared_ptr<session::Session>& session);
 
 /**
  * @brief Encrypt the plain text payload for the outgoing IPMI packet
diff --git a/sd_event_loop.cpp b/sd_event_loop.cpp
index fa8319c..c7283e0 100644
--- a/sd_event_loop.cpp
+++ b/sd_event_loop.cpp
@@ -37,14 +37,15 @@
 
 void EventLoop::startRmcpReceive()
 {
-    udpSocket->async_wait(boost::asio::socket_base::wait_read,
-                          [this](const boost::system::error_code& ec) {
-        if (!ec)
-        {
-            boost::asio::post(*io, [this]() { startRmcpReceive(); });
-            handleRmcpPacket();
-        }
-    });
+    udpSocket->async_wait(
+        boost::asio::socket_base::wait_read,
+        [this](const boost::system::error_code& ec) {
+            if (!ec)
+            {
+                boost::asio::post(*io, [this]() { startRmcpReceive(); });
+                handleRmcpPacket();
+            }
+        });
 }
 
 int EventLoop::getVLANID(const std::string channel)
@@ -204,8 +205,8 @@
     {
         // SO_BINDTODEVICE
         if ((::setsockopt(udpSocket->native_handle(), SOL_SOCKET,
-                          SO_BINDTODEVICE, iface.c_str(),
-                          iface.size() + 1) == -1))
+                          SO_BINDTODEVICE, iface.c_str(), iface.size() + 1) ==
+             -1))
         {
             lg2::error("Failed to bind to requested interface: {ERROR}",
                        "ERROR", strerror(errno));
diff --git a/session.hpp b/session.hpp
index 5ddf2f7..ab3fe07 100644
--- a/session.hpp
+++ b/session.hpp
@@ -117,8 +117,7 @@
      */
     Session(sdbusplus::bus_t& bus, const char* path,
             SessionID inRemoteConsoleSessID, SessionID BMCSessionID,
-            char priv) :
-        SessionIface(bus, path)
+            char priv) : SessionIface(bus, path)
     {
         reqMaxPrivLevel = static_cast<session::Privilege>(priv);
         bmcSessionID = BMCSessionID;
@@ -248,8 +247,8 @@
     {
         auto currentTime = std::chrono::steady_clock::now();
         auto elapsedMicros =
-            std::chrono::duration_cast<std::chrono::microseconds>(currentTime -
-                                                                  lastTime);
+            std::chrono::duration_cast<std::chrono::microseconds>(
+                currentTime - lastTime);
 
         State state = static_cast<session::State>(this->state());
 
diff --git a/sessions_manager.cpp b/sessions_manager.cpp
index 9aa452c..79bf9de 100644
--- a/sessions_manager.cpp
+++ b/sessions_manager.cpp
@@ -74,11 +74,10 @@
     scheduleSessionCleaner(std::chrono::microseconds(3 * 1000 * 1000));
 }
 
-std::shared_ptr<Session>
-    Manager::startSession(SessionID remoteConsoleSessID, Privilege priv,
-                          cipher::rakp_auth::Algorithms authAlgo,
-                          cipher::integrity::Algorithms intAlgo,
-                          cipher::crypt::Algorithms cryptAlgo)
+std::shared_ptr<Session> Manager::startSession(
+    SessionID remoteConsoleSessID, Privilege priv,
+    cipher::rakp_auth::Algorithms authAlgo,
+    cipher::integrity::Algorithms intAlgo, cipher::crypt::Algorithms cryptAlgo)
 {
     std::shared_ptr<Session> session = nullptr;
     SessionID bmcSessionID = 0;
@@ -189,8 +188,8 @@
     }
 }
 
-std::shared_ptr<Session> Manager::getSession(SessionID sessionID,
-                                             RetrieveOption option)
+std::shared_ptr<Session>
+    Manager::getSession(SessionID sessionID, RetrieveOption option)
 {
     switch (option)
     {
@@ -210,8 +209,8 @@
                 [sessionID](
                     const std::pair<const uint32_t, std::shared_ptr<Session>>&
                         in) -> bool {
-                return sessionID == in.second->getRCSessionID();
-            });
+                    return sessionID == in.second->getRCSessionID();
+                });
 
             if (iter != sessionsMap.end())
             {
@@ -232,8 +231,8 @@
     // active idle time in seconds = 60 / overflow^3
     constexpr int baseIdleMicros = 60 * 1000 * 1000;
     // no +1 for the zero session here because this is just active sessions
-    int sessionDivisor = getActiveSessionCount() -
-                         session::maxSessionCountPerChannel;
+    int sessionDivisor =
+        getActiveSessionCount() - session::maxSessionCountPerChannel;
     sessionDivisor = std::max(0, sessionDivisor) + 1;
     sessionDivisor = sessionDivisor * sessionDivisor * sessionDivisor;
     int activeMicros = baseIdleMicros / sessionDivisor;
@@ -242,8 +241,8 @@
     // setup idle time in seconds = max(3, 60 / overflow^3)
 
     // +1 for the zero session here because size() counts that too
-    int setupDivisor = sessionsMap.size() -
-                       (session::maxSessionCountPerChannel + 1);
+    int setupDivisor =
+        sessionsMap.size() - (session::maxSessionCountPerChannel + 1);
     setupDivisor = std::max(0, setupDivisor) + 1;
     setupDivisor = setupDivisor * setupDivisor * setupDivisor;
     constexpr int maxSetupMicros = 3 * 1000 * 1000;
@@ -327,9 +326,9 @@
         sessionsMap.begin(), sessionsMap.end(),
         [](const std::pair<const uint32_t, std::shared_ptr<Session>>& in)
             -> bool {
-        return in.second->state() ==
-               static_cast<uint8_t>(session::State::active);
-    }));
+            return in.second->state() ==
+                   static_cast<uint8_t>(session::State::active);
+        }));
 }
 
 void Manager::scheduleSessionCleaner(const std::chrono::microseconds& when)
diff --git a/sessions_manager.hpp b/sessions_manager.hpp
index 512b17c..754f618 100644
--- a/sessions_manager.hpp
+++ b/sessions_manager.hpp
@@ -44,7 +44,7 @@
 
     Manager() = delete;
     Manager(std::shared_ptr<boost::asio::io_context>& io, const Private&) :
-        io(io), timer(*io){};
+        io(io), timer(*io) {};
     ~Manager() = default;
     Manager(const Manager&) = delete;
     Manager& operator=(const Manager&) = delete;
diff --git a/socket_channel.hpp b/socket_channel.hpp
index 02e7040..0edfcd5 100644
--- a/socket_channel.hpp
+++ b/socket_channel.hpp
@@ -76,8 +76,8 @@
             const sockaddr_in* sa =
                 reinterpret_cast<const sockaddr_in*>(&remoteSockAddr);
             remoteIpv4Addr = sa->sin_addr.s_addr;
-            retval = inet_ntop(AF_INET, &(sa->sin_addr), ipv4addr,
-                               sizeof(ipv4addr));
+            retval =
+                inet_ntop(AF_INET, &(sa->sin_addr), ipv4addr, sizeof(ipv4addr));
         }
         else if (sockAddrSize == sizeof(sockaddr_in6))
         {
diff --git a/sol/sol_context.cpp b/sol/sol_context.cpp
index 7165c61..21632a4 100644
--- a/sol/sol_context.cpp
+++ b/sol/sol_context.cpp
@@ -17,18 +17,16 @@
 Context::Context(std::shared_ptr<boost::asio::io_context> io,
                  uint8_t maxRetryCount, uint8_t sendThreshold, uint8_t instance,
                  session::SessionID sessionID) :
-    accumulateTimer(*io),
-    retryTimer(*io), maxRetryCount(maxRetryCount), retryCounter(maxRetryCount),
-    sendThreshold(sendThreshold), payloadInstance(instance),
-    sessionID(sessionID)
+    accumulateTimer(*io), retryTimer(*io), maxRetryCount(maxRetryCount),
+    retryCounter(maxRetryCount), sendThreshold(sendThreshold),
+    payloadInstance(instance), sessionID(sessionID)
 {
     session = session::Manager::get().getSession(sessionID);
 }
 
-std::shared_ptr<Context>
-    Context::makeContext(std::shared_ptr<boost::asio::io_context> io,
-                         uint8_t maxRetryCount, uint8_t sendThreshold,
-                         uint8_t instance, session::SessionID sessionID)
+std::shared_ptr<Context> Context::makeContext(
+    std::shared_ptr<boost::asio::io_context> io, uint8_t maxRetryCount,
+    uint8_t sendThreshold, uint8_t instance, session::SessionID sessionID)
 {
     auto ctx = std::make_shared<Context>(io, maxRetryCount, sendThreshold,
                                          instance, sessionID);
@@ -66,12 +64,12 @@
         std::weak_ptr<Context> weakRef = weak_from_this();
         accumulateTimer.async_wait(
             [weakRef](const boost::system::error_code& ec) {
-            std::shared_ptr<Context> self = weakRef.lock();
-            if (!ec && self)
-            {
-                self->charAccTimerHandler();
-            }
-        });
+                std::shared_ptr<Context> self = weakRef.lock();
+                if (!ec && self)
+                {
+                    self->charAccTimerHandler();
+                }
+            });
     }
     else
     {
diff --git a/sol/sol_context.hpp b/sol/sol_context.hpp
index e4045c8..981360e 100644
--- a/sol/sol_context.hpp
+++ b/sol/sol_context.hpp
@@ -174,10 +174,9 @@
      *  @param[in] instance - SOL payload instance.
      *  @param[in] sessionID - BMC session ID.
      */
-    static std::shared_ptr<Context>
-        makeContext(std::shared_ptr<boost::asio::io_context> io,
-                    uint8_t maxRetryCount, uint8_t sendThreshold,
-                    uint8_t instance, session::SessionID sessionID);
+    static std::shared_ptr<Context> makeContext(
+        std::shared_ptr<boost::asio::io_context> io, uint8_t maxRetryCount,
+        uint8_t sendThreshold, uint8_t instance, session::SessionID sessionID);
 
     /** @brief Context Constructor.
      *
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
index 76e1a15..8fabeeb 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -56,8 +56,8 @@
     }
     std::vector<uint8_t> buffer(readSize);
     ec.clear();
-    size_t readDataLen = consoleSocket->read_some(boost::asio::buffer(buffer),
-                                                  ec);
+    size_t readDataLen =
+        consoleSocket->read_some(boost::asio::buffer(buffer), ec);
     if (ec)
     {
         lg2::error("Reading from host console socket failed: {ERROR}", "ERROR",
@@ -101,12 +101,12 @@
 
     consoleSocket->async_wait(boost::asio::socket_base::wait_read,
                               [this](const boost::system::error_code& ec) {
-        if (!ec)
-        {
-            consoleInputHandler();
-            startHostConsole();
-        }
-    });
+                                  if (!ec)
+                                  {
+                                      consoleInputHandler();
+                                      startHostConsole();
+                                  }
+                              });
 } // namespace sol
 
 void Manager::stopHostConsole()
@@ -130,8 +130,8 @@
     {
         try
         {
-            solService = ipmi::getService(dbus, solInterface,
-                                          solPathWitheEthName);
+            solService =
+                ipmi::getService(dbus, solInterface, solPathWitheEthName);
         }
         catch (const std::runtime_error& e)
         {
@@ -251,22 +251,22 @@
                     type::signal() + member("PropertiesChanged") +
                     interface("org.freedesktop.DBus.Properties"),
                 [](sdbusplus::message_t& msg) {
-                std::string intfName;
-                std::map<std::string, std::variant<bool>> properties;
-                msg.read(intfName, properties);
+                    std::string intfName;
+                    std::map<std::string, std::variant<bool>> properties;
+                    msg.read(intfName, properties);
 
-                const auto it = properties.find("Enabled");
-                if (it != properties.end())
-                {
-                    const bool* state = std::get_if<bool>(&it->second);
-
-                    if (state != nullptr && *state == false)
+                    const auto it = properties.find("Enabled");
+                    if (it != properties.end())
                     {
-                        // Stop all the payload session.
-                        sol::Manager::get().stopAllPayloadInstance();
+                        const bool* state = std::get_if<bool>(&it->second);
+
+                        if (state != nullptr && *state == false)
+                        {
+                            // Stop all the payload session.
+                            sol::Manager::get().stopAllPayloadInstance();
+                        }
                     }
-                }
-            });
+                });
         }
     }
     catch (const sdbusplus::exception_t& e)
@@ -335,8 +335,8 @@
         }
         else if (prop.first == "RetryIntervalMS")
         {
-            sol::Manager::get().retryInterval = std::get<uint8_t>(prop.second) *
-                                                sol::retryIntervalFactor * 1ms;
+            sol::Manager::get().retryInterval =
+                std::get<uint8_t>(prop.second) * sol::retryIntervalFactor * 1ms;
         }
     }
 }
diff --git a/test/cipher.cpp b/test/cipher.cpp
index fa3e020..d7720d4 100644
--- a/test/cipher.cpp
+++ b/test/cipher.cpp
@@ -384,8 +384,8 @@
     }
 
     EVP_CIPHER_CTX_set_padding(ctx, 0);
-    std::vector<uint8_t> output(cipher.size() +
-                                cipher::crypt::AlgoAES128::AESCBC128BlockSize);
+    std::vector<uint8_t> output(
+        cipher.size() + cipher::crypt::AlgoAES128::AESCBC128BlockSize);
     int outputLen = 0;
 
     if (!EVP_DecryptUpdate(
@@ -429,8 +429,8 @@
     constexpr rmcp::Const_n const1 = {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
                                       0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
                                       0x02, 0x02, 0x02, 0x02, 0x02, 0x02};
-    std::vector<uint8_t> output(payload.size() +
-                                cipher::crypt::AlgoAES128::AESCBC128BlockSize);
+    std::vector<uint8_t> output(
+        payload.size() + cipher::crypt::AlgoAES128::AESCBC128BlockSize);
 
     if (!RAND_bytes(output.data(),
                     cipher::crypt::AlgoAES128::AESCBC128ConfHeader))