diff --git a/.clang-format b/.clang-format
index 38fa1a9..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,7 +6,7 @@
 AlignConsecutiveAssignments: false
 AlignConsecutiveDeclarations: false
 AlignEscapedNewlines: Right
-AlignOperands: Align
+AlignOperands:  Align
 AlignTrailingComments:
   Kind: Always
   OverEmptyLines: 1
@@ -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/app/channel.cpp b/app/channel.cpp
index a1e42fa..0b3b73d 100644
--- a/app/channel.cpp
+++ b/app/channel.cpp
@@ -140,8 +140,8 @@
     {
         try
         {
-            std::tie(cipherRecords,
-                     supportedAlgorithms) = cipher::getCipherRecords();
+            std::tie(cipherRecords, supportedAlgorithms) =
+                cipher::getCipherRecords();
             recordInit = true;
         }
         catch (const std::exception& e)
@@ -150,8 +150,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.
@@ -167,8 +167,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/app/watchdog.cpp b/app/watchdog.cpp
index dd65e45..99e4c40 100644
--- a/app/watchdog.cpp
+++ b/app/watchdog.cpp
@@ -192,12 +192,11 @@
  *
  * @return completion code on success.
  **/
-ipmi::RspType<>
-    ipmiSetWatchdogTimer(uint3_t timerUse, uint3_t reserved, bool dontStopTimer,
-                         bool dontLog, uint3_t timeoutAction, uint1_t reserved1,
-                         uint3_t preTimeoutInterrupt, uint1_t reserved2,
-                         uint8_t preTimeoutInterval,
-                         std::bitset<8> expFlagValue, uint16_t initialCountdown)
+ipmi::RspType<> ipmiSetWatchdogTimer(
+    uint3_t timerUse, uint3_t reserved, bool dontStopTimer, bool dontLog,
+    uint3_t timeoutAction, uint1_t reserved1, uint3_t preTimeoutInterrupt,
+    uint1_t reserved2, uint8_t preTimeoutInterval, std::bitset<8> expFlagValue,
+    uint16_t initialCountdown)
 {
     if ((timerUse == wdTimerUseResTimer1) ||
         (timerUse == wdTimerUseResTimer2) ||
diff --git a/apphandler.cpp b/apphandler.cpp
index c7b1c37..d1d4301 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -114,8 +114,8 @@
     ipmi::ObjectTree objectTree;
     try
     {
-        objectTree = ipmi::getAllDbusObjects(*ctx->bus, softwareRoot,
-                                             redundancyIntf);
+        objectTree =
+            ipmi::getAllDbusObjects(*ctx->bus, softwareRoot, redundancyIntf);
     }
     catch (const sdbusplus::exception_t& e)
     {
@@ -128,10 +128,10 @@
     auto objectFound = false;
     for (auto& softObject : objectTree)
     {
-        auto service = ipmi::getService(*ctx->bus, redundancyIntf,
-                                        softObject.first);
-        auto objValueTree = ipmi::getManagedObjects(*ctx->bus, service,
-                                                    softwareRoot);
+        auto service =
+            ipmi::getService(*ctx->bus, redundancyIntf, softObject.first);
+        auto objValueTree =
+            ipmi::getManagedObjects(*ctx->bus, service, softwareRoot);
 
         auto minPriority = 0xFF;
         for (const auto& objIter : objValueTree)
@@ -184,11 +184,11 @@
     sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
 
     // Get the Inventory object implementing the BMC interface
-    ipmi::DbusObjectInfo bmcObject = ipmi::getDbusObject(bus,
-                                                         bmc_state_interface);
-    auto variant = ipmi::getDbusProperty(bus, bmcObject.second, bmcObject.first,
-                                         bmc_state_interface,
-                                         bmc_state_property);
+    ipmi::DbusObjectInfo bmcObject =
+        ipmi::getDbusObject(bus, bmc_state_interface);
+    auto variant =
+        ipmi::getDbusProperty(bus, bmcObject.second, bmcObject.first,
+                              bmc_state_interface, bmc_state_property);
 
     return std::holds_alternative<std::string>(variant) &&
            BMC::convertBMCStateFromString(std::get<std::string>(variant)) ==
@@ -337,11 +337,11 @@
         }
         else
         {
-            auto found = std::find_if(acpi_state::dbusToIPMI.begin(),
-                                      acpi_state::dbusToIPMI.end(),
-                                      [&s](const auto& iter) {
-                return (static_cast<uint8_t>(iter.second) == s);
-            });
+            auto found = std::find_if(
+                acpi_state::dbusToIPMI.begin(), acpi_state::dbusToIPMI.end(),
+                [&s](const auto& iter) {
+                    return (static_cast<uint8_t>(iter.second) == s);
+                });
 
             value = found->first;
 
@@ -385,11 +385,11 @@
         }
         else
         {
-            auto found = std::find_if(acpi_state::dbusToIPMI.begin(),
-                                      acpi_state::dbusToIPMI.end(),
-                                      [&s](const auto& iter) {
-                return (static_cast<uint8_t>(iter.second) == s);
-            });
+            auto found = std::find_if(
+                acpi_state::dbusToIPMI.begin(), acpi_state::dbusToIPMI.end(),
+                [&s](const auto& iter) {
+                    return (static_cast<uint8_t>(iter.second) == s);
+                });
 
             value = found->first;
 
@@ -852,8 +852,8 @@
 
     // Get the Inventory object implementing BMC interface
     ipmi::DbusObjectInfo objectInfo{};
-    boost::system::error_code ec = ipmi::getDbusObject(ctx, uuidInterface,
-                                                       objectInfo);
+    boost::system::error_code ec =
+        ipmi::getDbusObject(ctx, uuidInterface, objectInfo);
     if (ec.value())
     {
         lg2::error("Failed to locate System UUID object, "
@@ -1034,11 +1034,10 @@
  * @return success completion code if request data is valid
  * else return the correcponding error completion code.
  **/
-uint8_t getSessionInfoRequestData(const ipmi::Context::ptr ctx,
-                                  const uint8_t sessionIndex,
-                                  ipmi::message::Payload& payload,
-                                  uint32_t& reqSessionId,
-                                  uint8_t& reqSessionHandle)
+uint8_t getSessionInfoRequestData(
+    const ipmi::Context::ptr ctx, const uint8_t sessionIndex,
+    ipmi::message::Payload& payload, uint32_t& reqSessionId,
+    uint8_t& reqSessionHandle)
 {
     if ((sessionIndex > session::maxSessionCountPerChannel) &&
         (sessionIndex < session::searchSessionByHandle))
@@ -1178,23 +1177,23 @@
         sessionProps, "State", static_cast<uint8_t>(session::State::inactive));
     if (sessionState == static_cast<uint8_t>(session::State::active))
     {
-        sessionHandle = ipmi::mappedVariant<uint8_t>(sessionProps,
-                                                     "SessionHandle", 0);
-        std::get<0>(details) = ipmi::mappedVariant<uint8_t>(sessionProps,
-                                                            "UserID", 0xff);
+        sessionHandle =
+            ipmi::mappedVariant<uint8_t>(sessionProps, "SessionHandle", 0);
+        std::get<0>(details) =
+            ipmi::mappedVariant<uint8_t>(sessionProps, "UserID", 0xff);
         // std::get<1>(details) = 0; // (default constructed to 0)
         std::get<2>(details) =
             ipmi::mappedVariant<uint8_t>(sessionProps, "CurrentPrivilege", 0);
         // std::get<3>(details) = 0; // (default constructed to 0)
-        std::get<4>(details) = ipmi::mappedVariant<uint8_t>(sessionProps,
-                                                            "ChannelNum", 0xff);
+        std::get<4>(details) =
+            ipmi::mappedVariant<uint8_t>(sessionProps, "ChannelNum", 0xff);
         constexpr uint4_t rmcpPlusProtocol = 1;
         std::get<5>(details) = rmcpPlusProtocol;
-        std::get<6>(details) = ipmi::mappedVariant<uint32_t>(sessionProps,
-                                                             "RemoteIPAddr", 0);
+        std::get<6>(details) =
+            ipmi::mappedVariant<uint32_t>(sessionProps, "RemoteIPAddr", 0);
         // std::get<7>(details) = {{0}}; // default constructed to all 0
-        std::get<8>(details) = ipmi::mappedVariant<uint16_t>(sessionProps,
-                                                             "RemotePort", 0);
+        std::get<8>(details) =
+            ipmi::mappedVariant<uint16_t>(sessionProps, "RemotePort", 0);
     }
 
     return ipmi::ccSuccess;
@@ -1257,8 +1256,8 @@
 
         std::string service = itr->first;
         uint8_t sessionState = 0;
-        completionCode = getSessionState(ctx, service, objectPath,
-                                         sessionState);
+        completionCode =
+            getSessionState(ctx, service, objectPath, sessionState);
         if (completionCode)
         {
             return ipmi::response(completionCode);
@@ -1696,11 +1695,10 @@
  *  @returns IPMI completion code plus response data
  *   - readData - i2c response data
  */
-ipmi::RspType<std::vector<uint8_t>>
-    ipmiControllerWriteRead([[maybe_unused]] bool isPrivateBus, uint3_t busId,
-                            [[maybe_unused]] uint4_t channelNum, bool reserved,
-                            uint7_t targetAddr, uint8_t readCount,
-                            std::vector<uint8_t> writeData)
+ipmi::RspType<std::vector<uint8_t>> ipmiControllerWriteRead(
+    [[maybe_unused]] bool isPrivateBus, uint3_t busId,
+    [[maybe_unused]] uint4_t channelNum, bool reserved, uint7_t targetAddr,
+    uint8_t readCount, std::vector<uint8_t> writeData)
 {
     if (reserved)
     {
@@ -1723,8 +1721,8 @@
     }
 #endif // ENABLE_I2C_WHITELIST_CHECK
     std::vector<uint8_t> readBuf(readCount);
-    std::string i2cBus = "/dev/i2c-" +
-                         std::to_string(static_cast<uint8_t>(busId));
+    std::string i2cBus =
+        "/dev/i2c-" + std::to_string(static_cast<uint8_t>(busId));
 
     ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, static_cast<uint8_t>(targetAddr),
                                       writeData, readBuf);
diff --git a/chassishandler.cpp b/chassishandler.cpp
index e089083..34e8822 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -196,9 +196,9 @@
 
         properties = ipmi::getAllDbusProperties(
             bus, ipObjectInfo.second, ipObjectInfo.first, IP_INTERFACE);
-        auto variant = ipmi::getDbusProperty(bus, macObjectInfo.second,
-                                             macObjectInfo.first, MAC_INTERFACE,
-                                             "MACAddress");
+        auto variant = ipmi::getDbusProperty(
+            bus, macObjectInfo.second, macObjectInfo.first, MAC_INTERFACE,
+            "MACAddress");
 
         auto ipAddress = std::get<std::string>(properties["Address"]);
 
@@ -518,10 +518,10 @@
         } while (0);
 
         // Cookie == 0 or it is a valid cookie
-        hostNetworkConfig += "ipaddress="s + ipAddress + ",prefix="s +
-                             std::to_string(prefix) + ",gateway="s + gateway +
-                             ",mac="s + mac + ",addressOrigin="s +
-                             addressOrigin;
+        hostNetworkConfig +=
+            "ipaddress="s + ipAddress + ",prefix="s + std::to_string(prefix) +
+            ",gateway="s + gateway + ",mac="s + mac + ",addressOrigin="s +
+            addressOrigin;
 
         sdbusplus::bus_t bus(ipmid_get_sd_bus_connection());
 
@@ -561,15 +561,15 @@
 {
     sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
 
-    auto chassisStateObj = ipmi::getDbusObject(bus, chassisPOHStateIntf,
-                                               chassisStateRoot, match);
+    auto chassisStateObj =
+        ipmi::getDbusObject(bus, chassisPOHStateIntf, chassisStateRoot, match);
 
-    auto service = ipmi::getService(bus, chassisPOHStateIntf,
-                                    chassisStateObj.first);
+    auto service =
+        ipmi::getService(bus, chassisPOHStateIntf, chassisStateObj.first);
 
-    auto propValue = ipmi::getDbusProperty(bus, service, chassisStateObj.first,
-                                           chassisPOHStateIntf,
-                                           pohCounterProperty);
+    auto propValue =
+        ipmi::getDbusProperty(bus, service, chassisStateObj.first,
+                              chassisPOHStateIntf, pohCounterProperty);
 
     return std::get<uint32_t>(propValue);
 }
@@ -617,9 +617,9 @@
         // [0] -1b = Chassis provides intrusion (physical security) sensor.
         // set to default value 0x0.
 
-        properties = ipmi::getAllDbusProperties(bus, chassisCapObject.second,
-                                                chassisCapObject.first,
-                                                chassisCapIntf);
+        properties =
+            ipmi::getAllDbusProperties(bus, chassisCapObject.second,
+                                       chassisCapObject.first, chassisCapIntf);
     }
     catch (const std::exception& e)
     {
@@ -691,11 +691,11 @@
         return ipmi::responseUnspecifiedError();
     }
 
-    return ipmi::responseSuccess(*chassisIntrusionFlag, *chassisFrontPanelFlag,
-                                 *chassisNMIFlag, *chassisPowerInterlockFlag, 0,
-                                 *chassisFRUInfoDevAddr, *chassisSDRDevAddr,
-                                 *chassisSELDevAddr, *chassisSMDevAddr,
-                                 *chassisBridgeDevAddr);
+    return ipmi::responseSuccess(
+        *chassisIntrusionFlag, *chassisFrontPanelFlag, *chassisNMIFlag,
+        *chassisPowerInterlockFlag, 0, *chassisFRUInfoDevAddr,
+        *chassisSDRDevAddr, *chassisSELDevAddr, *chassisSMDevAddr,
+        *chassisBridgeDevAddr);
 }
 
 /** @brief implements set chassis capalibities command
@@ -710,18 +710,18 @@
  *
  *  @returns IPMI completion code
  */
-ipmi::RspType<> ipmiSetChassisCap(bool intrusion, bool fpLockout,
-                                  uint6_t reserved1,
+ipmi::RspType<> ipmiSetChassisCap(
+    bool intrusion, bool fpLockout, uint6_t reserved1,
 
-                                  uint8_t fruDeviceAddr,
+    uint8_t fruDeviceAddr,
 
-                                  uint8_t sdrDeviceAddr,
+    uint8_t sdrDeviceAddr,
 
-                                  uint8_t selDeviceAddr,
+    uint8_t selDeviceAddr,
 
-                                  uint8_t smDeviceAddr,
+    uint8_t smDeviceAddr,
 
-                                  uint8_t bridgeDeviceAddr)
+    uint8_t bridgeDeviceAddr)
 {
     // check input data
     if (reserved1 != 0)
@@ -823,8 +823,8 @@
             transition);
 
     std::string service;
-    boost::system::error_code ec = ipmi::getService(ctx, hostStateIntf,
-                                                    hostStatePath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, hostStateIntf, hostStatePath, service);
 
     if (!ec)
     {
@@ -855,8 +855,8 @@
     constexpr auto chassisStateIntf = "xyz.openbmc_project.State.Chassis";
 
     std::string service;
-    boost::system::error_code ec = ipmi::getService(ctx, chassisStateIntf,
-                                                    chassisStatePath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, chassisStateIntf, chassisStatePath, service);
 
     // Convert to string equivalent of the passed in transition enum.
     auto request =
@@ -974,8 +974,8 @@
             "/xyz/openbmc_project/state/chassis0";
         constexpr const char* chassisStateIntf =
             "xyz.openbmc_project.State.Chassis";
-        auto service = ipmi::getService(*busp, chassisStateIntf,
-                                        chassisStatePath);
+        auto service =
+            ipmi::getService(*busp, chassisStateIntf, chassisStatePath);
 
         ipmi::Value powerState =
             ipmi::getDbusProperty(*busp, service, chassisStatePath,
@@ -992,8 +992,8 @@
                 "/org/openbmc/control/power0";
             constexpr const char* legacyPwrCtrlIntf =
                 "org.openbmc.control.Power";
-            auto service = ipmi::getService(*busp, legacyPwrCtrlIntf,
-                                            legacyPwrCtrlObj);
+            auto service =
+                ipmi::getService(*busp, legacyPwrCtrlIntf, legacyPwrCtrlObj);
 
             ipmi::Value variant = ipmi::getDbusProperty(
                 *busp, service, legacyPwrCtrlObj, legacyPwrCtrlIntf, "pgood");
@@ -1023,8 +1023,8 @@
     std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
     try
     {
-        auto service = ipmi::getService(*bus, powerControlIntf,
-                                        powerControlObj);
+        auto service =
+            ipmi::getService(*bus, powerControlIntf, powerControlObj);
 
         ipmi::Value variant = ipmi::getDbusProperty(
             *bus, service, powerControlObj, powerControlIntf, "PFail");
@@ -1101,8 +1101,8 @@
             chassisIntrusionStr);
         if (!ec)
         {
-            bool ret = (chassisIntrusionStr == "HardwareIntrusion") ? true
-                                                                    : false;
+            bool ret =
+                (chassisIntrusionStr == "HardwareIntrusion") ? true : false;
             return std::make_optional(ret);
         }
     }
@@ -1160,8 +1160,8 @@
     }
 
     //  Front Panel Button Capabilities and disable/enable status(Optional)
-    std::optional<bool> powerButtonReading = getButtonEnabled(powerButtonPath,
-                                                              powerButtonIntf);
+    std::optional<bool> powerButtonReading =
+        getButtonEnabled(powerButtonPath, powerButtonIntf);
     // allow disable if the interface is present
     bool powerButtonDisableAllow = static_cast<bool>(powerButtonReading);
     // default return the button is enabled (not disabled)
@@ -1172,8 +1172,8 @@
         powerButtonDisabled = *powerButtonReading;
     }
 
-    std::optional<bool> resetButtonReading = getButtonEnabled(resetButtonPath,
-                                                              resetButtonIntf);
+    std::optional<bool> resetButtonReading =
+        getButtonEnabled(resetButtonPath, resetButtonIntf);
     // allow disable if the interface is present
     bool resetButtonDisableAllow = static_cast<bool>(resetButtonReading);
     // default return the button is enabled (not disabled)
@@ -1299,8 +1299,8 @@
     constexpr const char* restartCauseIntf = "xyz.openbmc_project.State.Host";
 
     std::string service;
-    boost::system::error_code ec = ipmi::getService(ctx, restartCauseIntf,
-                                                    restartCausePath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, restartCauseIntf, restartCausePath, service);
     if (!ec)
     {
         std::string restartCauseStr;
@@ -1553,8 +1553,8 @@
     using namespace chassis::internal;
     std::string result;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootSourceIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootSourceIntf, bootSettingsPath, service);
     if (!ec)
     {
         ec = ipmi::getDbusProperty(ctx, service, bootSettingsPath,
@@ -1579,8 +1579,8 @@
 {
     using namespace chassis::internal;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootSourceIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootSourceIntf, bootSettingsPath, service);
     if (!ec)
     {
         ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath,
@@ -1605,8 +1605,8 @@
     using namespace chassis::internal;
     std::string result;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootModeIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootModeIntf, bootSettingsPath, service);
     if (!ec)
     {
         ec = ipmi::getDbusProperty(ctx, service, bootSettingsPath, bootModeIntf,
@@ -1630,8 +1630,8 @@
 {
     using namespace chassis::internal;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootModeIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootModeIntf, bootSettingsPath, service);
     if (!ec)
     {
         ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath, bootModeIntf,
@@ -1655,8 +1655,8 @@
     using namespace chassis::internal;
     std::string result;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootTypeIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootTypeIntf, bootSettingsPath, service);
 
     // Don't throw error if BootType interface is not present.
     // This interface is not relevant for some Host architectures
@@ -1687,8 +1687,8 @@
 {
     using namespace chassis::internal;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootTypeIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootTypeIntf, bootSettingsPath, service);
     if (!ec)
     {
         ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath, bootTypeIntf,
@@ -1716,8 +1716,8 @@
     using namespace chassis::internal;
     std::string result;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootEnableIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootEnableIntf, bootSettingsPath, service);
     if (!ec)
     {
         ec = ipmi::getDbusProperty(ctx, service, bootSettingsPath,
@@ -1741,8 +1741,8 @@
 {
     using namespace chassis::internal;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootEnableIntf,
-                                              bootSettingsPath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootEnableIntf, bootSettingsPath, service);
     if (!ec)
     {
         ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath,
@@ -1767,8 +1767,8 @@
     using namespace chassis::internal;
     std::string result;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootOneTimeIntf,
-                                              bootSettingsOneTimePath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootOneTimeIntf, bootSettingsOneTimePath, service);
     if (!ec)
     {
         ec = ipmi::getDbusProperty(ctx, service, bootSettingsOneTimePath,
@@ -1792,8 +1792,8 @@
 {
     using namespace chassis::internal;
     std::string service;
-    boost::system::error_code ec = getService(ctx, bootOneTimeIntf,
-                                              bootSettingsOneTimePath, service);
+    boost::system::error_code ec =
+        getService(ctx, bootOneTimeIntf, bootSettingsOneTimePath, service);
     if (!ec)
     {
         ec = ipmi::setDbusProperty(ctx, service, bootSettingsOneTimePath,
@@ -1833,11 +1833,10 @@
  *   parmIndicator - parameter valid/invalid indicator
  *   data          - configuration parameter data
  */
-ipmi::RspType<ipmi::message::Payload>
-    ipmiChassisGetSysBootOptions(ipmi::Context::ptr ctx,
-                                 uint7_t bootOptionParameter, bool reserved1,
-                                 [[maybe_unused]] uint8_t setSelector,
-                                 [[maybe_unused]] uint8_t blockSelector)
+ipmi::RspType<ipmi::message::Payload> ipmiChassisGetSysBootOptions(
+    ipmi::Context::ptr ctx, uint7_t bootOptionParameter, bool reserved1,
+    [[maybe_unused]] uint8_t setSelector,
+    [[maybe_unused]] uint8_t blockSelector)
 {
     ipmi::Cc rc;
     if (reserved1)
@@ -2321,10 +2320,9 @@
     return ipmi::responseSuccess(power_policy::allSupport, reserved);
 }
 
-ipmi::RspType<> ipmiSetFrontPanelButtonEnables(ipmi::Context::ptr ctx,
-                                               bool disablePowerButton,
-                                               bool disableResetButton, bool,
-                                               bool, uint4_t)
+ipmi::RspType<> ipmiSetFrontPanelButtonEnables(
+    ipmi::Context::ptr ctx, bool disablePowerButton, bool disableResetButton,
+    bool, bool, uint4_t)
 {
     using namespace chassis::internal;
 
diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
index 14eebb4..0c77ef7 100644
--- a/dbus-sdr/sdrutils.cpp
+++ b/dbus-sdr/sdrutils.cpp
@@ -85,8 +85,8 @@
     {
         return;
     }
-    nlohmann::json sensorFilterJSON = nlohmann::json::parse(filterFile, nullptr,
-                                                            false);
+    nlohmann::json sensorFilterJSON =
+        nlohmann::json::parse(filterFile, nullptr, false);
     nlohmann::json::iterator svcFilterit =
         sensorFilterJSON.find("ServiceFilter");
     if (svcFilterit == sensorFilterJSON.end())
@@ -96,15 +96,16 @@
 
     subtree.erase(std::remove_if(subtree.begin(), subtree.end(),
                                  [svcFilterit](SensorSubTree::value_type& kv) {
-        auto& [_, serviceToIfaces] = kv;
+                                     auto& [_, serviceToIfaces] = kv;
 
-        for (auto service = svcFilterit->begin(); service != svcFilterit->end();
-             ++service)
-        {
-            serviceToIfaces.erase(*service);
-        }
-        return serviceToIfaces.empty();
-    }),
+                                     for (auto service = svcFilterit->begin();
+                                          service != svcFilterit->end();
+                                          ++service)
+                                     {
+                                         serviceToIfaces.erase(*service);
+                                     }
+                                     return serviceToIfaces.empty();
+                                 }),
                   subtree.end());
 }
 
@@ -174,8 +175,8 @@
     static constexpr const std::array vrInterfaces = {
         "xyz.openbmc_project.Control.VoltageRegulatorMode"};
 
-    bool sensorRez = lbdUpdateSensorTree("/xyz/openbmc_project/sensors",
-                                         sensorInterfaces);
+    bool sensorRez =
+        lbdUpdateSensorTree("/xyz/openbmc_project/sensors", sensorInterfaces);
 
 #ifdef FEATURE_HYBRID_SENSORS
 
@@ -291,8 +292,8 @@
     return std::find_if(
         ipmi::sensor::sensors.begin(), ipmi::sensor::sensors.end(),
         [&path](const ipmi::sensor::IdInfoMap::value_type& findSensor) {
-        return findSensor.second.sensorPath == path;
-    });
+            return findSensor.second.sensorPath == path;
+        });
 }
 #endif
 
@@ -410,8 +411,8 @@
     return interfacesResponse;
 }
 
-std::map<std::string, Value> getEntityManagerProperties(const char* path,
-                                                        const char* interface)
+std::map<std::string, Value>
+    getEntityManagerProperties(const char* path, const char* interface)
 {
     std::map<std::string, Value> properties;
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
@@ -462,8 +463,8 @@
         return ipmiDecoratorPaths;
     }
 
-    ipmiDecoratorPaths = std::unordered_set<std::string>(paths.begin(),
-                                                         paths.end());
+    ipmiDecoratorPaths =
+        std::unordered_set<std::string>(paths.begin(), paths.end());
     return ipmiDecoratorPaths;
 }
 
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 6517fdd..b3786c9 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -135,24 +135,24 @@
     "type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
     "sensors/'",
     [](sdbusplus::message_t&) {
-    getSensorTree().clear();
-    getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
-    sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
-                     std::chrono::system_clock::now().time_since_epoch())
-                     .count();
-});
+        getSensorTree().clear();
+        getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+        sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
+                         std::chrono::system_clock::now().time_since_epoch())
+                         .count();
+    });
 
 static sdbusplus::bus::match_t sensorRemoved(
     *getSdBus(),
     "type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
     "sensors/'",
     [](sdbusplus::message_t&) {
-    getSensorTree().clear();
-    getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
-    sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
-                        std::chrono::system_clock::now().time_since_epoch())
-                        .count();
-});
+        getSensorTree().clear();
+        getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+        sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
+                            std::chrono::system_clock::now().time_since_epoch())
+                            .count();
+    });
 
 ipmi_ret_t getSensorConnection(ipmi::Context::ptr ctx, uint8_t sensnum,
                                std::string& connection, std::string& path,
@@ -206,40 +206,43 @@
     "type='signal',member='PropertiesChanged',interface='org.freedesktop.DBus."
     "Properties',arg0namespace='xyz.openbmc_project.Sensor.Threshold'",
     [](sdbusplus::message_t& m) {
-    boost::container::flat_map<std::string, std::variant<bool, double>> values;
-    m.read(std::string(), values);
+        boost::container::flat_map<std::string, std::variant<bool, double>>
+            values;
+        m.read(std::string(), values);
 
-    auto findAssert = std::find_if(values.begin(), values.end(),
-                                   [](const auto& pair) {
-        return pair.first.find("Alarm") != std::string::npos;
-    });
-    if (findAssert != values.end())
-    {
-        auto ptr = std::get_if<bool>(&(findAssert->second));
-        if (ptr == nullptr)
+        auto findAssert =
+            std::find_if(values.begin(), values.end(), [](const auto& pair) {
+                return pair.first.find("Alarm") != std::string::npos;
+            });
+        if (findAssert != values.end())
         {
-            lg2::error("thresholdChanged: Assert non bool");
-            return;
-        }
-        if (*ptr)
-        {
-            lg2::info("thresholdChanged: Assert, sensor path: {SENSOR_PATH}",
-                      "SENSOR_PATH", m.get_path());
-            thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
-        }
-        else
-        {
-            auto& value = thresholdDeassertMap[m.get_path()][findAssert->first];
-            if (value)
+            auto ptr = std::get_if<bool>(&(findAssert->second));
+            if (ptr == nullptr)
+            {
+                lg2::error("thresholdChanged: Assert non bool");
+                return;
+            }
+            if (*ptr)
             {
                 lg2::info(
-                    "thresholdChanged: deassert, sensor path: {SENSOR_PATH}",
+                    "thresholdChanged: Assert, sensor path: {SENSOR_PATH}",
                     "SENSOR_PATH", m.get_path());
-                value = *ptr;
+                thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
+            }
+            else
+            {
+                auto& value =
+                    thresholdDeassertMap[m.get_path()][findAssert->first];
+                if (value)
+                {
+                    lg2::info(
+                        "thresholdChanged: deassert, sensor path: {SENSOR_PATH}",
+                        "SENSOR_PATH", m.get_path());
+                    value = *ptr;
+                }
             }
         }
-    }
-});
+    });
 
 namespace sensor
 {
@@ -432,9 +435,8 @@
 }
 
 // Calculate VR Mode from input IPMI discrete event bytes
-static std::optional<std::string>
-    calculateVRMode(uint15_t assertOffset,
-                    const ipmi::DbusInterfaceMap::mapped_type& VRObject)
+static std::optional<std::string> calculateVRMode(
+    uint15_t assertOffset, const ipmi::DbusInterfaceMap::mapped_type& VRObject)
 {
     // get VR mode profiles from Supported Interface
     auto profiles = getSupportedVrProfiles(VRObject);
@@ -774,18 +776,16 @@
     return ipmi::responseSuccess();
 }
 
-ipmi::RspType<> ipmiSetSensorReading(ipmi::Context::ptr ctx,
-                                     uint8_t sensorNumber, uint8_t,
-                                     uint8_t reading, uint15_t assertOffset,
-                                     bool, uint15_t, bool, uint8_t, uint8_t,
-                                     uint8_t)
+ipmi::RspType<> ipmiSetSensorReading(
+    ipmi::Context::ptr ctx, uint8_t sensorNumber, uint8_t, uint8_t reading,
+    uint15_t assertOffset, bool, uint15_t, bool, uint8_t, uint8_t, uint8_t)
 {
     std::string connection;
     std::string path;
     std::vector<std::string> interfaces;
 
-    ipmi::Cc status = getSensorConnection(ctx, sensorNumber, connection, path,
-                                          &interfaces);
+    ipmi::Cc status =
+        getSensorConnection(ctx, sensorNumber, connection, path, &interfaces);
     if (status)
     {
         return ipmi::response(status);
@@ -807,14 +807,14 @@
         }
 
         // Only allow external SetSensor if write permission granted
-        if (!details::sdrWriteTable.getWritePermission((ctx->lun << 8) |
-                                                       sensorNumber))
+        if (!details::sdrWriteTable.getWritePermission(
+                (ctx->lun << 8) | sensorNumber))
         {
             return ipmi::responseResponseError();
         }
 
-        auto value = sensor::calculateValue(reading, sensorMap,
-                                            sensorObject->second);
+        auto value =
+            sensor::calculateValue(reading, sensorMap, sensorObject->second);
         if (!value)
         {
             return ipmi::responseResponseError();
@@ -863,8 +863,8 @@
         // VR sensors are treated as a special case and we will not check the
         // write permission for VR sensors, since they always deemed writable
         // and permission table are not applied to VR sensors.
-        auto vrMode = sensor::calculateVRMode(assertOffset,
-                                              sensorObject->second);
+        auto vrMode =
+            sensor::calculateVRMode(assertOffset, sensorObject->second);
         if (!vrMode)
         {
             return ipmi::responseResponseError();
@@ -982,8 +982,8 @@
         return ipmi::responseResponseError();
     }
 
-    uint8_t value = scaleIPMIValueFromDouble(reading, mValue, rExp, bValue,
-                                             bExp, bSigned);
+    uint8_t value =
+        scaleIPMIValueFromDouble(reading, mValue, rExp, bValue, bExp, bSigned);
     uint8_t operation =
         static_cast<uint8_t>(IPMISensorReadingByte2::sensorScanningEnable);
     operation |=
@@ -1032,16 +1032,15 @@
         {
             // This is the first reading, show the coefficients
             double step = (max - min) / 255.0;
-            std::cerr << "IPMI sensor "
-                      << details::sdrStatsTable.getName((ctx->lun << 8) |
-                                                        sensnum)
-                      << ": Range min=" << min << " max=" << max
-                      << ", step=" << step
-                      << ", Coefficients mValue=" << static_cast<int>(mValue)
-                      << " rExp=" << static_cast<int>(rExp)
-                      << " bValue=" << static_cast<int>(bValue)
-                      << " bExp=" << static_cast<int>(bExp)
-                      << " bSigned=" << static_cast<int>(bSigned) << "\n";
+            std::cerr
+                << "IPMI sensor "
+                << details::sdrStatsTable.getName((ctx->lun << 8) | sensnum)
+                << ": Range min=" << min << " max=" << max << ", step=" << step
+                << ", Coefficients mValue=" << static_cast<int>(mValue)
+                << " rExp=" << static_cast<int>(rExp)
+                << " bValue=" << static_cast<int>(bValue)
+                << " bExp=" << static_cast<int>(bExp)
+                << " bSigned=" << static_cast<int>(bSigned) << "\n";
         }
     }
 
@@ -1296,8 +1295,8 @@
 
             if (warningHigh != warningMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          warningHigh->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), warningHigh->second);
                 if (std::isfinite(value))
                 {
                     resp.warningHigh = scaleIPMIValueFromDouble(
@@ -1306,8 +1305,8 @@
             }
             if (warningLow != warningMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          warningLow->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), warningLow->second);
                 if (std::isfinite(value))
                 {
                     resp.warningLow = scaleIPMIValueFromDouble(
@@ -1324,8 +1323,8 @@
 
             if (criticalHigh != criticalMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          criticalHigh->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), criticalHigh->second);
                 if (std::isfinite(value))
                 {
                     resp.criticalHigh = scaleIPMIValueFromDouble(
@@ -1334,8 +1333,8 @@
             }
             if (criticalLow != criticalMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          criticalLow->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), criticalLow->second);
                 if (std::isfinite(value))
                 {
                     resp.criticalLow = scaleIPMIValueFromDouble(
@@ -1511,8 +1510,8 @@
             auto warningLow = warningMap.find("WarningLow");
             if (warningHigh != warningMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          warningHigh->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), warningHigh->second);
                 if (std::isfinite(value))
                 {
                     assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1525,8 +1524,8 @@
             }
             if (warningLow != warningMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          warningLow->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), warningLow->second);
                 if (std::isfinite(value))
                 {
                     assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1547,8 +1546,8 @@
 
             if (criticalHigh != criticalMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          criticalHigh->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), criticalHigh->second);
                 if (std::isfinite(value))
                 {
                     assertionEnabledMsb |= static_cast<uint8_t>(
@@ -1560,8 +1559,8 @@
             }
             if (criticalLow != criticalMap.end())
             {
-                double value = std::visit(VariantToDoubleVisitor(),
-                                          criticalLow->second);
+                double value =
+                    std::visit(VariantToDoubleVisitor(), criticalLow->second);
                 if (std::isfinite(value))
                 {
                     assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1731,15 +1730,15 @@
             }
             if (warningHighAlarm)
             {
-                assertions.set(
-                    static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
-                                            upperNonCriticalGoingHigh));
+                assertions.set(static_cast<size_t>(
+                    IPMIGetSensorEventEnableThresholds::
+                        upperNonCriticalGoingHigh));
             }
             if (warningLowAlarm)
             {
-                assertions.set(
-                    static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
-                                            lowerNonCriticalGoingLow));
+                assertions.set(static_cast<size_t>(
+                    IPMIGetSensorEventEnableThresholds::
+                        lowerNonCriticalGoingLow));
             }
         }
         if (criticalInterface != sensorMap.end())
@@ -1761,9 +1760,9 @@
             }
             if (criticalHighAlarm)
             {
-                assertions.set(
-                    static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
-                                            upperCriticalGoingHigh));
+                assertions.set(static_cast<size_t>(
+                    IPMIGetSensorEventEnableThresholds::
+                        upperCriticalGoingHigh));
             }
             if (criticalLowAlarm)
             {
@@ -1898,8 +1897,8 @@
     uint8_t bExpBits = bExp & 0x07;
 
     // move rExp and bExp into place
-    record.body.r_b_exponents = (rExpSign << 7) | (rExpBits << 4) |
-                                (bExpSign << 3) | bExpBits;
+    record.body.r_b_exponents =
+        (rExpSign << 7) | (rExpBits << 4) | (bExpSign << 3) | bExpBits;
 
     // Set the analog reading byte interpretation accordingly
     record.body.sensor_units_1 = (bSigned ? 1 : 0) << 7;
@@ -1923,8 +1922,8 @@
         sensorMap.find("xyz.openbmc_project.Sensor.ValueMutability");
     if (mutability != sensorMap.end())
     {
-        sensorSettable = mappedVariant<bool>(mutability->second, "Mutable",
-                                             false);
+        sensorSettable =
+            mappedVariant<bool>(mutability->second, "Mutable", false);
     }
     get_sdr::body::init_settable_state(sensorSettable, &record.body);
 
@@ -2173,9 +2172,9 @@
         ctx->lun = lun3;
     }
 
-    auto status = getSensorConnection(ctx,
-                                      static_cast<uint8_t>(sensNumFromRecID),
-                                      connection, path, &interfaces);
+    auto status =
+        getSensorConnection(ctx, static_cast<uint8_t>(sensNumFromRecID),
+                            connection, path, &interfaces);
     if (status)
     {
         lg2::error("getSensorDataRecord: getSensorConnection error");
@@ -2369,8 +2368,8 @@
         // Return the number of sensors attached to the LUN
         if ((ctx->lun == lun0) && (numSensors > 0))
         {
-            sdrCount = (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN
-                                                       : numSensors;
+            sdrCount =
+                (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN : numSensors;
         }
         else if ((ctx->lun == lun1) && (numSensors > maxSensorsPerLUN))
         {
@@ -2435,8 +2434,8 @@
     ipmiStorageGetSDRRepositoryInfo(ipmi::Context::ptr ctx)
 {
     constexpr const uint16_t unspecifiedFreeSpace = 0xFFFF;
-    uint16_t recordCount = ipmi::getNumberOfSensors() +
-                           ipmi::sensor::getOtherSensorsCount(ctx);
+    uint16_t recordCount =
+        ipmi::getNumberOfSensors() + ipmi::sensor::getOtherSensorsCount(ctx);
 
     uint8_t operationSupport = static_cast<uint8_t>(
         SdrRepositoryInfoOps::overflow); // write not supported
@@ -2535,8 +2534,8 @@
         return ipmi::responseSuccess(nextRecordId, record);
     }
 
-    size_t sdrLength = sizeof(get_sdr::SensorDataRecordHeader) +
-                       hdr->record_length;
+    size_t sdrLength =
+        sizeof(get_sdr::SensorDataRecordHeader) + hdr->record_length;
     if (offset >= sdrLength)
     {
         lg2::error("ipmiStorageGetSDR: offset is outside the record");
@@ -2831,8 +2830,8 @@
 
     for (const auto& sensor : sensorList)
     {
-        const auto& [readResult, tempVal,
-                     signBit] = readTemp(ctx, sensor.objectPath);
+        const auto& [readResult, tempVal, signBit] =
+            readTemp(ctx, sensor.objectPath);
 
         if (readResult)
         {
@@ -2931,14 +2930,14 @@
                           ipmi::storage::cmdGetSdr, ipmi::Privilege::User,
                           ipmiStorageGetSDR);
     // <Get DCMI Sensor Info>
-    ipmi::registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
-                               ipmi::dcmi::cmdGetDcmiSensorInfo,
-                               ipmi::Privilege::Operator,
-                               ipmi::dcmi::getSensorInfo);
+    ipmi::registerGroupHandler(
+        ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+        ipmi::dcmi::cmdGetDcmiSensorInfo, ipmi::Privilege::Operator,
+        ipmi::dcmi::getSensorInfo);
     // <Get Temperature Readings>
-    ipmi::registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
-                               ipmi::dcmi::cmdGetTemperatureReadings,
-                               ipmi::Privilege::User,
-                               ipmi::dcmi::getTempReadings);
+    ipmi::registerGroupHandler(
+        ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+        ipmi::dcmi::cmdGetTemperatureReadings, ipmi::Privilege::User,
+        ipmi::dcmi::getTempReadings);
 }
 } // namespace ipmi
diff --git a/dbus-sdr/sensorutils.cpp b/dbus-sdr/sensorutils.cpp
index e76a5f1..8c6952b 100644
--- a/dbus-sdr/sensorutils.cpp
+++ b/dbus-sdr/sensorutils.cpp
@@ -240,9 +240,8 @@
     // Step 4: Constrain B, and set bExp accordingly
     if (!(scaleFloatExp(dB, bExp)))
     {
-        std::cerr << "getSensorAttributes: Offset (B=" << dB
-                  << ", bExp=" << (int)bExp
-                  << ") exceeds multiplier scale (M=" << dM
+        std::cerr << "getSensorAttributes: Offset (B=" << dB << ", bExp="
+                  << (int)bExp << ") exceeds multiplier scale (M=" << dM
                   << ", rExp=" << (int)rExp << ")\n";
         return false;
     }
@@ -312,8 +311,8 @@
     int8_t bExp = 0;
     bool bSigned = false;
 
-    bool result = getSensorAttributes(max, min, mValue, rExp, bValue, bExp,
-                                      bSigned);
+    bool result =
+        getSensorAttributes(max, min, mValue, rExp, bValue, bExp, bSigned);
     if (!result)
     {
         throw std::runtime_error("Illegal sensor attributes");
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index afe3535..a93a045 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -236,8 +236,8 @@
     recalculateHashes();
 }
 
-std::pair<ipmi::Cc, std::vector<uint8_t>> getFru(ipmi::Context::ptr ctx,
-                                                 uint8_t devId)
+std::pair<ipmi::Cc, std::vector<uint8_t>>
+    getFru(ipmi::Context::ptr ctx, uint8_t devId)
 {
     if (lastDevId == devId && devId != 0xFF)
     {
@@ -297,55 +297,57 @@
     fruMatches.reserve(2);
 
     auto bus = getSdBus();
-    fruMatches.emplace_back(*bus,
-                            "type='signal',arg0path='/xyz/openbmc_project/"
-                            "FruDevice/',member='InterfacesAdded'",
-                            [](sdbusplus::message_t& message) {
-        sdbusplus::message::object_path path;
-        ObjectType object;
-        try
-        {
-            message.read(path, object);
-        }
-        catch (const sdbusplus::exception_t&)
-        {
-            return;
-        }
-        auto findType = object.find("xyz.openbmc_project.FruDevice");
-        if (findType == object.end())
-        {
-            return;
-        }
-        writeFruIfRunning();
-        frus[path] = object;
-        recalculateHashes();
-        lastDevId = 0xFF;
-    });
+    fruMatches.emplace_back(
+        *bus,
+        "type='signal',arg0path='/xyz/openbmc_project/"
+        "FruDevice/',member='InterfacesAdded'",
+        [](sdbusplus::message_t& message) {
+            sdbusplus::message::object_path path;
+            ObjectType object;
+            try
+            {
+                message.read(path, object);
+            }
+            catch (const sdbusplus::exception_t&)
+            {
+                return;
+            }
+            auto findType = object.find("xyz.openbmc_project.FruDevice");
+            if (findType == object.end())
+            {
+                return;
+            }
+            writeFruIfRunning();
+            frus[path] = object;
+            recalculateHashes();
+            lastDevId = 0xFF;
+        });
 
-    fruMatches.emplace_back(*bus,
-                            "type='signal',arg0path='/xyz/openbmc_project/"
-                            "FruDevice/',member='InterfacesRemoved'",
-                            [](sdbusplus::message_t& message) {
-        sdbusplus::message::object_path path;
-        std::set<std::string> interfaces;
-        try
-        {
-            message.read(path, interfaces);
-        }
-        catch (const sdbusplus::exception_t&)
-        {
-            return;
-        }
-        auto findType = interfaces.find("xyz.openbmc_project.FruDevice");
-        if (findType == interfaces.end())
-        {
-            return;
-        }
-        writeFruIfRunning();
-        frus.erase(path);
-        recalculateHashes();
-        lastDevId = 0xFF;
-    });
+    fruMatches.emplace_back(
+        *bus,
+        "type='signal',arg0path='/xyz/openbmc_project/"
+        "FruDevice/',member='InterfacesRemoved'",
+        [](sdbusplus::message_t& message) {
+            sdbusplus::message::object_path path;
+            std::set<std::string> interfaces;
+            try
+            {
+                message.read(path, interfaces);
+            }
+            catch (const sdbusplus::exception_t&)
+            {
+                return;
+            }
+            auto findType = interfaces.find("xyz.openbmc_project.FruDevice");
+            if (findType == interfaces.end())
+            {
+                return;
+            }
+            writeFruIfRunning();
+            frus.erase(path);
+            recalculateHashes();
+            lastDevId = 0xFF;
+        });
 
     // call once to populate
     boost::asio::spawn(*getIoContext(), [](boost::asio::yield_context yield) {
@@ -410,10 +412,9 @@
  *  @returns ipmi completion code plus response data
  *   - countWritten  - Count written
  */
-ipmi::RspType<uint8_t>
-    ipmiStorageWriteFruData(ipmi::Context::ptr ctx, uint8_t fruDeviceId,
-                            uint16_t fruInventoryOffset,
-                            std::vector<uint8_t>& dataToWrite)
+ipmi::RspType<uint8_t> ipmiStorageWriteFruData(
+    ipmi::Context::ptr ctx, uint8_t fruDeviceId, uint16_t fruInventoryOffset,
+    std::vector<uint8_t>& dataToWrite)
 {
     if (fruDeviceId == 0xFF)
     {
@@ -558,31 +559,33 @@
     uint8_t& address = device->second.second;
 
     boost::container::flat_map<std::string, Value>* fruData = nullptr;
-    auto fru = std::find_if(frus.begin(), frus.end(),
-                            [bus, address, &fruData](ManagedEntry& entry) {
-        auto findFruDevice = entry.second.find("xyz.openbmc_project.FruDevice");
-        if (findFruDevice == entry.second.end())
-        {
-            return false;
-        }
-        fruData = &(findFruDevice->second);
-        auto findBus = findFruDevice->second.find("BUS");
-        auto findAddress = findFruDevice->second.find("ADDRESS");
-        if (findBus == findFruDevice->second.end() ||
-            findAddress == findFruDevice->second.end())
-        {
-            return false;
-        }
-        if (std::get<uint32_t>(findBus->second) != bus)
-        {
-            return false;
-        }
-        if (std::get<uint32_t>(findAddress->second) != address)
-        {
-            return false;
-        }
-        return true;
-    });
+    auto fru = std::find_if(
+        frus.begin(), frus.end(),
+        [bus, address, &fruData](ManagedEntry& entry) {
+            auto findFruDevice =
+                entry.second.find("xyz.openbmc_project.FruDevice");
+            if (findFruDevice == entry.second.end())
+            {
+                return false;
+            }
+            fruData = &(findFruDevice->second);
+            auto findBus = findFruDevice->second.find("BUS");
+            auto findAddress = findFruDevice->second.find("ADDRESS");
+            if (findBus == findFruDevice->second.end() ||
+                findAddress == findFruDevice->second.end())
+            {
+                return false;
+            }
+            if (std::get<uint32_t>(findBus->second) != bus)
+            {
+                return false;
+            }
+            if (std::get<uint32_t>(findAddress->second) != address)
+            {
+                return false;
+            }
+            return true;
+        });
     if (fru == frus.end())
     {
         return IPMI_CC_RESPONSE_ERROR;
@@ -610,49 +613,49 @@
         return ipmi::ccResponseError;
     }
 
-    auto entity =
-        std::find_if(entities.begin(), entities.end(),
-                     [bus, address, &entityData, &name](ManagedEntry& entry) {
-        auto findFruDevice = entry.second.find(
-            "xyz.openbmc_project.Inventory.Decorator.I2CDevice");
-        if (findFruDevice == entry.second.end())
-        {
-            return false;
-        }
+    auto entity = std::find_if(
+        entities.begin(), entities.end(),
+        [bus, address, &entityData, &name](ManagedEntry& entry) {
+            auto findFruDevice = entry.second.find(
+                "xyz.openbmc_project.Inventory.Decorator.I2CDevice");
+            if (findFruDevice == entry.second.end())
+            {
+                return false;
+            }
 
-        // Integer fields added via Entity-Manager json are uint64_ts by
-        // default.
-        auto findBus = findFruDevice->second.find("Bus");
-        auto findAddress = findFruDevice->second.find("Address");
+            // Integer fields added via Entity-Manager json are uint64_ts by
+            // default.
+            auto findBus = findFruDevice->second.find("Bus");
+            auto findAddress = findFruDevice->second.find("Address");
 
-        if (findBus == findFruDevice->second.end() ||
-            findAddress == findFruDevice->second.end())
-        {
-            return false;
-        }
-        if ((std::get<uint64_t>(findBus->second) != bus) ||
-            (std::get<uint64_t>(findAddress->second) != address))
-        {
-            return false;
-        }
+            if (findBus == findFruDevice->second.end() ||
+                findAddress == findFruDevice->second.end())
+            {
+                return false;
+            }
+            if ((std::get<uint64_t>(findBus->second) != bus) ||
+                (std::get<uint64_t>(findAddress->second) != address))
+            {
+                return false;
+            }
 
-        auto fruName = findFruDevice->second.find("Name");
-        if (fruName != findFruDevice->second.end())
-        {
-            name = std::get<std::string>(fruName->second);
-        }
+            auto fruName = findFruDevice->second.find("Name");
+            if (fruName != findFruDevice->second.end())
+            {
+                name = std::get<std::string>(fruName->second);
+            }
 
-        // At this point we found the device entry and should return
-        // true.
-        auto findIpmiDevice =
-            entry.second.find("xyz.openbmc_project.Inventory.Decorator.Ipmi");
-        if (findIpmiDevice != entry.second.end())
-        {
-            entityData = &(findIpmiDevice->second);
-        }
+            // At this point we found the device entry and should return
+            // true.
+            auto findIpmiDevice = entry.second.find(
+                "xyz.openbmc_project.Inventory.Decorator.Ipmi");
+            if (findIpmiDevice != entry.second.end())
+            {
+                entityData = &(findIpmiDevice->second);
+            }
 
-        return true;
-    });
+            return true;
+        });
 
     if (entity == entities.end())
     {
@@ -747,8 +750,8 @@
                                dynamic_sensors::ipmi::sel::selLogFilename))
         {
             // If we find an ipmi_sel log file, save the path
-            selLogFiles.emplace_back(dynamic_sensors::ipmi::sel::selLogDir /
-                                     filename);
+            selLogFiles.emplace_back(
+                dynamic_sensors::ipmi::sel::selLogDir / filename);
         }
     }
     // As the log files rotate, they are appended with a ".#" that is higher for
@@ -1139,10 +1142,9 @@
   uint8_t eventType, uint8_t eventData1, uint8_t eventData2,
   uint8_t eventData3
 */
-ipmi::RspType<uint16_t> ipmiStorageAddSELEntry(uint16_t, uint8_t, uint32_t,
-                                               uint16_t, uint8_t, uint8_t,
-                                               uint8_t, uint8_t, uint8_t,
-                                               uint8_t, uint8_t)
+ipmi::RspType<uint16_t>
+    ipmiStorageAddSELEntry(uint16_t, uint8_t, uint32_t, uint16_t, uint8_t,
+                           uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
 {
     // Per the IPMI spec, need to cancel any reservation when a SEL entry is
     // added
@@ -1152,10 +1154,9 @@
     return ipmi::responseSuccess(responseID);
 }
 
-ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr ctx,
-                                           uint16_t reservationID,
-                                           const std::array<uint8_t, 3>& clr,
-                                           uint8_t eraseOperation)
+ipmi::RspType<uint8_t> ipmiStorageClearSEL(
+    ipmi::Context::ptr ctx, uint16_t reservationID,
+    const std::array<uint8_t, 3>& clr, uint8_t eraseOperation)
 {
     if (!checkSELReservation(reservationID))
     {
@@ -1198,9 +1199,8 @@
     return ipmi::responseSuccess(ipmi::sel::eraseComplete);
 }
 
-std::vector<uint8_t>
-    getType8SDRs(ipmi::sensor::EntityInfoMap::const_iterator& entity,
-                 uint16_t recordId)
+std::vector<uint8_t> getType8SDRs(
+    ipmi::sensor::EntityInfoMap::const_iterator& entity, uint16_t recordId)
 {
     std::vector<uint8_t> resp;
     get_sdr::SensorDataEntityRecord data{};
@@ -1252,8 +1252,8 @@
     }
     else
     {
-        throw std::runtime_error("getType12SDRs:: Illegal index " +
-                                 std::to_string(index));
+        throw std::runtime_error(
+            "getType12SDRs:: Illegal index " + std::to_string(index));
     }
 
     return resp;
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 77fe6c5..cfe8be2 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -107,8 +107,8 @@
 std::optional<uint32_t> getPcap(ipmi::Context::ptr& ctx)
 {
     std::string service{};
-    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
-                                                    pcapPath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, pcapInterface, pcapPath, service);
     if (ec.value())
     {
         return std::nullopt;
@@ -128,8 +128,8 @@
 std::optional<bool> getPcapEnabled(ipmi::Context::ptr& ctx)
 {
     std::string service{};
-    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
-                                                    pcapPath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, pcapInterface, pcapPath, service);
     if (ec.value())
     {
         return std::nullopt;
@@ -149,8 +149,8 @@
 bool setPcap(ipmi::Context::ptr& ctx, const uint32_t powerCap)
 {
     std::string service{};
-    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
-                                                    pcapPath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, pcapInterface, pcapPath, service);
     if (ec.value())
     {
         return false;
@@ -170,8 +170,8 @@
 bool setPcapEnable(ipmi::Context::ptr& ctx, bool enabled)
 {
     std::string service{};
-    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
-                                                    pcapPath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, pcapInterface, pcapPath, service);
     if (ec.value())
     {
         return false;
@@ -202,9 +202,9 @@
     }
 
     std::string assetTag{};
-    ec = ipmi::getDbusProperty(ctx, objectInfo.second, objectInfo.first,
-                               dcmi::assetTagIntf, dcmi::assetTagProp,
-                               assetTag);
+    ec =
+        ipmi::getDbusProperty(ctx, objectInfo.second, objectInfo.first,
+                              dcmi::assetTagIntf, dcmi::assetTagProp, assetTag);
     if (ec.value())
     {
         lg2::error("Error in reading asset tag: {ERROR}", "ERROR",
@@ -228,9 +228,9 @@
         return false;
     }
 
-    ec = ipmi::setDbusProperty(ctx, objectInfo.second, objectInfo.first,
-                               dcmi::assetTagIntf, dcmi::assetTagProp,
-                               assetTag);
+    ec =
+        ipmi::setDbusProperty(ctx, objectInfo.second, objectInfo.first,
+                              dcmi::assetTagIntf, dcmi::assetTagProp, assetTag);
     if (ec.value())
     {
         lg2::error("Error in writing asset tag: {ERROR}", "ERROR",
@@ -244,8 +244,8 @@
 std::optional<std::string> getHostName(ipmi::Context::ptr& ctx)
 {
     std::string service{};
-    boost::system::error_code ec = ipmi::getService(ctx, networkConfigIntf,
-                                                    networkConfigObj, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, networkConfigIntf, networkConfigObj, service);
     if (ec.value())
     {
         return std::nullopt;
@@ -579,9 +579,9 @@
     return ipmi::responseSuccess(nameSize, data);
 }
 
-ipmi::RspType<uint8_t> setMgmntCtrlIdStr(ipmi::Context::ptr& ctx,
-                                         uint8_t offset, uint8_t count,
-                                         std::vector<char> data)
+ipmi::RspType<uint8_t>
+    setMgmntCtrlIdStr(ipmi::Context::ptr& ctx, uint8_t offset, uint8_t count,
+                      std::vector<char> data)
 {
     if ((offset > dcmi::maxCtrlIdStrLen) || (count > dcmi::maxBytes) ||
         ((offset + count) > dcmi::maxCtrlIdStrLen))
@@ -689,8 +689,8 @@
                 data.value("FlushEntireSELUponRollOver", 0);
             bool recordLevelSELFlushUponRollOver =
                 data.value("RecordLevelSELFlushUponRollOver", 0);
-            uint12_t numberOfSELEntries = data.value("NumberOfSELEntries",
-                                                     0xcac);
+            uint12_t numberOfSELEntries =
+                data.value("NumberOfSELEntries", 0xcac);
             uint8_t tempMonitoringSamplingFreq =
                 data.value("TempMonitoringSamplingFreq", 0);
             payload.pack(numberOfSELEntries, reserved1,
@@ -739,9 +739,9 @@
 namespace temp_readings
 {
 
-std::tuple<bool, bool, uint8_t> readTemp(ipmi::Context::ptr& ctx,
-                                         const std::string& dbusService,
-                                         const std::string& dbusPath)
+std::tuple<bool, bool, uint8_t>
+    readTemp(ipmi::Context::ptr& ctx, const std::string& dbusService,
+             const std::string& dbusPath)
 {
     // Read the temperature value from d-bus object. Need some conversion.
     // As per the interface xyz.openbmc_project.Sensor.Value, the
@@ -756,8 +756,8 @@
     {
         return std::make_tuple(false, false, 0);
     }
-    auto temperature = std::visit(ipmi::VariantToDoubleVisitor(),
-                                  result.at("Value"));
+    auto temperature =
+        std::visit(ipmi::VariantToDoubleVisitor(), result.at("Value"));
     double absTemp = std::abs(temperature);
 
     auto findFactor = result.find("Scale");
@@ -933,9 +933,8 @@
     return ipmi::responseSuccess();
 }
 
-ipmi::RspType<ipmi::message::Payload> getDCMIConfParams(ipmi::Context::ptr& ctx,
-                                                        uint8_t parameter,
-                                                        uint8_t setSelector)
+ipmi::RspType<ipmi::message::Payload> getDCMIConfParams(
+    ipmi::Context::ptr& ctx, uint8_t parameter, uint8_t setSelector)
 {
     if (setSelector)
     {
@@ -1015,8 +1014,8 @@
 
     // Return default value if failed to read from D-Bus object
     std::string service{};
-    boost::system::error_code ec = ipmi::getService(ctx, dcmi::sensorValueIntf,
-                                                    objectPath, service);
+    boost::system::error_code ec =
+        ipmi::getService(ctx, dcmi::sensorValueIntf, objectPath, service);
     if (ec.value())
     {
         lg2::error("Failed to fetch service for D-Bus object, "
@@ -1106,10 +1105,9 @@
 namespace sensor_info
 {
 
-std::tuple<std::vector<uint16_t>, uint8_t> read(const std::string& type,
-                                                uint8_t instance,
-                                                const nlohmann::json& config,
-                                                uint8_t count)
+std::tuple<std::vector<uint16_t>, uint8_t>
+    read(const std::string& type, uint8_t instance,
+         const nlohmann::json& config, uint8_t count)
 {
     std::vector<uint16_t> responses{};
 
diff --git a/globalhandler.cpp b/globalhandler.cpp
index 63767c7..c164a20 100644
--- a/globalhandler.cpp
+++ b/globalhandler.cpp
@@ -20,8 +20,8 @@
 {
     sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
 
-    auto bmcStateObj = ipmi::getDbusObject(bus, bmcStateIntf, bmcStateRoot,
-                                           match);
+    auto bmcStateObj =
+        ipmi::getDbusObject(bus, bmcStateIntf, bmcStateRoot, match);
 
     auto service = ipmi::getService(bus, bmcStateIntf, bmcStateObj.first);
 
diff --git a/host-interface.cpp b/host-interface.cpp
index 7aa36c6..bc01d65 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -51,10 +51,10 @@
     lg2::debug("Pushing cmd on to queue, control host cmd: {CONTROL_HOST_CMD}",
                "CONTROL_HOST_CMD", convertForMessage(command));
 
-    auto cmd = std::make_tuple(ipmiCommand.at(command),
-                               std::bind(&Host::commandStatusHandler, this,
-                                         std::placeholders::_1,
-                                         std::placeholders::_2));
+    auto cmd = std::make_tuple(
+        ipmiCommand.at(command),
+        std::bind(&Host::commandStatusHandler, this, std::placeholders::_1,
+                  std::placeholders::_2));
 
     ipmid_send_cmd_to_host(std::move(cmd));
 }
diff --git a/include/dbus-sdr/sdrutils.hpp b/include/dbus-sdr/sdrutils.hpp
index 69864f9..db462db 100644
--- a/include/dbus-sdr/sdrutils.hpp
+++ b/include/dbus-sdr/sdrutils.hpp
@@ -120,9 +120,8 @@
         if ((numStreakRead == 0) && (numReadings != 0))
         {
             std::cerr << "IPMI sensor " << sensorName
-                      << ": Recovered reading, value=" << reading
-                      << " byte=" << raw
-                      << ", Reading counts good=" << numReadings
+                      << ": Recovered reading, value=" << reading << " byte="
+                      << raw << ", Reading counts good=" << numReadings
                       << " miss=" << numMissings
                       << ", Prior miss streak=" << numStreakMiss << "\n";
         }
@@ -346,8 +345,8 @@
 std::optional<std::map<std::string, std::vector<std::string>>>
     getObjectInterfaces(const char* path);
 
-std::map<std::string, Value> getEntityManagerProperties(const char* path,
-                                                        const char* interface);
+std::map<std::string, Value>
+    getEntityManagerProperties(const char* path, const char* interface);
 
 std::optional<std::unordered_set<std::string>>&
     getIpmiDecoratorPaths(const std::optional<ipmi::Context::ptr>& ctx);
diff --git a/include/dbus-sdr/storagecommands.hpp b/include/dbus-sdr/storagecommands.hpp
index 2ae9291..21c7613 100644
--- a/include/dbus-sdr/storagecommands.hpp
+++ b/include/dbus-sdr/storagecommands.hpp
@@ -99,8 +99,8 @@
                  uint8_t pwrStateNotification, uint8_t capabilities,
                  uint8_t eid, uint8_t entityInst, uint8_t mfrDefined,
                  const std::string& sensorname) :
-        targetAddress(address),
-        channelNumber(chNumber), powerStateNotification(pwrStateNotification),
+        targetAddress(address), channelNumber(chNumber),
+        powerStateNotification(pwrStateNotification),
         deviceCapabilities(capabilities), reserved{}, entityID(eid),
         entityInstance(entityInst), oem(mfrDefined)
     {
@@ -108,9 +108,9 @@
         header.sdr_version = ipmiSdrVersion;
         header.record_type = 0x12;
         size_t nameLen = std::min(sensorname.size(), sizeof(name));
-        header.record_length = sizeof(Type12Record) -
-                               sizeof(get_sdr::SensorDataRecordHeader) -
-                               sizeof(name) + nameLen;
+        header.record_length =
+            sizeof(Type12Record) - sizeof(get_sdr::SensorDataRecordHeader) -
+            sizeof(name) + nameLen;
         typeLengthCode = 0xc0 | nameLen;
         std::copy(sensorname.begin(), sensorname.begin() + nameLen, name);
     }
@@ -128,9 +128,8 @@
 
 ipmi_ret_t getFruSdrCount(ipmi::Context::ptr ctx, size_t& count);
 
-std::vector<uint8_t>
-    getType8SDRs(ipmi::sensor::EntityInfoMap::const_iterator& entity,
-                 uint16_t recordId);
+std::vector<uint8_t> getType8SDRs(
+    ipmi::sensor::EntityInfoMap::const_iterator& entity, uint16_t recordId);
 std::vector<uint8_t> getType12SDRs(uint16_t index, uint16_t recordId);
 std::vector<uint8_t> getNMDiscoverySDR(uint16_t index, uint16_t recordId);
 } // namespace storage
diff --git a/include/ipmid/message.hpp b/include/ipmid/message.hpp
index 64f7777..5264112 100644
--- a/include/ipmid/message.hpp
+++ b/include/ipmid/message.hpp
@@ -47,10 +47,9 @@
             uint8_t lun, Cmd cmd, int channel, int userId, uint32_t sessionId,
             Privilege priv, int rqSA, int hostIdx,
             boost::asio::yield_context& yield) :
-        bus(bus),
-        netFn(netFn), lun(lun), cmd(cmd), channel(channel), userId(userId),
-        sessionId(sessionId), priv(priv), rqSA(rqSA), hostIdx(hostIdx),
-        yield(yield)
+        bus(bus), netFn(netFn), lun(lun), cmd(cmd), channel(channel),
+        userId(userId), sessionId(sessionId), priv(priv), rqSA(rqSA),
+        hostIdx(hostIdx), yield(yield)
     {}
 
     std::shared_ptr<sdbusplus::asio::connection> bus;
@@ -256,8 +255,8 @@
     template <typename Arg, typename... Args>
     int pack(Arg&& arg, Args&&... args)
     {
-        int packRet = details::PackSingle_t<Arg>::op(*this,
-                                                     std::forward<Arg>(arg));
+        int packRet =
+            details::PackSingle_t<Arg>::op(*this, std::forward<Arg>(arg));
         if (packRet)
         {
             return packRet;
@@ -464,8 +463,8 @@
         size_t priorIndex = rawIndex;
         fixed_uint_t<details::bitStreamSize> priorBits = bitStream;
 
-        int ret = std::apply([this](Types&... args) { return unpack(args...); },
-                             t);
+        int ret =
+            std::apply([this](Types&... args) { return unpack(args...); }, t);
         if (ret)
         {
             bitCount = priorBitCount;
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 00fcf46..5ca94b6 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -310,8 +310,8 @@
     {
         return std::visit(
             [&p](const auto& arg) {
-            return PackSingle<std::decay_t<decltype(arg)>>::op(p, arg);
-        },
+                return PackSingle<std::decay_t<decltype(arg)>>::op(p, arg);
+            },
             v);
     }
 };
diff --git a/include/ipmid/types.hpp b/include/ipmid/types.hpp
index 7b26b6f..aacfb18 100644
--- a/include/ipmid/types.hpp
+++ b/include/ipmid/types.hpp
@@ -147,14 +147,14 @@
 
 inline Mutability operator|(Mutability lhs, Mutability rhs)
 {
-    return static_cast<Mutability>(static_cast<uint8_t>(lhs) |
-                                   static_cast<uint8_t>(rhs));
+    return static_cast<Mutability>(
+        static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs));
 }
 
 inline Mutability operator&(Mutability lhs, Mutability rhs)
 {
-    return static_cast<Mutability>(static_cast<uint8_t>(lhs) &
-                                   static_cast<uint8_t>(rhs));
+    return static_cast<Mutability>(
+        static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
 }
 
 struct Info
@@ -289,7 +289,7 @@
 {
   public:
     using SecureStringBase::basic_string;
-    SecureString(const SecureStringBase& other) : SecureStringBase(other){};
+    SecureString(const SecureStringBase& other) : SecureStringBase(other) {};
     SecureString(SecureString&) = default;
     SecureString(const SecureString&) = default;
     SecureString(SecureString&&) = default;
@@ -308,7 +308,7 @@
 {
   public:
     using SecureBufferBase::vector;
-    SecureBuffer(const SecureBufferBase& other) : SecureBufferBase(other){};
+    SecureBuffer(const SecureBufferBase& other) : SecureBufferBase(other) {};
     SecureBuffer(SecureBuffer&) = default;
     SecureBuffer(const SecureBuffer&) = default;
     SecureBuffer(SecureBuffer&&) = default;
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
index dd1eaa0..f31a532 100644
--- a/include/ipmid/utils.hpp
+++ b/include/ipmid/utils.hpp
@@ -120,10 +120,9 @@
  *  @param[in] match - identifier for object.
  *  @return On success returns the object having objectpath and servicename.
  */
-DbusObjectInfo getDbusObject(sdbusplus::bus_t& bus,
-                             const std::string& interface,
-                             const std::string& subtreePath = ROOT,
-                             const std::string& match = {});
+DbusObjectInfo getDbusObject(
+    sdbusplus::bus_t& bus, const std::string& interface,
+    const std::string& subtreePath = ROOT, const std::string& match = {});
 
 /** @brief Gets the value associated with the given object
  *         and the interface.
@@ -147,11 +146,10 @@
  *  @param[in] interface - Dbus interface.
  *  @return On success returns the map of name value pair.
  */
-PropertyMap
-    getAllDbusProperties(sdbusplus::bus_t& bus, const std::string& service,
-                         const std::string& objPath,
-                         const std::string& interface,
-                         std::chrono::microseconds timeout = IPMI_DBUS_TIMEOUT);
+PropertyMap getAllDbusProperties(
+    sdbusplus::bus_t& bus, const std::string& service,
+    const std::string& objPath, const std::string& interface,
+    std::chrono::microseconds timeout = IPMI_DBUS_TIMEOUT);
 
 /** @brief Gets all managed objects associated with the given object
  *         path and service.
@@ -185,10 +183,9 @@
  *  @param[in] match - Identifier for a path.
  *  @returns map of object path and service info.
  */
-ObjectTree getAllDbusObjects(sdbusplus::bus_t& bus,
-                             const std::string& serviceRoot,
-                             const std::string& interface,
-                             const std::string& match = {});
+ObjectTree getAllDbusObjects(
+    sdbusplus::bus_t& bus, const std::string& serviceRoot,
+    const std::string& interface, const std::string& match = {});
 
 /** @brief Deletes all the dbus objects from the given service root
            which matches the object identifier.
@@ -224,9 +221,9 @@
  *  @return boost error code
  *
  */
-boost::system::error_code getService(Context::ptr ctx, const std::string& intf,
-                                     const std::string& path,
-                                     std::string& service);
+boost::system::error_code
+    getService(Context::ptr ctx, const std::string& intf,
+               const std::string& path, std::string& service);
 
 /** @brief Gets the dbus sub tree implementing the given interface.
  *  @param[in] ctx - ipmi::Context::ptr
@@ -237,10 +234,9 @@
  *  @param[out] objectTree - map of object path and service info.
  *  @return map of object path and service info.
  */
-boost::system::error_code getSubTree(Context::ptr ctx,
-                                     const InterfaceList& interface,
-                                     const std::string& subtreePath,
-                                     int32_t depth, ObjectTree& objectTree);
+boost::system::error_code getSubTree(
+    Context::ptr ctx, const InterfaceList& interface,
+    const std::string& subtreePath, int32_t depth, ObjectTree& objectTree);
 
 /** @brief Gets the D-Bus object info implementing the given interface
  *         from the given subtree.
@@ -251,16 +247,14 @@
  *  @param[out] D-Bus object with path and service name
  *  @return - boost error code object
  */
-boost::system::error_code getDbusObject(Context::ptr ctx,
-                                        const std::string& interface,
-                                        const std::string& subtreePath,
-                                        const std::string& match,
-                                        DbusObjectInfo& dbusObject);
+boost::system::error_code
+    getDbusObject(Context::ptr ctx, const std::string& interface,
+                  const std::string& subtreePath, const std::string& match,
+                  DbusObjectInfo& dbusObject);
 
 // default for ROOT for subtreePath and std::string{} for match
-static inline boost::system::error_code
-    getDbusObject(Context::ptr ctx, const std::string& interface,
-                  DbusObjectInfo& dbusObject)
+static inline boost::system::error_code getDbusObject(
+    Context::ptr ctx, const std::string& interface, DbusObjectInfo& dbusObject)
 {
     return getDbusObject(ctx, interface, ROOT, {}, dbusObject);
 }
@@ -317,11 +311,9 @@
  *  @param[out] properties - map of name value pair.
  *  @return - boost error code object
  */
-boost::system::error_code getAllDbusProperties(Context::ptr ctx,
-                                               const std::string& service,
-                                               const std::string& objPath,
-                                               const std::string& interface,
-                                               PropertyMap& properties);
+boost::system::error_code getAllDbusProperties(
+    Context::ptr ctx, const std::string& service, const std::string& objPath,
+    const std::string& interface, PropertyMap& properties);
 
 /** @brief Sets the property value of the given object.
  *  @param[in] ctx - ipmi::Context::ptr
@@ -346,11 +338,10 @@
  *  @param[out] objectree - map of object path and service info.
  *  @return - boost error code object
  */
-boost::system::error_code getAllDbusObjects(Context::ptr ctx,
-                                            const std::string& serviceRoot,
-                                            const std::string& interface,
-                                            const std::string& match,
-                                            ObjectTree& objectTree);
+boost::system::error_code
+    getAllDbusObjects(Context::ptr ctx, const std::string& serviceRoot,
+                      const std::string& interface, const std::string& match,
+                      ObjectTree& objectTree);
 
 // default std::string{} for match
 static inline boost::system::error_code
@@ -368,10 +359,9 @@
  *  @param[in] interface - D-Bus interface.
  *  @param[in] match - Identifier for object.
  */
-boost::system::error_code deleteAllDbusObjects(Context::ptr ctx,
-                                               const std::string& serviceRoot,
-                                               const std::string& interface,
-                                               const std::string& match = {})
+boost::system::error_code deleteAllDbusObjects(
+    Context::ptr ctx, const std::string& serviceRoot,
+    const std::string& interface, const std::string& match = {})
     __attribute__((deprecated));
 
 /** @brief Gets all managed objects associated with the given object
@@ -382,10 +372,9 @@
  *  @param[out] objects - map of name value pair.
  *  @return - boost error code object
  */
-boost::system::error_code getManagedObjects(Context::ptr ctx,
-                                            const std::string& service,
-                                            const std::string& objPath,
-                                            ObjectValueTree& objects);
+boost::system::error_code
+    getManagedObjects(Context::ptr ctx, const std::string& service,
+                      const std::string& objPath, ObjectValueTree& objects);
 
 /** @brief Gets the ancestor objects of the given object
            which implements the given interface.
@@ -410,11 +399,9 @@
  *  @return - boost error code object
  */
 
-boost::system::error_code callDbusMethod(Context::ptr ctx,
-                                         const std::string& service,
-                                         const std::string& objPath,
-                                         const std::string& interface,
-                                         const std::string& method);
+boost::system::error_code callDbusMethod(
+    Context::ptr ctx, const std::string& service, const std::string& objPath,
+    const std::string& interface, const std::string& method);
 
 /********* End co-routine yielding alternatives ***************/
 
diff --git a/ipmi_fru_info_area.cpp b/ipmi_fru_info_area.cpp
index 3cbfb09..ed02179 100644
--- a/ipmi_fru_info_area.cpp
+++ b/ipmi_fru_info_area.cpp
@@ -47,8 +47,8 @@
 static constexpr auto secs_from_1970_1996 = 820454400;
 static constexpr auto maxMfgDateValue = 0xFFFFFF; // 3 Byte length
 static constexpr auto secs_per_min = 60;
-static constexpr auto secsToMaxMfgdate = secs_from_1970_1996 +
-                                         secs_per_min * maxMfgDateValue;
+static constexpr auto secsToMaxMfgdate =
+    secs_from_1970_1996 + secs_per_min * maxMfgDateValue;
 
 // Minimum size of resulting FRU blob.
 // This is also the theoretical maximum size according to the spec:
@@ -118,8 +118,8 @@
     padData(data);
 
     // Set size of data info area
-    data.at(areaSizeOffset) = (data.size() + checksumSize) /
-                              (recordUnitOfMeasurement);
+    data.at(areaSizeOffset) =
+        (data.size() + checksumSize) / (recordUnitOfMeasurement);
 
     // Finally add area checksum
     appendDataChecksum(data);
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index a34b581..1f3dfc1 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -297,8 +297,8 @@
         return errorResponse(request, ccReqDataLenInvalid);
     }
     auto group = static_cast<Group>(bytes);
-    message::Response::ptr response = executeIpmiCommandCommon(groupHandlerMap,
-                                                               group, request);
+    message::Response::ptr response =
+        executeIpmiCommandCommon(groupHandlerMap, group, request);
     ipmi::message::Payload prefix;
     prefix.pack(bytes);
     response->prepend(prefix);
@@ -317,8 +317,8 @@
 
     lg2::debug("unpack IANA {IANA}", "IANA", lg2::hex, iana);
 
-    message::Response::ptr response = executeIpmiCommandCommon(oemHandlerMap,
-                                                               iana, request);
+    message::Response::ptr response =
+        executeIpmiCommandCommon(oemHandlerMap, iana, request);
     ipmi::message::Payload prefix;
     prefix.pack(bytes);
     response->prepend(prefix);
@@ -366,27 +366,29 @@
     conn.async_method_call(
         [name](const boost::system::error_code ec,
                const std::string& nameOwner) {
-        if (ec)
-        {
-            lg2::error("Error getting dbus owner for {INTERFACE}", "INTERFACE",
-                       name);
-            return;
-        }
-        // start after ipmiDbusChannelPrefix (after the '.')
-        std::string chName = name.substr(std::strlen(ipmiDbusChannelMatch) + 1);
-        try
-        {
-            uint8_t channel = getChannelByName(chName);
-            uniqueNameToChannelNumber[nameOwner] = channel;
-            lg2::info("New interface mapping: {INTERFACE} -> channel {CHANNEL}",
-                      "INTERFACE", name, "CHANNEL", channel);
-        }
-        catch (const std::exception& e)
-        {
-            lg2::info("Failed interface mapping, no such name: {INTERFACE}",
-                      "INTERFACE", name);
-        }
-    },
+            if (ec)
+            {
+                lg2::error("Error getting dbus owner for {INTERFACE}",
+                           "INTERFACE", name);
+                return;
+            }
+            // start after ipmiDbusChannelPrefix (after the '.')
+            std::string chName =
+                name.substr(std::strlen(ipmiDbusChannelMatch) + 1);
+            try
+            {
+                uint8_t channel = getChannelByName(chName);
+                uniqueNameToChannelNumber[nameOwner] = channel;
+                lg2::info(
+                    "New interface mapping: {INTERFACE} -> channel {CHANNEL}",
+                    "INTERFACE", name, "CHANNEL", channel);
+            }
+            catch (const std::exception& e)
+            {
+                lg2::info("Failed interface mapping, no such name: {INTERFACE}",
+                          "INTERFACE", name);
+            }
+        },
         "org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner",
         name);
 }
@@ -396,26 +398,26 @@
     conn.async_method_call(
         [&io, &conn](const boost::system::error_code ec,
                      std::vector<std::string> busNames) {
-        if (ec)
-        {
-            lg2::error("Error getting dbus names: {ERROR}", "ERROR",
-                       ec.message());
-            std::exit(EXIT_FAILURE);
-            return;
-        }
-        // Try to make startup consistent
-        std::sort(busNames.begin(), busNames.end());
-
-        const std::string channelPrefix = std::string(ipmiDbusChannelMatch) +
-                                          ".";
-        for (const std::string& busName : busNames)
-        {
-            if (busName.find(channelPrefix) == 0)
+            if (ec)
             {
-                updateOwners(conn, busName);
+                lg2::error("Error getting dbus names: {ERROR}", "ERROR",
+                           ec.message());
+                std::exit(EXIT_FAILURE);
+                return;
             }
-        }
-    },
+            // Try to make startup consistent
+            std::sort(busNames.begin(), busNames.end());
+
+            const std::string channelPrefix =
+                std::string(ipmiDbusChannelMatch) + ".";
+            for (const std::string& busName : busNames)
+            {
+                if (busName.find(channelPrefix) == 0)
+                {
+                    updateOwners(conn, busName);
+                }
+            }
+        },
         "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
         "ListNames");
 }
@@ -489,10 +491,10 @@
 {
     const auto dbusResponse =
         [netFn, lun, cmd](Cc cc, const ipmi::SecureBuffer& data = {}) {
-        constexpr uint8_t netFnResponse = 0x01;
-        uint8_t retNetFn = netFn | netFnResponse;
-        return std::make_tuple(retNetFn, lun, cmd, cc, data);
-    };
+            constexpr uint8_t netFnResponse = 0x01;
+            uint8_t retNetFn = netFn | netFnResponse;
+            return std::make_tuple(retNetFn, lun, cmd, cc, data);
+        };
     std::string sender = m.get_sender();
     Privilege privilege = Privilege::None;
     int rqSA = 0;
@@ -572,9 +574,9 @@
                "SESSIONID", lg2::hex, sessionId, "PRIVILEGE",
                static_cast<uint8_t>(privilege), "RQSA", lg2::hex, rqSA);
 
-    auto ctx = std::make_shared<ipmi::Context>(getSdBus(), netFn, lun, cmd,
-                                               channel, userId, sessionId,
-                                               privilege, rqSA, hostIdx, yield);
+    auto ctx = std::make_shared<ipmi::Context>(
+        getSdBus(), netFn, lun, cmd, channel, userId, sessionId, privilege,
+        rqSA, hostIdx, yield);
     auto request = std::make_shared<ipmi::message::Request>(
         ctx, std::forward<ipmi::SecureBuffer>(data));
     message::Response::ptr response = executeIpmiCommand(request);
@@ -762,8 +764,8 @@
 {
     // make a copy so the next two moves don't wreak havoc on the stack
     sdbusplus::message_t b{m};
-    boost::asio::spawn(*getIoContext(),
-                       [b = std::move(b)](boost::asio::yield_context yield) {
+    boost::asio::spawn(*getIoContext(), [b = std::move(b)](
+                                            boost::asio::yield_context yield) {
         sdbusplus::message_t m{std::move(b)};
         unsigned char seq = 0, netFn = 0, lun = 0, cmd = 0;
         ipmi::SecureBuffer data;
@@ -869,8 +871,8 @@
 
     int exitCode = 0;
     // set up boost::asio signal handling
-    std::function<SignalResponse(int)> stopAsioRunLoop =
-        [&io, &exitCode](int signalNumber) {
+    std::function<SignalResponse(int)> stopAsioRunLoop = [&io, &exitCode](
+                                                             int signalNumber) {
         lg2::info("Received signal {SIGNAL}; quitting", "SIGNAL", signalNumber);
         io->stop();
         exitCode = signalNumber;
diff --git a/ipmisensor.cpp b/ipmisensor.cpp
index ee9be19..55e4914 100644
--- a/ipmisensor.cpp
+++ b/ipmisensor.cpp
@@ -50,33 +50,34 @@
     char text[64];
 };
 
-event_data_t g_fwprogress02h[] = {{0x00, "Unspecified"},
-                                  {0x01, "Memory Init"},
-                                  {0x02, "HD Init"},
-                                  {0x03, "Secondary Proc Init"},
-                                  {0x04, "User Authentication"},
-                                  {0x05, "User init system setup"},
-                                  {0x06, "USB configuration"},
-                                  {0x07, "PCI configuration"},
-                                  {0x08, "Option ROM Init"},
-                                  {0x09, "Video Init"},
-                                  {0x0A, "Cache Init"},
-                                  {0x0B, "SM Bus init"},
-                                  {0x0C, "Keyboard Init"},
-                                  {0x0D, "Embedded ctrl init"},
-                                  {0x0E, "Docking station attachment"},
-                                  {0x0F, "Enable docking station"},
-                                  {0x10, "Docking station ejection"},
-                                  {0x11, "Disabling docking station"},
-                                  {0x12, "Calling OS Wakeup"},
-                                  {0x13, "Starting OS"},
-                                  {0x14, "Baseboard Init"},
-                                  {0x15, ""},
-                                  {0x16, "Floppy Init"},
-                                  {0x17, "Keyboard Test"},
-                                  {0x18, "Pointing Device Test"},
-                                  {0x19, "Primary Proc Init"},
-                                  {0xFF, "Unknown"}};
+event_data_t g_fwprogress02h[] = {
+    {0x00, "Unspecified"},
+    {0x01, "Memory Init"},
+    {0x02, "HD Init"},
+    {0x03, "Secondary Proc Init"},
+    {0x04, "User Authentication"},
+    {0x05, "User init system setup"},
+    {0x06, "USB configuration"},
+    {0x07, "PCI configuration"},
+    {0x08, "Option ROM Init"},
+    {0x09, "Video Init"},
+    {0x0A, "Cache Init"},
+    {0x0B, "SM Bus init"},
+    {0x0C, "Keyboard Init"},
+    {0x0D, "Embedded ctrl init"},
+    {0x0E, "Docking station attachment"},
+    {0x0F, "Enable docking station"},
+    {0x10, "Docking station ejection"},
+    {0x11, "Disabling docking station"},
+    {0x12, "Calling OS Wakeup"},
+    {0x13, "Starting OS"},
+    {0x14, "Baseboard Init"},
+    {0x15, ""},
+    {0x16, "Floppy Init"},
+    {0x17, "Keyboard Test"},
+    {0x18, "Pointing Device Test"},
+    {0x19, "Primary Proc Init"},
+    {0xFF, "Unknown"}};
 
 event_data_t g_fwprogress00h[] = {
     {0x00, "Unspecified."},
diff --git a/libipmid/signals.cpp b/libipmid/signals.cpp
index 757103a..4ac5685 100644
--- a/libipmid/signals.cpp
+++ b/libipmid/signals.cpp
@@ -101,8 +101,8 @@
     if (!signals[signalNumber])
     {
         std::shared_ptr<boost::asio::io_context> io = getIoContext();
-        signals[signalNumber] = std::make_unique<SignalHandler>(io,
-                                                                signalNumber);
+        signals[signalNumber] =
+            std::make_unique<SignalHandler>(io, signalNumber);
     }
     signals[signalNumber]->registerHandler(priority, handler);
 }
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 81cc4c4..fb96ea6 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -39,10 +39,9 @@
 //  Currently mapper doesn't give the readable busname(gives busid) so we can't
 //  use busname to find the object,will do later once the support is there.
 
-DbusObjectInfo getDbusObject(sdbusplus::bus_t& bus,
-                             const std::string& interface,
-                             const std::string& serviceRoot,
-                             const std::string& match)
+DbusObjectInfo
+    getDbusObject(sdbusplus::bus_t& bus, const std::string& interface,
+                  const std::string& serviceRoot, const std::string& match)
 {
     std::vector<DbusInterface> interfaces;
     interfaces.emplace_back(interface);
@@ -67,10 +66,10 @@
     }
 
     // else search the match string in the object path
-    auto found = std::find_if(objectTree.begin(), objectTree.end(),
-                              [&match](const auto& object) {
-        return (object.first.find(match) != std::string::npos);
-    });
+    auto found = std::find_if(
+        objectTree.begin(), objectTree.end(), [&match](const auto& object) {
+            return (object.first.find(match) != std::string::npos);
+        });
 
     if (found == objectTree.end())
     {
@@ -101,11 +100,10 @@
     return value;
 }
 
-PropertyMap getAllDbusProperties(sdbusplus::bus_t& bus,
-                                 const std::string& service,
-                                 const std::string& objPath,
-                                 const std::string& interface,
-                                 std::chrono::microseconds timeout)
+PropertyMap getAllDbusProperties(
+    sdbusplus::bus_t& bus, const std::string& service,
+    const std::string& objPath, const std::string& interface,
+    std::chrono::microseconds timeout)
 {
     PropertyMap properties;
 
@@ -181,9 +179,8 @@
     cachedService = std::nullopt;
 }
 
-sdbusplus::message_t ServiceCache::newMethodCall(sdbusplus::bus_t& bus,
-                                                 const char* intf,
-                                                 const char* method)
+sdbusplus::message_t ServiceCache::newMethodCall(
+    sdbusplus::bus_t& bus, const char* intf, const char* method)
 {
     return bus.new_method_call(getService(bus).c_str(), path.c_str(), intf,
                                method);
@@ -197,10 +194,10 @@
 std::string getService(sdbusplus::bus_t& bus, const std::string& intf,
                        const std::string& path)
 {
-    auto mapperCall = bus.new_method_call("xyz.openbmc_project.ObjectMapper",
-                                          "/xyz/openbmc_project/object_mapper",
-                                          "xyz.openbmc_project.ObjectMapper",
-                                          "GetObject");
+    auto mapperCall =
+        bus.new_method_call("xyz.openbmc_project.ObjectMapper",
+                            "/xyz/openbmc_project/object_mapper",
+                            "xyz.openbmc_project.ObjectMapper", "GetObject");
 
     mapperCall.append(path);
     mapperCall.append(std::vector<std::string>({intf}));
@@ -233,10 +230,9 @@
     return objectTree;
 }
 
-ipmi::ObjectTree getAllDbusObjects(sdbusplus::bus_t& bus,
-                                   const std::string& serviceRoot,
-                                   const std::string& interface,
-                                   const std::string& match)
+ipmi::ObjectTree
+    getAllDbusObjects(sdbusplus::bus_t& bus, const std::string& serviceRoot,
+                      const std::string& interface, const std::string& match)
 {
     std::vector<std::string> interfaces;
     interfaces.emplace_back(interface);
@@ -331,9 +327,9 @@
 
 /********* Begin co-routine yielding alternatives ***************/
 
-boost::system::error_code getService(Context::ptr ctx, const std::string& intf,
-                                     const std::string& path,
-                                     std::string& service)
+boost::system::error_code
+    getService(Context::ptr ctx, const std::string& intf,
+               const std::string& path, std::string& service)
 {
     boost::system::error_code ec;
     std::map<std::string, std::vector<std::string>> mapperResponse =
@@ -350,10 +346,9 @@
     return ec;
 }
 
-boost::system::error_code getSubTree(Context::ptr ctx,
-                                     const InterfaceList& interfaces,
-                                     const std::string& subtreePath,
-                                     int32_t depth, ObjectTree& objectTree)
+boost::system::error_code getSubTree(
+    Context::ptr ctx, const InterfaceList& interfaces,
+    const std::string& subtreePath, int32_t depth, ObjectTree& objectTree)
 {
     boost::system::error_code ec;
     objectTree = ctx->bus->yield_method_call<ObjectTree>(
@@ -363,19 +358,18 @@
     return ec;
 }
 
-boost::system::error_code getDbusObject(Context::ptr ctx,
-                                        const std::string& interface,
-                                        const std::string& subtreePath,
-                                        const std::string& match,
-                                        DbusObjectInfo& dbusObject)
+boost::system::error_code
+    getDbusObject(Context::ptr ctx, const std::string& interface,
+                  const std::string& subtreePath, const std::string& match,
+                  DbusObjectInfo& dbusObject)
 {
     std::vector<DbusInterface> interfaces;
     interfaces.emplace_back(interface);
 
     auto depth = 0;
     ObjectTree objectTree;
-    boost::system::error_code ec = getSubTree(ctx, interfaces, subtreePath,
-                                              depth, objectTree);
+    boost::system::error_code ec =
+        getSubTree(ctx, interfaces, subtreePath, depth, objectTree);
 
     if (ec)
     {
@@ -402,10 +396,10 @@
     }
 
     // else search the match string in the object path
-    auto found = std::find_if(objectTree.begin(), objectTree.end(),
-                              [&match](const auto& object) {
-        return (object.first.find(match) != std::string::npos);
-    });
+    auto found = std::find_if(
+        objectTree.begin(), objectTree.end(), [&match](const auto& object) {
+            return (object.first.find(match) != std::string::npos);
+        });
 
     if (found == objectTree.end())
     {
@@ -423,11 +417,9 @@
     return ec;
 }
 
-boost::system::error_code getAllDbusProperties(Context::ptr ctx,
-                                               const std::string& service,
-                                               const std::string& objPath,
-                                               const std::string& interface,
-                                               PropertyMap& properties)
+boost::system::error_code getAllDbusProperties(
+    Context::ptr ctx, const std::string& service, const std::string& objPath,
+    const std::string& interface, PropertyMap& properties)
 {
     boost::system::error_code ec;
     properties = ctx->bus->yield_method_call<PropertyMap>(
@@ -448,18 +440,17 @@
     return ec;
 }
 
-boost::system::error_code getAllDbusObjects(Context::ptr ctx,
-                                            const std::string& serviceRoot,
-                                            const std::string& interface,
-                                            const std::string& match,
-                                            ObjectTree& objectTree)
+boost::system::error_code
+    getAllDbusObjects(Context::ptr ctx, const std::string& serviceRoot,
+                      const std::string& interface, const std::string& match,
+                      ObjectTree& objectTree)
 {
     std::vector<std::string> interfaces;
     interfaces.emplace_back(interface);
 
     auto depth = 0;
-    boost::system::error_code ec = getSubTree(ctx, interfaces, serviceRoot,
-                                              depth, objectTree);
+    boost::system::error_code ec =
+        getSubTree(ctx, interfaces, serviceRoot, depth, objectTree);
     if (ec)
     {
         return ec;
@@ -480,10 +471,9 @@
     return ec;
 }
 
-boost::system::error_code deleteAllDbusObjects(Context::ptr ctx,
-                                               const std::string& serviceRoot,
-                                               const std::string& interface,
-                                               const std::string& match)
+boost::system::error_code
+    deleteAllDbusObjects(Context::ptr ctx, const std::string& serviceRoot,
+                         const std::string& interface, const std::string& match)
 {
     ObjectTree objectTree;
     boost::system::error_code ec =
@@ -512,10 +502,9 @@
     return ec;
 }
 
-boost::system::error_code getManagedObjects(Context::ptr ctx,
-                                            const std::string& service,
-                                            const std::string& objPath,
-                                            ObjectValueTree& objects)
+boost::system::error_code
+    getManagedObjects(Context::ptr ctx, const std::string& service,
+                      const std::string& objPath, ObjectValueTree& objects)
 {
     boost::system::error_code ec;
     objects = ctx->bus->yield_method_call<ipmi::ObjectValueTree>(
@@ -524,10 +513,9 @@
     return ec;
 }
 
-boost::system::error_code getAllAncestors(Context::ptr ctx,
-                                          const std::string& path,
-                                          const InterfaceList& interfaces,
-                                          ObjectTree& objectTree)
+boost::system::error_code
+    getAllAncestors(Context::ptr ctx, const std::string& path,
+                    const InterfaceList& interfaces, ObjectTree& objectTree)
 {
     std::string interfaceList = convertToString(interfaces);
 
@@ -552,11 +540,9 @@
     return ec;
 }
 
-boost::system::error_code callDbusMethod(Context::ptr ctx,
-                                         const std::string& service,
-                                         const std::string& objPath,
-                                         const std::string& interface,
-                                         const std::string& method)
+boost::system::error_code callDbusMethod(
+    Context::ptr ctx, const std::string& service, const std::string& objPath,
+    const std::string& interface, const std::string& method)
 {
     boost::system::error_code ec;
     ctx->bus->yield_method_call(ctx->yield, ec, service, objPath, interface,
diff --git a/read_fru_data.cpp b/read_fru_data.cpp
index ec1b181..9e5fd59 100644
--- a/read_fru_data.cpp
+++ b/read_fru_data.cpp
@@ -144,8 +144,8 @@
     {
         for (auto& intf : instance.interfaces)
         {
-            ipmi::PropertyMap allProp = readAllProperties(intf.first,
-                                                          instance.path);
+            ipmi::PropertyMap allProp =
+                readAllProperties(intf.first, instance.path);
             for (auto& properties : intf.second)
             {
                 auto iter = allProp.find(properties.first);
diff --git a/selutility.cpp b/selutility.cpp
index f868708..4daebb1 100644
--- a/selutility.cpp
+++ b/selutility.cpp
@@ -296,8 +296,8 @@
         // Evaluate if the event is assertion or deassertion event
         if (std::get<bool>(iterResolved->second))
         {
-            record.event.eventRecord.eventType = deassertEvent |
-                                                 iter->second.eventReadingType;
+            record.event.eventRecord.eventType =
+                deassertEvent | iter->second.eventReadingType;
         }
         else
         {
@@ -322,8 +322,8 @@
     try
     {
         auto service = ipmi::getService(bus, assocIntf, objPath);
-        auto propValue = ipmi::getDbusProperty(bus, service, objPath, assocIntf,
-                                               assocProp);
+        auto propValue =
+            ipmi::getDbusProperty(bus, service, objPath, assocIntf, assocProp);
         assocs = std::get<std::vector<ipmi::Association>>(propValue);
     }
     catch (const std::exception& e)
@@ -417,14 +417,14 @@
 
     std::sort(paths.begin(), paths.end(),
               [](const std::string& a, const std::string& b) {
-        namespace fs = std::filesystem;
-        fs::path pathA(a);
-        fs::path pathB(b);
-        auto idA = std::stoul(pathA.filename().string());
-        auto idB = std::stoul(pathB.filename().string());
+                  namespace fs = std::filesystem;
+                  fs::path pathA(a);
+                  fs::path pathB(b);
+                  auto idA = std::stoul(pathA.filename().string());
+                  auto idB = std::stoul(pathB.filename().string());
 
-        return idA < idB;
-    });
+                  return idA < idB;
+              });
 }
 
 } // namespace sel
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 45e3835..3505dfb 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -199,9 +199,9 @@
 ipmi_ret_t eventdata(const SetSensorReadingReq&, const Info& sensorInfo,
                      uint8_t data)
 {
-    auto msg = makeDbusMsg("org.freedesktop.DBus.Properties",
-                           sensorInfo.sensorPath, "Set",
-                           sensorInfo.sensorInterface);
+    auto msg =
+        makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
+                    "Set", sensorInfo.sensorInterface);
 
     const auto& interface = sensorInfo.propertyInterfaces.begin();
     msg.append(interface->first);
diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp
index f111df1..1cedda5 100644
--- a/sensordatahandler.hpp
+++ b/sensordatahandler.hpp
@@ -243,8 +243,8 @@
 
     double value = std::get<T>(propValue) *
                    std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
-    int32_t rawData = (value - sensorInfo.scaledOffset) /
-                      sensorInfo.coefficientM;
+    int32_t rawData =
+        (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM;
 
     constexpr uint8_t sensorUnitsSignedBits = 2 << 6;
     constexpr uint8_t signedDataFormat = 0x80;
@@ -365,9 +365,8 @@
  *  @return Response for get sensor reading command.
  */
 template <typename T>
-std::optional<GetSensorResponse> readingAssertion(uint8_t id,
-                                                  const Info& sensorInfo,
-                                                  const PropertyMap& properties)
+std::optional<GetSensorResponse> readingAssertion(
+    uint8_t id, const Info& sensorInfo, const PropertyMap& properties)
 {
     GetSensorResponse response{};
     enableScanning(&response);
@@ -436,8 +435,8 @@
 
     double value = std::get<T>(iter->second) *
                    std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
-    int32_t rawData = (value - sensorInfo.scaledOffset) /
-                      sensorInfo.coefficientM;
+    int32_t rawData =
+        (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM;
 
     constexpr uint8_t sensorUnitsSignedBits = 2 << 6;
     constexpr uint8_t signedDataFormat = 0x80;
@@ -514,17 +513,17 @@
 ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData,
                             const Info& sensorInfo)
 {
-    auto msg = makeDbusMsg("org.freedesktop.DBus.Properties",
-                           sensorInfo.sensorPath, "Set",
-                           sensorInfo.sensorInterface);
+    auto msg =
+        makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
+                    "Set", sensorInfo.sensorInterface);
 
     const auto& interface = sensorInfo.propertyInterfaces.begin();
     msg.append(interface->first);
     for (const auto& property : interface->second)
     {
         msg.append(property.first);
-        std::variant<T> value = static_cast<T>((cmdData.assertOffset8_14 << 8) |
-                                               cmdData.assertOffset0_7);
+        std::variant<T> value = static_cast<T>(
+            (cmdData.assertOffset8_14 << 8) | cmdData.assertOffset0_7);
         msg.append(value);
     }
     return updateToDbus(msg);
@@ -544,9 +543,9 @@
 
     raw_value *= std::pow(10, sensorInfo.exponentR - sensorInfo.scale);
 
-    auto msg = makeDbusMsg("org.freedesktop.DBus.Properties",
-                           sensorInfo.sensorPath, "Set",
-                           sensorInfo.sensorInterface);
+    auto msg =
+        makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
+                    "Set", sensorInfo.sensorInterface);
 
     const auto& interface = sensorInfo.propertyInterfaces.begin();
     msg.append(interface->first);
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 7cbd2f8..dc0d85c 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -159,59 +159,60 @@
             std::make_unique<sdbusplus::bus::match_t>(
                 bus, interfacesRemoved() + argNpath(0, s.second.sensorPath),
                 [id = s.first](auto& /*msg*/) {
-            // Ideally this should work.
-            // But when a service is terminated or crashed, it does not
-            // emit interfacesRemoved signal. In that case it's handled
-            // by sensorsOwnerMatch
-            sensorCacheMap[id].reset();
-        }));
+                    // Ideally this should work.
+                    // But when a service is terminated or crashed, it does not
+                    // emit interfacesRemoved signal. In that case it's handled
+                    // by sensorsOwnerMatch
+                    sensorCacheMap[id].reset();
+                }));
         sensorUpdatedMatches.emplace(
-            s.first, std::make_unique<sdbusplus::bus::match_t>(
-                         bus,
-                         type::signal() + path(s.second.sensorPath) +
-                             member("PropertiesChanged"s) +
-                             interface("org.freedesktop.DBus.Properties"s),
-                         [&s](auto& msg) {
-            fillSensorIdServiceMap(s.second.sensorPath,
-                                   s.second.propertyInterfaces.begin()->first,
-                                   s.first);
-            try
-            {
-                // This is signal callback
-                std::string interfaceName;
-                msg.read(interfaceName);
-                ipmi::PropertyMap props;
-                msg.read(props);
-                s.second.getFunc(s.first, s.second, props);
-            }
-            catch (const std::exception& e)
-            {
-                sensorCacheMap[s.first].reset();
-            }
-        }));
+            s.first,
+            std::make_unique<sdbusplus::bus::match_t>(
+                bus,
+                type::signal() + path(s.second.sensorPath) +
+                    member("PropertiesChanged"s) +
+                    interface("org.freedesktop.DBus.Properties"s),
+                [&s](auto& msg) {
+                    fillSensorIdServiceMap(
+                        s.second.sensorPath,
+                        s.second.propertyInterfaces.begin()->first, s.first);
+                    try
+                    {
+                        // This is signal callback
+                        std::string interfaceName;
+                        msg.read(interfaceName);
+                        ipmi::PropertyMap props;
+                        msg.read(props);
+                        s.second.getFunc(s.first, s.second, props);
+                    }
+                    catch (const std::exception& e)
+                    {
+                        sensorCacheMap[s.first].reset();
+                    }
+                }));
     }
     sensorsOwnerMatch = std::make_unique<sdbusplus::bus::match_t>(
         bus, nameOwnerChanged(), [](auto& msg) {
-        std::string name;
-        std::string oldOwner;
-        std::string newOwner;
-        msg.read(name, oldOwner, newOwner);
+            std::string name;
+            std::string oldOwner;
+            std::string newOwner;
+            msg.read(name, oldOwner, newOwner);
 
-        if (!name.empty() && newOwner.empty())
-        {
-            // The service exits
-            const auto it = serviceToIdMap.find(name);
-            if (it == serviceToIdMap.end())
+            if (!name.empty() && newOwner.empty())
             {
-                return;
+                // The service exits
+                const auto it = serviceToIdMap.find(name);
+                if (it == serviceToIdMap.end())
+                {
+                    return;
+                }
+                for (const auto& id : it->second)
+                {
+                    // Invalidate cache
+                    sensorCacheMap[id].reset();
+                }
             }
-            for (const auto& id : it->second)
-            {
-                // Invalidate cache
-                sensorCacheMap[id].reset();
-            }
-        }
-    });
+        });
 }
 #endif
 
@@ -233,8 +234,8 @@
     try
     {
         sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
-        serviceName = ipmi::getService(bus, info.sensorInterface,
-                                       info.sensorPath);
+        serviceName =
+            ipmi::getService(bus, info.sensorInterface, info.sensorPath);
     }
     catch (const sdbusplus::exception_t&)
     {
@@ -470,13 +471,11 @@
 @return completion code on success.
 **/
 
-ipmi::RspType<> ipmiSetSensorReading(uint8_t sensorNumber, uint8_t operation,
-                                     uint8_t reading, uint8_t assertOffset0_7,
-                                     uint8_t assertOffset8_14,
-                                     uint8_t deassertOffset0_7,
-                                     uint8_t deassertOffset8_14,
-                                     uint8_t eventData1, uint8_t eventData2,
-                                     uint8_t eventData3)
+ipmi::RspType<> ipmiSetSensorReading(
+    uint8_t sensorNumber, uint8_t operation, uint8_t reading,
+    uint8_t assertOffset0_7, uint8_t assertOffset8_14,
+    uint8_t deassertOffset0_7, uint8_t deassertOffset8_14, uint8_t eventData1,
+    uint8_t eventData2, uint8_t eventData3)
 {
     lg2::debug("IPMI SET_SENSOR, sensorNumber: {SENSOR_NUM}", "SENSOR_NUM",
                lg2::hex, sensorNumber);
@@ -612,10 +611,10 @@
                 constexpr uint8_t assertionStatesLsb = 0;
                 constexpr uint8_t assertionStatesMsb = 0;
 
-                return ipmi::responseSuccess(senReading, reserved, readState,
-                                             senScanState, allEventMessageState,
-                                             assertionStatesLsb,
-                                             assertionStatesMsb);
+                return ipmi::responseSuccess(
+                    senReading, reserved, readState, senScanState,
+                    allEventMessageState, assertionStatesLsb,
+                    assertionStatesMsb);
             }
             sensorInfo.getFunc(sensorNum, sensorInfo, props);
         }
@@ -631,12 +630,12 @@
         ipmi::sensor::GetSensorResponse getResponse =
             iter->second.getFunc(iter->second);
 
-        return ipmi::responseSuccess(getResponse.reading, uint5_t(0),
-                                     getResponse.readingOrStateUnavailable,
-                                     getResponse.scanningEnabled,
-                                     getResponse.allEventMessagesEnabled,
-                                     getResponse.thresholdLevelsStates,
-                                     getResponse.discreteReadingSensorStates);
+        return ipmi::responseSuccess(
+            getResponse.reading, uint5_t(0),
+            getResponse.readingOrStateUnavailable, getResponse.scanningEnabled,
+            getResponse.allEventMessagesEnabled,
+            getResponse.thresholdLevelsStates,
+            getResponse.discreteReadingSensorStates);
 #endif
     }
 #ifdef UPDATE_FUNCTIONAL_ON_FAIL
@@ -815,10 +814,10 @@
 
     const auto& resp = sensorThresholdMap[sensorNum];
 
-    return ipmi::responseSuccess(resp.validMask, resp.lowerNonCritical,
-                                 resp.lowerCritical, resp.lowerNonRecoverable,
-                                 resp.upperNonCritical, resp.upperCritical,
-                                 resp.upperNonRecoverable);
+    return ipmi::responseSuccess(
+        resp.validMask, resp.lowerNonCritical, resp.lowerCritical,
+        resp.lowerNonRecoverable, resp.upperNonCritical, resp.upperCritical,
+        resp.upperNonRecoverable);
 }
 
 /** @brief implements the Set Sensor threshold command
@@ -1179,10 +1178,10 @@
         const auto& entityRecords =
             ipmi::sensor::EntityInfoMapContainer::getContainer()
                 ->getIpmiEntityRecords();
-        auto next_record_id = (entityRecords.size())
-                                  ? entityRecords.begin()->first +
-                                        ENTITY_RECORD_ID_START
-                                  : END_OF_RECORD;
+        auto next_record_id =
+            (entityRecords.size())
+                ? entityRecords.begin()->first + ENTITY_RECORD_ID_START
+                : END_OF_RECORD;
         get_sdr::response::set_next_record_id(next_record_id, resp);
     }
     else
@@ -1463,8 +1462,8 @@
     std::vector<uint8_t> eventData(req->data, req->data + count);
 
     sdbusplus::bus_t dbus(bus);
-    std::string service = ipmi::getService(dbus, ipmiSELAddInterface,
-                                           ipmiSELPath);
+    std::string service =
+        ipmi::getService(dbus, ipmiSELAddInterface, ipmiSELPath);
     sdbusplus::message_t writeSEL = dbus.new_method_call(
         service.c_str(), ipmiSELPath, ipmiSELAddInterface, "IpmiSelAdd");
     writeSEL.append(ipmiSELAddMessage, sensorPath, eventData, assert,
diff --git a/settings.cpp b/settings.cpp
index 3acb888..4564fa4 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -52,8 +52,8 @@
 Service Objects::service(const Path& path, const Interface& interface) const
 {
     using Interfaces = std::vector<Interface>;
-    auto mapperCall = bus.new_method_call(mapperService, mapperPath, mapperIntf,
-                                          "GetObject");
+    auto mapperCall =
+        bus.new_method_call(mapperService, mapperPath, mapperIntf, "GetObject");
     mapperCall.append(path);
     mapperCall.append(Interfaces({interface}));
 
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index c8580b5..96695b9 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -31,8 +31,8 @@
 
 void SoftPowerOff::sendHostShutDownCmd()
 {
-    auto ctrlHostPath = std::string{CONTROL_HOST_OBJ_MGR} + '/' + HOST_NAME +
-                        '0';
+    auto ctrlHostPath =
+        std::string{CONTROL_HOST_OBJ_MGR} + '/' + HOST_NAME + '0';
     auto host = ::ipmi::getService(this->bus, CONTROL_HOST_BUSNAME,
                                    ctrlHostPath.c_str());
 
diff --git a/storagehandler.cpp b/storagehandler.cpp
index f90de63..954ec7b 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -380,8 +380,8 @@
         }
 
         auto diff = ipmi::sel::selRecordSize - requestData->offset;
-        auto readLength = std::min(diff,
-                                   static_cast<int>(requestData->readLength));
+        auto readLength =
+            std::min(diff, static_cast<int>(requestData->readLength));
 
         std::memcpy(response, &record.nextRecordID,
                     sizeof(record.nextRecordID));
@@ -526,9 +526,9 @@
 
     sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
     auto service = ipmi::getService(bus, ipmi::sel::logIntf, ipmi::sel::logObj);
-    auto method = bus.new_method_call(service.c_str(), ipmi::sel::logObj,
-                                      ipmi::sel::logIntf,
-                                      ipmi::sel::logDeleteAllMethod);
+    auto method =
+        bus.new_method_call(service.c_str(), ipmi::sel::logObj,
+                            ipmi::sel::logIntf, ipmi::sel::logDeleteAllMethod);
     try
     {
         bus.call_noreply(method);
@@ -703,11 +703,11 @@
 
         bool assert = (eventDir & 0x80) ? false : true;
 
-        recordID = report<SELCreated>(Created::RECORD_TYPE(recordType),
-                                      Created::GENERATOR_ID(generatorID),
-                                      Created::SENSOR_DATA(selDataStr.c_str()),
-                                      Created::EVENT_DIR(assert),
-                                      Created::SENSOR_PATH(objpath.c_str()));
+        recordID = report<SELCreated>(
+            Created::RECORD_TYPE(recordType),
+            Created::GENERATOR_ID(generatorID),
+            Created::SENSOR_DATA(selDataStr.c_str()),
+            Created::EVENT_DIR(assert), Created::SENSOR_PATH(objpath.c_str()));
     }
 #ifdef OPEN_POWER_SUPPORT
     else if (recordType == procedureType)
@@ -726,8 +726,8 @@
     using namespace ipmi::fru;
 
     std::string service;
-    boost::system::error_code ec = getService(ctx, invItemInterface,
-                                              invObjPath + fruPath, service);
+    boost::system::error_code ec =
+        getService(ctx, invItemInterface, invObjPath + fruPath, service);
     if (!ec)
     {
         bool result;
@@ -866,8 +866,8 @@
     const auto& entityRecords =
         ipmi::sensor::EntityInfoMapContainer::getContainer()
             ->getIpmiEntityRecords();
-    uint16_t records = ipmi::sensor::sensors.size() + frus.size() +
-                       entityRecords.size();
+    uint16_t records =
+        ipmi::sensor::sensors.size() + frus.size() + entityRecords.size();
 
     return ipmi::responseSuccess(sdrVersion, records, freeSpace,
                                  additionTimestamp, deletionTimestamp,
diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp
index 39ed323..7768030 100644
--- a/systemintfcmds.cpp
+++ b/systemintfcmds.cpp
@@ -181,8 +181,8 @@
     objManager = std::make_unique<sdbusplus::server::manager_t>(
         *sdbusp, CONTROL_HOST_OBJ_MGR);
 
-    host = std::make_unique<phosphor::host::command::Host>(*sdbusp,
-                                                           objPath.c_str());
+    host = std::make_unique<phosphor::host::command::Host>(
+        *sdbusp, objPath.c_str());
     sdbusp->request_name(CONTROL_HOST_BUSNAME);
 
     return;
diff --git a/test/dbus-sdr/sensorcommands_unittest.cpp b/test/dbus-sdr/sensorcommands_unittest.cpp
index 6cdcd2b..bcd2f44 100644
--- a/test/dbus-sdr/sensorcommands_unittest.cpp
+++ b/test/dbus-sdr/sensorcommands_unittest.cpp
@@ -67,8 +67,8 @@
     if (bSigned)
     {
         int8_t expect = x;
-        int8_t actual = ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp,
-                                                       bSigned);
+        int8_t actual =
+            ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp, bSigned);
 
         result = actual;
         yRoundtrip = ipmitool_y_from_x(actual, M, rExp, B, bExp, bSigned);
@@ -78,8 +78,8 @@
     else
     {
         uint8_t expect = x;
-        uint8_t actual = ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp,
-                                                        bSigned);
+        uint8_t actual =
+            ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp, bSigned);
 
         result = actual;
         yRoundtrip = ipmitool_y_from_x(actual, M, rExp, B, bExp, bSigned);
@@ -430,8 +430,8 @@
         EXPECT_EQ(bExp, -1);
     }
 
-    scaledVal = ipmi::scaleIPMIValueFromDouble(5, mValue, rExp, bValue, bExp,
-                                               bSigned);
+    scaledVal =
+        ipmi::scaleIPMIValueFromDouble(5, mValue, rExp, bValue, bExp, bSigned);
 
     expected = 5 / (mValue * std::pow(10, rExp));
     EXPECT_NEAR(scaledVal, expected, expected * 0.01);
diff --git a/test/message/pack.cpp b/test/message/pack.cpp
index 334750e..57bff06 100644
--- a/test/message/pack.cpp
+++ b/test/message/pack.cpp
@@ -479,19 +479,19 @@
 
     ipmi::message::Payload p;
     p.pack(handle, maxSessions, currentSessions, activeSession, lanSession);
-    ASSERT_EQ(p.size(), sizeof(handle) + sizeof(maxSessions) +
-                            sizeof(currentSessions) + 3 * sizeof(uint8_t) +
-                            sizeof(uint32_t) + sizeof(uint8_t) * macSize +
-                            sizeof(uint16_t));
-    uint8_t protocol_channel = (static_cast<uint8_t>(protocol) << 4) |
-                               static_cast<uint8_t>(channel);
-    ipmi::SecureBuffer k = {handle, maxSessions, currentSessions, userID, priv,
-                            protocol_channel,
-                            // ip addr
-                            0x05, 0x01, 0x01, 0x0a,
-                            // mac addr
-                            0, 0, 0, 0, 0, 0,
-                            // port
-                            0x1f, 0xd8};
+    ASSERT_EQ(p.size(),
+              sizeof(handle) + sizeof(maxSessions) + sizeof(currentSessions) +
+                  3 * sizeof(uint8_t) + sizeof(uint32_t) +
+                  sizeof(uint8_t) * macSize + sizeof(uint16_t));
+    uint8_t protocol_channel =
+        (static_cast<uint8_t>(protocol) << 4) | static_cast<uint8_t>(channel);
+    ipmi::SecureBuffer k = {
+        handle, maxSessions, currentSessions, userID, priv, protocol_channel,
+        // ip addr
+        0x05, 0x01, 0x01, 0x0a,
+        // mac addr
+        0, 0, 0, 0, 0, 0,
+        // port
+        0x1f, 0xd8};
     ASSERT_EQ(p.raw, k);
 }
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 24b84c0..6e7dae2 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -75,8 +75,8 @@
            (path.size() == is || path[is] == '/');
 }
 
-std::optional<ChannelParams> maybeGetChannelParams(sdbusplus::bus_t& bus,
-                                                   uint8_t channel)
+std::optional<ChannelParams>
+    maybeGetChannelParams(sdbusplus::bus_t& bus, uint8_t channel)
 {
     auto ifname = getChannelName(channel);
     if (ifname.empty())
@@ -86,8 +86,8 @@
 
     // Enumerate all VLAN + ETHERNET interfaces
     std::vector<std::string> interfaces = {INTF_VLAN, INTF_ETHERNET};
-    ipmi::ObjectTree objs = ipmi::getSubTree(bus, interfaces,
-                                             std::string{PATH_ROOT});
+    ipmi::ObjectTree objs =
+        ipmi::getSubTree(bus, interfaces, std::string{PATH_ROOT});
 
     ChannelParams params;
     for (const auto& [path, impls] : objs)
@@ -258,9 +258,9 @@
 void createIfAddr(sdbusplus::bus_t& bus, const ChannelParams& params,
                   typename AddrFamily<family>::addr address, uint8_t prefix)
 {
-    auto newreq = bus.new_method_call(params.service.c_str(),
-                                      params.logicalPath.c_str(),
-                                      INTF_IP_CREATE, "IP");
+    auto newreq =
+        bus.new_method_call(params.service.c_str(), params.logicalPath.c_str(),
+                            INTF_IP_CREATE, "IP");
     std::string protocol =
         sdbusplus::common::xyz::openbmc_project::network::convertForMessage(
             AddrFamily<family>::protocol);
@@ -312,9 +312,9 @@
 }
 
 template <int family>
-std::optional<IfNeigh<family>> findGatewayNeighbor(sdbusplus::bus_t& bus,
-                                                   const ChannelParams& params,
-                                                   ObjectLookupCache& neighbors)
+std::optional<IfNeigh<family>>
+    findGatewayNeighbor(sdbusplus::bus_t& bus, const ChannelParams& params,
+                        ObjectLookupCache& neighbors)
 {
     auto gateway = getGatewayProperty<family>(bus, params);
     if (!gateway)
@@ -326,8 +326,8 @@
 }
 
 template <int family>
-std::optional<IfNeigh<family>> getGatewayNeighbor(sdbusplus::bus_t& bus,
-                                                  const ChannelParams& params)
+std::optional<IfNeigh<family>>
+    getGatewayNeighbor(sdbusplus::bus_t& bus, const ChannelParams& params)
 {
     ObjectLookupCache neighbors(bus, params, INTF_NEIGHBOR);
     return findGatewayNeighbor<family>(bus, params, neighbors);
@@ -345,8 +345,8 @@
     }
 
     ObjectLookupCache neighbors(bus, params, INTF_NEIGHBOR);
-    auto neighbor = findStaticNeighbor<family>(bus, params, *gateway,
-                                               neighbors);
+    auto neighbor =
+        findStaticNeighbor<family>(bus, params, *gateway, neighbors);
     if (neighbor)
     {
         deleteObjectIfExists(bus, params.service, neighbor->path);
@@ -550,8 +550,8 @@
     std::vector<IfAddr<AF_INET6>> ifaddrs6;
     for (uint8_t i = 0; i < MAX_IPV6_STATIC_ADDRESSES; ++i)
     {
-        auto ifaddr6 = findIfAddr<AF_INET6>(bus, params, i, originsV6Static,
-                                            ips);
+        auto ifaddr6 =
+            findIfAddr<AF_INET6>(bus, params, i, originsV6Static, ips);
         if (!ifaddr6)
         {
             break;
@@ -672,9 +672,9 @@
  */
 RspType<> setLanOem(uint8_t channel, uint8_t parameter, message::Payload& req)
     __attribute__((weak));
-RspType<message::Payload> getLanOem(uint8_t channel, uint8_t parameter,
-                                    uint8_t set, uint8_t block)
-    __attribute__((weak));
+RspType<message::Payload>
+    getLanOem(uint8_t channel, uint8_t parameter, uint8_t set, uint8_t block)
+        __attribute__((weak));
 
 RspType<> setLanOem(uint8_t, uint8_t, message::Payload& req)
 {
@@ -970,8 +970,8 @@
                 return responseReqDataLenInvalid();
             }
             unpackFinal(req);
-            if (std::bitset<8> expected(control &
-                                        std::bitset<8>(reservedRACCBits));
+            if (std::bitset<8> expected(
+                    control & std::bitset<8>(reservedRACCBits));
                 expected.any())
             {
                 return response(ccParamNotSupported);
@@ -1033,9 +1033,9 @@
                 return responseInvalidFieldRequest();
             }
 
-            uint8_t resp = getCipherConfigObject(csPrivFileName,
-                                                 csPrivDefaultFileName)
-                               .setCSPrivilegeLevels(channel, cipherSuitePrivs);
+            uint8_t resp =
+                getCipherConfigObject(csPrivFileName, csPrivDefaultFileName)
+                    .setCSPrivilegeLevels(channel, cipherSuitePrivs);
             if (!resp)
             {
                 return responseSuccess();
@@ -1532,11 +1532,9 @@
     return responseSuccess();
 }
 
-RspType<message::Payload> getSolConfParams(Context::ptr ctx,
-                                           uint4_t channelBits,
-                                           uint3_t /*reserved*/, bool revOnly,
-                                           uint8_t parameter, uint8_t /*set*/,
-                                           uint8_t /*block*/)
+RspType<message::Payload> getSolConfParams(
+    Context::ptr ctx, uint4_t channelBits, uint3_t /*reserved*/, bool revOnly,
+    uint8_t parameter, uint8_t /*set*/, uint8_t /*block*/)
 {
     message::Payload ret;
     constexpr uint8_t current_revision = 0x11;
diff --git a/transporthandler.hpp b/transporthandler.hpp
index 165eeda..a2137cd 100644
--- a/transporthandler.hpp
+++ b/transporthandler.hpp
@@ -65,8 +65,8 @@
  *  @param[in] channel - The channel id corresponding to an ethernet interface
  *  @return Ethernet interface service and object path if it exists
  */
-std::optional<ChannelParams> maybeGetChannelParams(sdbusplus::bus_t& bus,
-                                                   uint8_t channel);
+std::optional<ChannelParams>
+    maybeGetChannelParams(sdbusplus::bus_t& bus, uint8_t channel);
 
 /** @brief A trivial helper around maybeGetChannelParams() that throws an
  *         exception when it is unable to acquire parameters for the channel.
@@ -172,8 +172,7 @@
      */
     ObjectLookupCache(sdbusplus::bus_t& bus, const ChannelParams& params,
                       const char* intf) :
-        bus(bus),
-        params(params), intf(intf),
+        bus(bus), params(params), intf(intf),
         objs(getAllDbusObjects(bus, params.logicalPath, intf, ""))
     {}
 
@@ -349,10 +348,9 @@
 }
 
 template <int family>
-std::optional<IfNeigh<family>>
-    findStaticNeighbor(sdbusplus::bus_t&, const ChannelParams&,
-                       typename AddrFamily<family>::addr ip,
-                       ObjectLookupCache& neighbors)
+std::optional<IfNeigh<family>> findStaticNeighbor(
+    sdbusplus::bus_t&, const ChannelParams&,
+    typename AddrFamily<family>::addr ip, ObjectLookupCache& neighbors)
 {
     using sdbusplus::server::xyz::openbmc_project::network::Neighbor;
     const auto state =
@@ -395,9 +393,9 @@
                     typename AddrFamily<family>::addr address,
                     stdplus::EtherAddr mac)
 {
-    auto newreq = bus.new_method_call(params.service.c_str(),
-                                      params.logicalPath.c_str(),
-                                      INTF_NEIGHBOR_CREATE_STATIC, "Neighbor");
+    auto newreq =
+        bus.new_method_call(params.service.c_str(), params.logicalPath.c_str(),
+                            INTF_NEIGHBOR_CREATE_STATIC, "Neighbor");
     stdplus::ToStrHandle<stdplus::ToStr<stdplus::EtherAddr>> macToStr;
     stdplus::ToStrHandle<stdplus::ToStr<typename AddrFamily<family>::addr>>
         addrToStr;
diff --git a/user_channel/channel_layer.cpp b/user_channel/channel_layer.cpp
index 02dd055..26bc3fa 100644
--- a/user_channel/channel_layer.cpp
+++ b/user_channel/channel_layer.cpp
@@ -104,8 +104,8 @@
 
 Cc getChannelAccessPersistData(const uint8_t chNum, ChannelAccess& chAccessData)
 {
-    return getChannelConfigObject().getChannelAccessPersistData(chNum,
-                                                                chAccessData);
+    return getChannelConfigObject().getChannelAccessPersistData(
+        chNum, chAccessData);
 }
 
 Cc setChannelAccessPersistData(const uint8_t chNum,
@@ -125,8 +125,8 @@
 Cc getChannelEnabledAuthType(const uint8_t chNum, const uint8_t priv,
                              EAuthType& authType)
 {
-    return getChannelConfigObject().getChannelEnabledAuthType(chNum, priv,
-                                                              authType);
+    return getChannelConfigObject().getChannelEnabledAuthType(
+        chNum, priv, authType);
 }
 
 std::string getChannelName(const uint8_t chNum)
diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp
index 37d2b90..551b0b6 100644
--- a/user_channel/channel_layer.hpp
+++ b/user_channel/channel_layer.hpp
@@ -284,8 +284,8 @@
  *  @return same channel number or proper channel number for current channel
  * number (0xE).
  */
-static inline uint8_t convertCurrentChannelNum(const uint8_t chNum,
-                                               const uint8_t devChannel)
+static inline uint8_t
+    convertCurrentChannelNum(const uint8_t chNum, const uint8_t devChannel)
 {
     if (chNum == currentChNum)
     {
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index 13ea55b..ed95271 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -346,12 +346,12 @@
                     dBusPropertiesInterface) +
                 sdbusplus::bus::match::rules::argN(0, networkChConfigIntfName),
             [&](sdbusplus::message_t& msg) {
-            DbusChObjProperties props;
-            std::string iface;
-            std::string path = msg.get_path();
-            msg.read(iface, props);
-            processChAccessPropChange(path, props);
-        });
+                DbusChObjProperties props;
+                std::string iface;
+                std::string path = msg.get_path();
+                msg.read(iface, props);
+                processChAccessPropChange(path, props);
+            });
         signalHndlrObjectState = true;
 
         chInterfaceAddedSignal = std::make_unique<sdbusplus::bus::match_t>(
@@ -676,9 +676,8 @@
     return ccSuccess;
 }
 
-Cc ChannelConfig::getChannelEnabledAuthType(const uint8_t chNum,
-                                            const uint8_t priv,
-                                            EAuthType& authType)
+Cc ChannelConfig::getChannelEnabledAuthType(
+    const uint8_t chNum, const uint8_t priv, EAuthType& authType)
 {
     if (!isValidChannel(chNum))
     {
@@ -767,8 +766,8 @@
 EChannelSessSupported
     ChannelConfig::convertToSessionSupportIndex(const std::string& value)
 {
-    auto iter = std::find(sessionSupportList.begin(), sessionSupportList.end(),
-                          value);
+    auto iter =
+        std::find(sessionSupportList.begin(), sessionSupportList.end(), value);
     if (iter == sessionSupportList.end())
     {
         lg2::error("Invalid session supported: {SESS_STR}", "SESS_STR", value);
@@ -972,8 +971,8 @@
             chData.isChValid = channelFound &&
                                jsonChData[isValidString].get<bool>();
             chData.activeSessCount = jsonChData.value(activeSessionsString, 0);
-            chData.maxTransferSize = jsonChData.value(maxTransferSizeString,
-                                                      smallChannelSize);
+            chData.maxTransferSize =
+                jsonChData.value(maxTransferSizeString, smallChannelSize);
             if (jsonChData.count(isManagementNIC) != 0)
             {
                 chData.isManagementNIC =
@@ -1287,17 +1286,16 @@
     return ret;
 }
 
-int ChannelConfig::setDbusProperty(const std::string& service,
-                                   const std::string& objPath,
-                                   const std::string& interface,
-                                   const std::string& property,
-                                   const DbusVariant& value)
+int ChannelConfig::setDbusProperty(
+    const std::string& service, const std::string& objPath,
+    const std::string& interface, const std::string& property,
+    const DbusVariant& value)
 {
     try
     {
-        auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
-                                          "org.freedesktop.DBus.Properties",
-                                          "Set");
+        auto method =
+            bus.new_method_call(service.c_str(), objPath.c_str(),
+                                "org.freedesktop.DBus.Properties", "Set");
 
         method.append(interface, property, value);
 
diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp
index 321526f..f98a5e7 100644
--- a/user_channel/channelcommands.cpp
+++ b/user_channel/channelcommands.cpp
@@ -40,11 +40,10 @@
  *
  *  @ returns IPMI completion code
  **/
-RspType<> ipmiSetChannelAccess(Context::ptr ctx, uint4_t channel,
-                               uint4_t reserved1, uint3_t accessMode,
-                               bool usrAuth, bool msgAuth, bool alertDisabled,
-                               uint2_t chanAccess, uint4_t channelPrivLimit,
-                               uint2_t reserved2, uint2_t channelPrivMode)
+RspType<> ipmiSetChannelAccess(
+    Context::ptr ctx, uint4_t channel, uint4_t reserved1, uint3_t accessMode,
+    bool usrAuth, bool msgAuth, bool alertDisabled, uint2_t chanAccess,
+    uint4_t channelPrivLimit, uint2_t reserved2, uint2_t channelPrivMode)
 {
     if (reserved1 || reserved2 ||
         !isValidPrivLimit(static_cast<uint8_t>(channelPrivLimit)))
@@ -256,8 +255,8 @@
         return responseInvalidFieldRequest();
     }
 
-    uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
-                                             ctx->channel);
+    uint8_t chNum =
+        convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
     if (!isValidChannel(chNum))
     {
         lg2::debug("Get channel Info - No support on channel: {CHANNEL}",
@@ -325,8 +324,8 @@
     ipmiGetChannelPayloadSupport(Context::ptr ctx, uint4_t channel,
                                  uint4_t reserved)
 {
-    uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
-                                             ctx->channel);
+    uint8_t chNum =
+        convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
 
     if (!doesDeviceExist(chNum) || !isValidChannel(chNum) || reserved)
     {
@@ -369,8 +368,8 @@
     ipmiGetChannelPayloadVersion(Context::ptr ctx, uint4_t chNum,
                                  uint4_t reserved, uint8_t payloadTypeNum)
 {
-    uint8_t channel = convertCurrentChannelNum(static_cast<uint8_t>(chNum),
-                                               ctx->channel);
+    uint8_t channel =
+        convertCurrentChannelNum(static_cast<uint8_t>(chNum), ctx->channel);
     constexpr uint8_t payloadTypeNotSupported = 0x80;
 
     if (reserved || !isValidChannel(channel))
diff --git a/user_channel/cipher_mgmt.cpp b/user_channel/cipher_mgmt.cpp
index f1bc543..c954f65 100644
--- a/user_channel/cipher_mgmt.cpp
+++ b/user_channel/cipher_mgmt.cpp
@@ -118,8 +118,8 @@
 
 int CipherConfig::writeCSPrivilegeLevels(const Json& jsonData)
 {
-    std::string tmpFile = static_cast<std::string>(cipherSuitePrivFileName) +
-                          "_tmpXXXXXX";
+    std::string tmpFile =
+        static_cast<std::string>(cipherSuitePrivFileName) + "_tmpXXXXXX";
 
     std::vector<char> tmpRandomFile(tmpFile.length() + 1);
     strncpy(tmpRandomFile.data(), tmpFile.c_str(), tmpFile.length() + 1);
diff --git a/user_channel/file.hpp b/user_channel/file.hpp
index 76a03c7..204cfef 100644
--- a/user_channel/file.hpp
+++ b/user_channel/file.hpp
@@ -42,9 +42,7 @@
      *  @param[in] removeOnExit - File to be removed at exit or no
      */
     File(const std::string& name, const std::string& mode,
-         bool removeOnExit = false) :
-        name(name),
-        removeOnExit(removeOnExit)
+         bool removeOnExit = false) : name(name), removeOnExit(removeOnExit)
     {
         fp = fopen(name.c_str(), mode.c_str());
     }
@@ -57,9 +55,7 @@
      *  @param[in] removeOnExit - File to be removed at exit or no
      */
     File(int fd, const std::string& name, const std::string& mode,
-         bool removeOnExit = false) :
-        name(name),
-        removeOnExit(removeOnExit)
+         bool removeOnExit = false) : name(name), removeOnExit(removeOnExit)
     {
         fp = fdopen(fd, mode.c_str());
     }
diff --git a/user_channel/passwd_mgr.cpp b/user_channel/passwd_mgr.cpp
index 9b35ac7..f712779 100644
--- a/user_channel/passwd_mgr.cpp
+++ b/user_channel/passwd_mgr.cpp
@@ -141,12 +141,10 @@
     }
 }
 
-int PasswdMgr::encryptDecryptData(bool doEncrypt, const EVP_CIPHER* cipher,
-                                  uint8_t* key, size_t keyLen, uint8_t* iv,
-                                  size_t ivLen, uint8_t* inBytes,
-                                  size_t inBytesLen, uint8_t* mac,
-                                  size_t* macLen, unsigned char* outBytes,
-                                  size_t* outBytesLen)
+int PasswdMgr::encryptDecryptData(
+    bool doEncrypt, const EVP_CIPHER* cipher, uint8_t* key, size_t keyLen,
+    uint8_t* iv, size_t ivLen, uint8_t* inBytes, size_t inBytesLen,
+    uint8_t* mac, size_t* macLen, unsigned char* outBytes, size_t* outBytesLen)
 {
     if (cipher == NULL || key == NULL || iv == NULL || inBytes == NULL ||
         outBytes == NULL || mac == NULL || inBytesLen == 0 ||
@@ -163,9 +161,9 @@
         std::array<uint8_t, EVP_MAX_MD_SIZE> calMac;
         size_t calMacLen = calMac.size();
         // calculate MAC for the encrypted message.
-        if (NULL == HMAC(EVP_sha256(), key, keyLen, inBytes, inBytesLen,
-                         calMac.data(),
-                         reinterpret_cast<unsigned int*>(&calMacLen)))
+        if (NULL ==
+            HMAC(EVP_sha256(), key, keyLen, inBytes, inBytesLen, calMac.data(),
+                 reinterpret_cast<unsigned int*>(&calMacLen)))
         {
             lg2::debug("Error: Failed to calculate MAC");
             return -EIO;
@@ -203,8 +201,8 @@
                                    inBytes, inBytesLen)))
     {
         outLen += outEVPLen;
-        if ((retval = EVP_CipherFinal(ctx.get(), outBytes + outLen,
-                                      &outEVPLen)))
+        if ((retval =
+                 EVP_CipherFinal(ctx.get(), outBytes + outLen, &outEVPLen)))
         {
             outLen += outEVPLen;
             *outBytesLen = outLen;
@@ -503,9 +501,9 @@
         lg2::debug("Hash genertion failed, bailing out");
         return -EIO;
     }
-    if (NULL == HMAC(digest, keyBuff.data(), keyBuff.size(), hash.data(),
-                     hashLen, key.data(),
-                     reinterpret_cast<unsigned int*>(&keyLen)))
+    if (NULL ==
+        HMAC(digest, keyBuff.data(), keyBuff.size(), hash.data(), hashLen,
+             key.data(), reinterpret_cast<unsigned int*>(&keyLen)))
     {
         lg2::debug("Failed to create MAC for authentication");
         return -EIO;
diff --git a/user_channel/passwd_mgr.hpp b/user_channel/passwd_mgr.hpp
index 338f249..8932ac5 100644
--- a/user_channel/passwd_mgr.hpp
+++ b/user_channel/passwd_mgr.hpp
@@ -118,11 +118,10 @@
      *
      * @return error response
      */
-    int encryptDecryptData(bool doEncrypt, const EVP_CIPHER* cipher,
-                           uint8_t* key, size_t keyLen, uint8_t* iv,
-                           size_t ivLen, uint8_t* inBytes, size_t inBytesLen,
-                           uint8_t* mac, size_t* macLen, uint8_t* outBytes,
-                           size_t* outBytesLen);
+    int encryptDecryptData(
+        bool doEncrypt, const EVP_CIPHER* cipher, uint8_t* key, size_t keyLen,
+        uint8_t* iv, size_t ivLen, uint8_t* inBytes, size_t inBytesLen,
+        uint8_t* mac, size_t* macLen, uint8_t* outBytes, size_t* outBytesLen);
 
     /** @brief  returns updated file time of passwd file entry.
      *
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 979aaa6..81e409e 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -158,9 +158,9 @@
 {
     try
     {
-        auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
-                                          dBusPropertiesInterface,
-                                          setPropertiesMethod);
+        auto method =
+            bus.new_method_call(service.c_str(), objPath.c_str(),
+                                dBusPropertiesInterface, setPropertiesMethod);
         method.append(interface, property, value);
         bus.call(method);
     }
@@ -182,8 +182,8 @@
     {
         try
         {
-            userMgmtService = ipmi::getUserService(bus, userMgrInterface,
-                                                   userMgrObjBasePath);
+            userMgmtService =
+                ipmi::getUserService(bus, userMgrInterface, userMgrObjBasePath);
         }
         catch (const sdbusplus::exception_t& e)
         {
@@ -653,8 +653,8 @@
             return PAM_BUF_ERR;
         }
 
-        void* ptr = calloc(static_cast<size_t>(numMsg),
-                           sizeof(struct pam_response));
+        void* ptr =
+            calloc(static_cast<size_t>(numMsg), sizeof(struct pam_response));
         if (ptr == nullptr)
         {
             free(pass);
@@ -687,8 +687,8 @@
                                                const_cast<char*>(password)};
     pam_handle_t* localAuthHandle = NULL; // this gets set by pam_start
 
-    int retval = pam_start("passwd", username, &localConversation,
-                           &localAuthHandle);
+    int retval =
+        pam_start("passwd", username, &localConversation, &localAuthHandle);
 
     if (retval != PAM_SUCCESS)
     {
@@ -831,10 +831,9 @@
     return ccSuccess;
 }
 
-Cc UserAccess::setUserPayloadAccess(const uint8_t chNum,
-                                    const uint8_t operation,
-                                    const uint8_t userId,
-                                    const PayloadAccess& payloadAccess)
+Cc UserAccess::setUserPayloadAccess(
+    const uint8_t chNum, const uint8_t operation, const uint8_t userId,
+    const PayloadAccess& payloadAccess)
 {
     constexpr uint8_t enable = 0x0;
     constexpr uint8_t disable = 0x1;
@@ -1390,8 +1389,8 @@
 
         readPayloadAccessFromUserInfo(usersTbl.user[usrIndex], stdPayload,
                                       oemPayload);
-        Json jsonPayloadEnabledInfo = constructJsonPayloadEnables(stdPayload,
-                                                                  oemPayload);
+        Json jsonPayloadEnabledInfo =
+            constructJsonPayloadEnables(stdPayload, oemPayload);
         jsonUserInfo[payloadEnabledStr] = jsonPayloadEnabledInfo;
 
         jsonUsersTbl.push_back(jsonUserInfo);
@@ -1652,16 +1651,16 @@
                 sdbusplus::bus::match::rules::interface(dBusObjManager) +
                 sdbusplus::bus::match::rules::path(userMgrObjBasePath),
             [&](sdbusplus::message_t& msg) {
-            userUpdatedSignalHandler(*this, msg);
-        });
+                userUpdatedSignalHandler(*this, msg);
+            });
         userMgrRenamedSignal = std::make_unique<sdbusplus::bus::match_t>(
             bus,
             sdbusplus::bus::match::rules::type::signal() +
                 sdbusplus::bus::match::rules::interface(userMgrInterface) +
                 sdbusplus::bus::match::rules::path(userMgrObjBasePath),
             [&](sdbusplus::message_t& msg) {
-            userUpdatedSignalHandler(*this, msg);
-        });
+                userUpdatedSignalHandler(*this, msg);
+            });
         userPropertiesSignal = std::make_unique<sdbusplus::bus::match_t>(
             bus,
             sdbusplus::bus::match::rules::type::signal() +
@@ -1671,8 +1670,8 @@
                 sdbusplus::bus::match::rules::member(propertiesChangedSignal) +
                 sdbusplus::bus::match::rules::argN(0, usersInterface),
             [&](sdbusplus::message_t& msg) {
-            userUpdatedSignalHandler(*this, msg);
-        });
+                userUpdatedSignalHandler(*this, msg);
+            });
         signalHndlrObject = true;
     }
     std::map<DbusUserObjPath, DbusUserObjValue> managedObjs;
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 53b34f8..cc7174f 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -48,15 +48,15 @@
  *
  *  @returns ipmi completion code
  */
-ipmi::RspType<> ipmiSetUserAccess(ipmi::Context::ptr ctx, uint4_t channel,
-                                  uint1_t ipmiEnabled, uint1_t linkAuthEnabled,
-                                  uint1_t accessCallback, uint1_t bitsUpdate,
+ipmi::RspType<> ipmiSetUserAccess(
+    ipmi::Context::ptr ctx, uint4_t channel, uint1_t ipmiEnabled,
+    uint1_t linkAuthEnabled, uint1_t accessCallback, uint1_t bitsUpdate,
 
-                                  uint6_t userId, uint2_t reserved1,
+    uint6_t userId, uint2_t reserved1,
 
-                                  uint4_t privilege, uint4_t reserved2,
+    uint4_t privilege, uint4_t reserved2,
 
-                                  std::optional<uint8_t> sessionLimit)
+    std::optional<uint8_t> sessionLimit)
 {
     uint8_t sessLimit = sessionLimit.value_or(0);
     if (reserved1 || reserved2 || sessLimit ||
@@ -66,8 +66,8 @@
         return ipmi::responseInvalidFieldRequest();
     }
 
-    uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
-                                             ctx->channel);
+    uint8_t chNum =
+        convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
     if (!isValidChannel(chNum))
     {
         lg2::debug("Set user access - Invalid channel request");
@@ -137,8 +137,8 @@
 
                       uint6_t userId, uint2_t reserved2)
 {
-    uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
-                                             ctx->channel);
+    uint8_t chNum =
+        convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
 
     if (reserved1 || reserved2 || !isValidChannel(chNum))
     {
@@ -166,8 +166,8 @@
     }
 
     bool enabledState = false;
-    retStatus = ipmiUserCheckEnabled(static_cast<uint8_t>(userId),
-                                     enabledState);
+    retStatus =
+        ipmiUserCheckEnabled(static_cast<uint8_t>(userId), enabledState);
     if (retStatus != ccSuccess)
     {
         return ipmi::response(retStatus);
@@ -205,10 +205,9 @@
 
  *  @returns ipmi response
  */
-ipmi::RspType<>
-    ipmiSetUserName([[maybe_unused]] ipmi::Context::ptr ctx, uint6_t id,
-                    uint2_t reserved,
-                    const std::array<uint8_t, ipmi::ipmiMaxUserName>& name)
+ipmi::RspType<> ipmiSetUserName(
+    [[maybe_unused]] ipmi::Context::ptr ctx, uint6_t id, uint2_t reserved,
+    const std::array<uint8_t, ipmi::ipmiMaxUserName>& name)
 {
     if (reserved)
     {
@@ -319,8 +318,8 @@
     }
     else if (operation == opEnableUser || operation == opDisableUser)
     {
-        ipmi::Cc res = ipmiUserUpdateEnabledState(userId,
-                                                  static_cast<bool>(operation));
+        ipmi::Cc res =
+            ipmiUserUpdateEnabledState(userId, static_cast<bool>(operation));
         return ipmi::response(res);
     }
     else if (operation == opTestPassword)
@@ -405,14 +404,12 @@
               uint24_t, // oemID
               uint8_t   // oemAuxillary
               >
-    ipmiGetChannelAuthenticationCapabilities(ipmi::Context::ptr ctx,
-                                             uint4_t chNum, uint3_t reserved1,
-                                             [[maybe_unused]] bool extData,
-                                             uint4_t privLevel,
-                                             uint4_t reserved2)
+    ipmiGetChannelAuthenticationCapabilities(
+        ipmi::Context::ptr ctx, uint4_t chNum, uint3_t reserved1,
+        [[maybe_unused]] bool extData, uint4_t privLevel, uint4_t reserved2)
 {
-    uint8_t channel = convertCurrentChannelNum(static_cast<uint8_t>(chNum),
-                                               ctx->channel);
+    uint8_t channel =
+        convertCurrentChannelNum(static_cast<uint8_t>(chNum), ctx->channel);
 
     if (reserved1 || reserved2 || !isValidChannel(channel) ||
         !isValidPrivLimit(static_cast<uint8_t>(privLevel)))
@@ -498,8 +495,8 @@
 
     uint8_t oemPayloadEnables2Reserved)
 {
-    auto chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
-                                          ctx->channel);
+    auto chNum =
+        convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
     // Validate the reserved args. Only SOL payload is supported as on date.
     if (reserved || stdPayload0ipmiReserved || stdPayload2 || stdPayload3 ||
         stdPayload4 || stdPayload5 || stdPayload6 || stdPayload7 ||
@@ -593,8 +590,8 @@
 
                              uint6_t userId, uint2_t reserved2)
 {
-    uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
-                                             ctx->channel);
+    uint8_t chNum =
+        convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
 
     if (reserved1 || reserved2 || !isValidChannel(chNum))
     {
@@ -618,27 +615,28 @@
         return ipmi::response(retStatus);
     }
     constexpr uint8_t res8bits = 0;
-    return ipmi::responseSuccess(payloadAccess.stdPayloadEnables1.test(0),
-                                 payloadAccess.stdPayloadEnables1.test(1),
-                                 payloadAccess.stdPayloadEnables1.test(2),
-                                 payloadAccess.stdPayloadEnables1.test(3),
-                                 payloadAccess.stdPayloadEnables1.test(4),
-                                 payloadAccess.stdPayloadEnables1.test(5),
-                                 payloadAccess.stdPayloadEnables1.test(6),
-                                 payloadAccess.stdPayloadEnables1.test(7),
+    return ipmi::responseSuccess(
+        payloadAccess.stdPayloadEnables1.test(0),
+        payloadAccess.stdPayloadEnables1.test(1),
+        payloadAccess.stdPayloadEnables1.test(2),
+        payloadAccess.stdPayloadEnables1.test(3),
+        payloadAccess.stdPayloadEnables1.test(4),
+        payloadAccess.stdPayloadEnables1.test(5),
+        payloadAccess.stdPayloadEnables1.test(6),
+        payloadAccess.stdPayloadEnables1.test(7),
 
-                                 res8bits,
+        res8bits,
 
-                                 payloadAccess.oemPayloadEnables1.test(0),
-                                 payloadAccess.oemPayloadEnables1.test(1),
-                                 payloadAccess.oemPayloadEnables1.test(2),
-                                 payloadAccess.oemPayloadEnables1.test(3),
-                                 payloadAccess.oemPayloadEnables1.test(4),
-                                 payloadAccess.oemPayloadEnables1.test(5),
-                                 payloadAccess.oemPayloadEnables1.test(6),
-                                 payloadAccess.oemPayloadEnables1.test(7),
+        payloadAccess.oemPayloadEnables1.test(0),
+        payloadAccess.oemPayloadEnables1.test(1),
+        payloadAccess.oemPayloadEnables1.test(2),
+        payloadAccess.oemPayloadEnables1.test(3),
+        payloadAccess.oemPayloadEnables1.test(4),
+        payloadAccess.oemPayloadEnables1.test(5),
+        payloadAccess.oemPayloadEnables1.test(6),
+        payloadAccess.oemPayloadEnables1.test(7),
 
-                                 res8bits);
+        res8bits);
 }
 
 void registerUserIpmiFunctions() __attribute__((constructor));
diff --git a/whitelist-filter.cpp b/whitelist-filter.cpp
index 5e22f54..7fe4e22 100644
--- a/whitelist-filter.cpp
+++ b/whitelist-filter.cpp
@@ -59,8 +59,8 @@
     lg2::info("Loading allowlist filter");
     ipmi::registerFilter(ipmi::prioOpenBmcBase,
                          [this](ipmi::message::Request::ptr request) {
-        return filterMessage(request);
-    });
+                             return filterMessage(request);
+                         });
 
     // wait until io->run is going to fetch RestrictionMode
     post_work([this]() { postInit(); });
@@ -84,8 +84,8 @@
         try
         {
             restrictionModeSetting = dev;
-            restrictionModeService = objects->service(restrictionModeSetting,
-                                                      restrictionModeIntf);
+            restrictionModeService =
+                objects->service(restrictionModeSetting, restrictionModeIntf);
         }
         catch (const std::out_of_range& e)
         {
@@ -210,8 +210,8 @@
 
     modeChangeMatch = std::make_unique<sdbusplus::bus::match_t>(
         *bus, filterStr, [this, deviceList](sdbusplus::message_t& m) {
-        handleRestrictedModeChange(m, deviceList);
-    });
+            handleRestrictedModeChange(m, deviceList);
+        });
 }
 
 /** @brief Filter IPMI messages with RestrictedMode
