diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
 IndentWrappedFunctionNames: true
 InsertNewlineAtEOF: true
 KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
 LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
@@ -98,13 +98,14 @@
 ObjCSpaceBeforeProtocolList: true
 PackConstructorInitializers: BinPack
 PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
 PointerAlignment: Left
 QualifierAlignment: Left
 ReferenceAlignment: Left
diff --git a/include/biosxml.hpp b/include/biosxml.hpp
index 8881fdf..1e69454 100644
--- a/include/biosxml.hpp
+++ b/include/biosxml.hpp
@@ -92,8 +92,7 @@
          std::string descriptionStr, std::string defaultStr,
          std::string promptStr, std::string depexStr,
          std::string& setupTypeStr) :
-        depex(false),
-        readOnly(("ReadOnly" == setupTypeStr) ? true : false),
+        depex(false), readOnly(("ReadOnly" == setupTypeStr) ? true : false),
         currentVal(currentVal), nameStr(std::move(nameStr)),
         currentValStr(std::move(currentValStr)),
         descriptionStr(std::move(descriptionStr)),
@@ -177,8 +176,8 @@
     {
         return !s.empty() &&
                std::find_if(s.begin(), s.end(), [](unsigned char c) {
-            return !std::isdigit(c);
-        }) == s.end();
+                   return !std::isdigit(c);
+               }) == s.end();
     }
 
     /* Returns 'true' if the argument string is hex representation of a number.
@@ -203,8 +202,8 @@
             }
         }
 
-        std::string error = "Unable to find knob: " + variableName +
-                            " in knob list\n";
+        std::string error =
+            "Unable to find knob: " + variableName + " in knob list\n";
         phosphor::logging::log<phosphor::logging::level::ERR>(error.c_str());
 
         return false;
@@ -676,8 +675,8 @@
     {
         if (!getKnobs(filePath))
         {
-            std::string error = "Unable to get knobs in file: " +
-                                std::string(filePath);
+            std::string error =
+                "Unable to get knobs in file: " + std::string(filePath);
             throw std::runtime_error(error);
         }
     }
diff --git a/include/bridgingcommands.hpp b/include/bridgingcommands.hpp
index 9123174..8fbbc8d 100644
--- a/include/bridgingcommands.hpp
+++ b/include/bridgingcommands.hpp
@@ -74,9 +74,9 @@
 constexpr size_t ipmbChecksum2StartOffset = 3;
 constexpr size_t ipmbChecksumSize = 1;
 constexpr size_t ipmbMinFrameLength = 7;
-constexpr size_t ipmbMaxFrameLength = ipmbConnectionHeaderLength +
-                                      ipmbResponseDataHeaderLength +
-                                      ipmbChecksumSize + ipmbMaxDataSize;
+constexpr size_t ipmbMaxFrameLength =
+    ipmbConnectionHeaderLength + ipmbResponseDataHeaderLength +
+    ipmbChecksumSize + ipmbMaxDataSize;
 
 /**
  * @brief Channel types
diff --git a/include/commandutils.hpp b/include/commandutils.hpp
index 7ed49c8..12d8b2b 100644
--- a/include/commandutils.hpp
+++ b/include/commandutils.hpp
@@ -37,10 +37,9 @@
     }
 }
 
-inline static void ipmiPrintAndRegister(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                        ipmi_context_t context,
-                                        ipmid_callback_t handler,
-                                        ipmi_cmd_privilege_t priv)
+inline static void ipmiPrintAndRegister(
+    ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_context_t context,
+    ipmid_callback_t handler, ipmi_cmd_privilege_t priv)
 {
     printRegistration(netfn, cmd);
     ipmi_register_callback(netfn, cmd, context, handler, priv);
diff --git a/include/ipmi_to_redfish_hooks.hpp b/include/ipmi_to_redfish_hooks.hpp
index aefc85c..76f8b92 100644
--- a/include/ipmi_to_redfish_hooks.hpp
+++ b/include/ipmi_to_redfish_hooks.hpp
@@ -82,8 +82,8 @@
     // Log the record as a default Redfish message instead of a SEL record
 
     static const std::string openBMCMessageRegistryVersion("0.1");
-    std::string messageID = "OpenBMC." + openBMCMessageRegistryVersion +
-                            ".SELEntryAdded";
+    std::string messageID =
+        "OpenBMC." + openBMCMessageRegistryVersion + ".SELEntryAdded";
 
     std::vector<std::string> messageArgs;
     messageArgs.push_back(ipmiRaw);
diff --git a/include/manufacturingcommands.hpp b/include/manufacturingcommands.hpp
index f8eae09..7c85219 100644
--- a/include/manufacturingcommands.hpp
+++ b/include/manufacturingcommands.hpp
@@ -270,8 +270,8 @@
     {
         auto it = std::find_if(ledPropertyList.begin(), ledPropertyList.end(),
                                [&signal](const LedProperty& led) {
-            return led.getSignal() == signal;
-        });
+                                   return led.getSignal() == signal;
+                               });
         if (it != ledPropertyList.end())
         {
             return &(*it);
diff --git a/include/sdrutils.hpp b/include/sdrutils.hpp
index 9ec1611..ed28314 100644
--- a/include/sdrutils.hpp
+++ b/include/sdrutils.hpp
@@ -119,9 +119,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";
         }
@@ -249,10 +248,10 @@
 
     sensorTreePtr = std::make_shared<SensorSubTree>();
 
-    auto mapperCall = dbus.new_method_call("xyz.openbmc_project.ObjectMapper",
-                                           "/xyz/openbmc_project/object_mapper",
-                                           "xyz.openbmc_project.ObjectMapper",
-                                           "GetSubTree");
+    auto mapperCall =
+        dbus.new_method_call("xyz.openbmc_project.ObjectMapper",
+                             "/xyz/openbmc_project/object_mapper",
+                             "xyz.openbmc_project.ObjectMapper", "GetSubTree");
     static constexpr const auto depth = 2;
     static constexpr std::array<const char*, 3> interfaces = {
         "xyz.openbmc_project.Sensor.Value",
@@ -539,10 +538,9 @@
 
 // Follow Association properties for Sensor back to the Board dbus object to
 // check for an EntityId and EntityInstance property.
-static inline void updateIpmiFromAssociation(const std::string& path,
-                                             const SensorMap& sensorMap,
-                                             uint8_t& entityId,
-                                             uint8_t& entityInstance)
+static inline void updateIpmiFromAssociation(
+    const std::string& path, const SensorMap& sensorMap, uint8_t& entityId,
+    uint8_t& entityInstance)
 {
     namespace fs = std::filesystem;
 
diff --git a/include/sensorutils.hpp b/include/sensorutils.hpp
index c7ce53e..e06b2e1 100644
--- a/include/sensorutils.hpp
+++ b/include/sensorutils.hpp
@@ -155,10 +155,9 @@
 // To use with Wolfram Alpha, make all variables single letters
 // bExp becomes E, rExp becomes R
 // https://www.wolframalpha.com/input/?i=y%3D%28%28M*x%29%2B%28B*%2810%5EE%29%29%29*%2810%5ER%29
-static inline bool getSensorAttributes(const double max, const double min,
-                                       int16_t& mValue, int8_t& rExp,
-                                       int16_t& bValue, int8_t& bExp,
-                                       bool& bSigned)
+static inline bool getSensorAttributes(
+    const double max, const double min, int16_t& mValue, int8_t& rExp,
+    int16_t& bValue, int8_t& bExp, bool& bSigned)
 {
     if (!(std::isfinite(min)))
     {
@@ -249,9 +248,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;
     }
@@ -264,10 +262,9 @@
     return true;
 }
 
-static inline uint8_t
-    scaleIPMIValueFromDouble(const double value, const int16_t mValue,
-                             const int8_t rExp, const int16_t bValue,
-                             const int8_t bExp, const bool bSigned)
+static inline uint8_t scaleIPMIValueFromDouble(
+    const double value, const int16_t mValue, const int8_t rExp,
+    const int16_t bValue, const int8_t bExp, const bool bSigned)
 {
     // Avoid division by zero below
     if (mValue == 0)
@@ -322,8 +319,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/include/smbiosmdrv2handler.hpp b/include/smbiosmdrv2handler.hpp
index 99e6bb6..bcd18c9 100644
--- a/include/smbiosmdrv2handler.hpp
+++ b/include/smbiosmdrv2handler.hpp
@@ -277,39 +277,40 @@
                                ipmi::DbusVariant& value,
                                const std::string& service);
 
-    Mdr2DirStruct smbiosDir{smbiosAgentVersion,
-                            1,
-                            1,
-                            1,
-                            0,
-                            0,
-                            {40,
-                             41,
-                             42,
-                             43,
-                             44,
-                             45,
-                             46,
-                             47,
-                             48,
-                             49,
-                             50,
-                             51,
-                             52,
-                             53,
-                             54,
-                             0x42,
-                             0,
-                             smbiosTableStorageSize,
-                             smbiosTableVersion,
-                             smbiosTableTimestamp,
-                             MDR2SMBIOSStatusEnum::mdr2Init,
-                             MDR2DirLockEnum::mdr2DirUnlock,
-                             0,
-                             smbiosSMMemoryOffset,
-                             smbiosSMMemorySize,
-                             smbiosTableStorageSize,
-                             smbiosTableStorage}};
+    Mdr2DirStruct smbiosDir{
+        smbiosAgentVersion,
+        1,
+        1,
+        1,
+        0,
+        0,
+        {40,
+         41,
+         42,
+         43,
+         44,
+         45,
+         46,
+         47,
+         48,
+         49,
+         50,
+         51,
+         52,
+         53,
+         54,
+         0x42,
+         0,
+         smbiosTableStorageSize,
+         smbiosTableVersion,
+         smbiosTableTimestamp,
+         MDR2SMBIOSStatusEnum::mdr2Init,
+         MDR2DirLockEnum::mdr2DirUnlock,
+         0,
+         smbiosSMMemoryOffset,
+         smbiosSMMemorySize,
+         smbiosTableStorageSize,
+         smbiosTableStorage}};
     std::unique_ptr<SharedMemoryArea> area;
     std::unique_ptr<sdbusplus::Timer> timer;
 
diff --git a/include/storagecommands.hpp b/include/storagecommands.hpp
index c359702..221cecc 100644
--- a/include/storagecommands.hpp
+++ b/include/storagecommands.hpp
@@ -272,8 +272,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)
     {
@@ -281,9 +281,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);
     }
diff --git a/src/allowlist-filter.cpp b/src/allowlist-filter.cpp
index d02a826..0dbc270 100644
--- a/src/allowlist-filter.cpp
+++ b/src/allowlist-filter.cpp
@@ -108,8 +108,8 @@
 
     ipmi::registerFilter(ipmi::prioOpenBmcBase,
                          [this](ipmi::message::Request::ptr request) {
-        return filterMessage(request);
-    });
+                             return filterMessage(request);
+                         });
 
     channelSMM = getSMMChannel();
     // wait until io->run is going to fetch RestrictionMode
@@ -120,8 +120,8 @@
 {
     try
     {
-        auto service = ipmi::getService(*bus, restrictionModeIntf,
-                                        restrictionModePath);
+        auto service =
+            ipmi::getService(*bus, restrictionModeIntf, restrictionModePath);
         ipmi::Value v =
             ipmi::getDbusProperty(*bus, service, restrictionModePath,
                                   restrictionModeIntf, "RestrictionMode");
@@ -139,11 +139,11 @@
 
     try
     {
-        auto service = ipmi::getService(*bus, systemOsStatusIntf,
-                                        systemOsStatusPath);
-        ipmi::Value v = ipmi::getDbusProperty(*bus, service, systemOsStatusPath,
-                                              systemOsStatusIntf,
-                                              "OperatingSystemState");
+        auto service =
+            ipmi::getService(*bus, systemOsStatusIntf, systemOsStatusPath);
+        ipmi::Value v =
+            ipmi::getDbusProperty(*bus, service, systemOsStatusPath,
+                                  systemOsStatusIntf, "OperatingSystemState");
         auto& value = std::get<std::string>(v);
         updatePostComplete(value);
         log<level::INFO>("Read POST complete value",
@@ -267,16 +267,16 @@
 
     bus->async_method_call(
         [this](boost::system::error_code ec, const ipmi::Value& v) {
-        if (ec)
-        {
-            log<level::ERR>(
-                "async call failed, coreBIOSDone asserted as default");
-            return;
-        }
-        coreBIOSDone = std::get<bool>(v);
-        log<level::INFO>("Read CoreBiosDone",
-                         entry("VALUE=%d", static_cast<int>(coreBIOSDone)));
-    },
+            if (ec)
+            {
+                log<level::ERR>(
+                    "async call failed, coreBIOSDone asserted as default");
+                return;
+            }
+            coreBIOSDone = std::get<bool>(v);
+            log<level::INFO>("Read CoreBiosDone",
+                             entry("VALUE=%d", static_cast<int>(coreBIOSDone)));
+        },
         coreBiosDoneService, coreBiosDonePath,
         "org.freedesktop.DBus.Properties", "Get", hostMiscIntf, "CoreBiosDone");
 }
@@ -292,8 +292,8 @@
         auto it =
             std::find_if(propertyList.begin(), propertyList.end(),
                          [](const std::pair<std::string, ipmi::Value>& prop) {
-            return prop.first == "CoreBiosDone";
-        });
+                             return prop.first == "CoreBiosDone";
+                         });
 
         if (it != propertyList.end())
         {
@@ -392,12 +392,12 @@
         allowlist.cbegin(), allowlist.cend(),
         std::make_tuple(request->ctx->netFn, request->ctx->cmd, channelMask),
         [](const netfncmd_tuple& first, const netfncmd_tuple& value) {
-        return (std::get<2>(first) & std::get<2>(value))
-                   ? first < std::make_tuple(std::get<0>(value),
-                                             std::get<1>(value),
-                                             std::get<2>(first))
-                   : first < value;
-    });
+            return (std::get<2>(first) & std::get<2>(value))
+                       ? first < std::make_tuple(std::get<0>(value),
+                                                 std::get<1>(value),
+                                                 std::get<2>(first))
+                       : first < value;
+        });
 
     // no special handling for non-system-interface channels
     if (!(request->ctx->channel == ipmi::channelSystemIface ||
diff --git a/src/appcommands.cpp b/src/appcommands.cpp
index ab032c7..b3b3ed2 100644
--- a/src/appcommands.cpp
+++ b/src/appcommands.cpp
@@ -50,8 +50,8 @@
 int initBMCDeviceState(ipmi::Context::ptr ctx)
 {
     DbusObjectInfo objInfo;
-    boost::system::error_code ec = ipmi::getDbusObject(ctx, bmcStateIntf, "/",
-                                                       "bmc0", objInfo);
+    boost::system::error_code ec =
+        ipmi::getDbusObject(ctx, bmcStateIntf, "/", "bmc0", objInfo);
     if (ec)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -84,32 +84,32 @@
         sdbusplus::bus::match::rules::propertiesChanged(objInfo.first,
                                                         bmcStateIntf),
         [](sdbusplus::message_t& msg) {
-        std::map<std::string, ipmi::DbusVariant> props;
-        std::vector<std::string> inVal;
-        std::string iface;
-        try
-        {
-            msg.read(iface, props, inVal);
-        }
-        catch (const std::exception& e)
-        {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "Exception caught in Get CurrentBMCState");
-            return;
-        }
-
-        auto it = props.find(currentBmcStateProp);
-        if (it != props.end())
-        {
-            std::string* state = std::get_if<std::string>(&it->second);
-            if (state)
+            std::map<std::string, ipmi::DbusVariant> props;
+            std::vector<std::string> inVal;
+            std::string iface;
+            try
             {
-                bmcDeviceBusy = (*state != bmcStateReadyStr);
-                phosphor::logging::log<phosphor::logging::level::INFO>(
-                    "BMC device state updated");
+                msg.read(iface, props, inVal);
             }
-        }
-    });
+            catch (const std::exception& e)
+            {
+                phosphor::logging::log<phosphor::logging::level::ERR>(
+                    "Exception caught in Get CurrentBMCState");
+                return;
+            }
+
+            auto it = props.find(currentBmcStateProp);
+            if (it != props.end())
+            {
+                std::string* state = std::get_if<std::string>(&it->second);
+                if (state)
+                {
+                    bmcDeviceBusy = (*state != bmcStateReadyStr);
+                    phosphor::logging::log<phosphor::logging::level::INFO>(
+                        "BMC device state updated");
+                }
+            }
+        });
 
     return 0;
 }
@@ -381,10 +381,10 @@
         }
     }
 
-    return ipmi::responseSuccess(devId.id, devId.revision, devId.fwMajor,
-                                 bmcDeviceBusy, devId.fwMinor, devId.ipmiVer,
-                                 devId.addnDevSupport, devId.manufId,
-                                 devId.prodId, devId.aux);
+    return ipmi::responseSuccess(
+        devId.id, devId.revision, devId.fwMajor, bmcDeviceBusy, devId.fwMinor,
+        devId.ipmiVer, devId.addnDevSupport, devId.manufId, devId.prodId,
+        devId.aux);
 }
 
 static void registerAPPFunctions(void)
diff --git a/src/biosconfigcommands.cpp b/src/biosconfigcommands.cpp
index 8fbdbf5..ba2610a 100644
--- a/src/biosconfigcommands.cpp
+++ b/src/biosconfigcommands.cpp
@@ -199,8 +199,8 @@
         return false;
     }
 
-    std::string service = getService(*dbus, biosConfigIntf,
-                                     biosConfigBaseMgrPath);
+    std::string service =
+        getService(*dbus, biosConfigIntf, biosConfigBaseMgrPath);
 
     try
     {
@@ -404,20 +404,20 @@
         {
             pSdBusPlus->async_method_call(
                 [](const boost::system::error_code ec) {
-                /* No more need to keep attributes data in memory */
-                attributesData.clear();
+                    /* No more need to keep attributes data in memory */
+                    attributesData.clear();
 
-                if (ec)
-                {
-                    phosphor::logging::log<phosphor::logging::level::ERR>(
-                        "sendAllAttributes error: send all attributes - "
-                        "failed");
-                    return;
-                }
+                    if (ec)
+                    {
+                        phosphor::logging::log<phosphor::logging::level::ERR>(
+                            "sendAllAttributes error: send all attributes - "
+                            "failed");
+                        return;
+                    }
 
-                phosphor::logging::log<phosphor::logging::level::INFO>(
-                    "sendAllAttributes: send all attributes - done");
-            },
+                    phosphor::logging::log<phosphor::logging::level::INFO>(
+                        "sendAllAttributes: send all attributes - done");
+                },
                 service, biosConfigBaseMgrPath,
                 "org.freedesktop.DBus.Properties", "Set", biosConfigIntf,
                 "BaseBIOSTable",
@@ -467,11 +467,11 @@
     try
     {
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        Value variant =
-            getDbusProperty(*dbus, "xyz.openbmc_project.State.Host0",
-                            "/xyz/openbmc_project/state/host0",
-                            "xyz.openbmc_project.State.OperatingSystem.Status",
-                            "OperatingSystemState");
+        Value variant = getDbusProperty(
+            *dbus, "xyz.openbmc_project.State.Host0",
+            "/xyz/openbmc_project/state/host0",
+            "xyz.openbmc_project.State.OperatingSystem.Status",
+            "OperatingSystemState");
         auto& value = std::get<std::string>(variant);
 
         // The short strings "Standby" is deprecated in favor of the
@@ -498,8 +498,8 @@
     try
     {
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        std::string service = getService(*dbus, biosConfigIntf,
-                                         biosConfigBaseMgrPath);
+        std::string service =
+            getService(*dbus, biosConfigIntf, biosConfigBaseMgrPath);
         Value variant = getDbusProperty(*dbus, service, biosConfigBaseMgrPath,
                                         biosConfigIntf, resetBIOSSettingsProp);
 
@@ -682,9 +682,9 @@
     }
 }
 
-ipmi::RspType<uint32_t> ipmiOEMSetPayload(ipmi::Context::ptr&, uint8_t paramSel,
-                                          uint8_t payloadType,
-                                          std::vector<uint8_t> payload)
+ipmi::RspType<uint32_t>
+    ipmiOEMSetPayload(ipmi::Context::ptr&, uint8_t paramSel,
+                      uint8_t payloadType, std::vector<uint8_t> payload)
 {
     uint8_t biosCapOffsetBit = 2; // BIT:1 0-OOB BIOS config not supported
                                   //      1-OOB BIOS config is supported
@@ -778,8 +778,8 @@
                 return ipmi::response(ipmiCCPayloadChecksumFailed);
             }
             // store the data in temp file
-            std::string FilePath = "/var/oob/temp" +
-                                   std::to_string(payloadType);
+            std::string FilePath =
+                "/var/oob/temp" + std::to_string(payloadType);
 
             std::ofstream outFile(FilePath, std::ios::binary | std::ios::app);
             outFile.seekp(pPayloadInProgress->payloadOffset);
@@ -816,12 +816,12 @@
             {
                 return ipmi::response(ipmiCCPayloadPayloadInComplete);
             }
-            std::string tempFilePath = "/var/oob/temp" +
-                                       std::to_string(payloadType);
-            std::string payloadFilePath = "/var/oob/Payload" +
-                                          std::to_string(payloadType);
-            auto renamestatus = std::rename(tempFilePath.c_str(),
-                                            payloadFilePath.c_str());
+            std::string tempFilePath =
+                "/var/oob/temp" + std::to_string(payloadType);
+            std::string payloadFilePath =
+                "/var/oob/Payload" + std::to_string(payloadType);
+            auto renamestatus =
+                std::rename(tempFilePath.c_str(), payloadFilePath.c_str());
             if (renamestatus)
             {
                 phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -899,8 +899,8 @@
             gNVOOBdata.payloadInfo[payloadType].payloadType = 0;
             gNVOOBdata.payloadInfo[payloadType].payloadTotalSize = 0;
             // Delete the temp file
-            std::string tempFilePath = "/var/oob/temp" +
-                                       std::to_string(payloadType);
+            std::string tempFilePath =
+                "/var/oob/temp" + std::to_string(payloadType);
             unlink(tempFilePath.c_str());
             flushNVOOBdata();
             return ipmi::responseSuccess();
@@ -952,8 +952,8 @@
     {
         case ipmi::GetPayloadParameter::GetPayloadInfo:
         {
-            std::string payloadFilePath = "/var/oob/Payload" +
-                                          std::to_string(payloadType);
+            std::string payloadFilePath =
+                "/var/oob/Payload" + std::to_string(payloadType);
 
             std::ifstream ifs(payloadFilePath,
                               std::ios::in | std::ios::binary | std::ios::ate);
@@ -991,8 +991,8 @@
                 }
                 uint32_t offset = reqData.at(0);
                 uint32_t length = reqData.at(1);
-                std::string payloadFilePath = "/var/oob/Payload" +
-                                              std::to_string(payloadType);
+                std::string payloadFilePath =
+                    "/var/oob/Payload" + std::to_string(payloadType);
 
                 if (length > static_cast<uint32_t>(maxGetPayloadDataSize))
                 {
@@ -1004,9 +1004,9 @@
                     return ipmi::responseInvalidFieldRequest();
                 }
 
-                std::ifstream ifs(payloadFilePath, std::ios::in |
-                                                       std::ios::binary |
-                                                       std::ios::ate);
+                std::ifstream ifs(payloadFilePath,
+                                  std::ios::in | std::ios::binary |
+                                      std::ios::ate);
 
                 if (!ifs.good())
                 {
diff --git a/src/bridgingcommands.cpp b/src/bridgingcommands.cpp
index eb6d903..465659f 100644
--- a/src/bridgingcommands.cpp
+++ b/src/bridgingcommands.cpp
@@ -98,8 +98,8 @@
                                 ipmbConnectionHeaderLength);
 }
 
-static inline bool ipmbDataChecksumValidate(const ipmbHeader* ipmbHeader,
-                                            size_t length)
+static inline bool
+    ipmbDataChecksumValidate(const ipmbHeader* ipmbHeader, size_t length)
 {
     return ipmbChecksumValidate((reinterpret_cast<const uint8_t*>(ipmbHeader) +
                                  ipmbConnectionHeaderLength),
@@ -136,9 +136,9 @@
     rqLun = ipmbLunFromSeqLunGet(ipmbBuffer->Header.Req.rqSeqLUN);
     cmd = ipmbBuffer->Header.Req.cmd;
 
-    size_t dataLength = bufferLength -
-                        (ipmbConnectionHeaderLength +
-                         ipmbRequestDataHeaderLength + ipmbChecksumSize);
+    size_t dataLength =
+        bufferLength - (ipmbConnectionHeaderLength +
+                        ipmbRequestDataHeaderLength + ipmbChecksumSize);
 
     if (dataLength > 0)
     {
@@ -151,9 +151,8 @@
                            uint8_t rsSA, uint8_t seq, uint8_t rsLun,
                            uint8_t cmd, uint8_t completionCode,
                            std::vector<uint8_t>& inputData) :
-    address(address),
-    netFn(netFn), rqLun(rqLun), rsSA(rsSA), seq(seq), rsLun(rsLun), cmd(cmd),
-    completionCode(completionCode)
+    address(address), netFn(netFn), rqLun(rqLun), rsSA(rsSA), seq(seq),
+    rsLun(rsLun), cmd(cmd), completionCode(completionCode)
 {
     data.reserve(ipmbMaxDataSize);
 
@@ -240,10 +239,9 @@
     }
 }
 
-ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr& ctx,
-                                     const uint8_t tracking,
-                                     const std::vector<uint8_t>& msgData,
-                                     std::vector<uint8_t>& rspData)
+ipmi::Cc Bridging::handleIpmbChannel(
+    ipmi::Context::ptr& ctx, const uint8_t tracking,
+    const std::vector<uint8_t>& msgData, std::vector<uint8_t>& rspData)
 {
     ipmi::Manufacturing mtm;
 
@@ -323,9 +321,9 @@
 
     std::tie(status, netFn, lun, cmd, cc, dataReceived) = ipmbResponse;
 
-    auto respReceived = IpmbResponse(ipmbRequest.rqSA, netFn, lun,
-                                     ipmbRequest.address, ipmbRequest.seq, lun,
-                                     cmd, cc, dataReceived);
+    auto respReceived =
+        IpmbResponse(ipmbRequest.rqSA, netFn, lun, ipmbRequest.address,
+                     ipmbRequest.seq, lun, cmd, cc, dataReceived);
 
     // check IPMB layer status
     if (status)
@@ -614,12 +612,10 @@
 
  *  @return IPMI completion code on success
  */
-ipmi::RspType<> ipmiAppClearMessageFlags(ipmi::Context::ptr& ctx,
-                                         bool receiveMessage,
-                                         bool eventMsgBufFull, bool reserved2,
-                                         bool watchdogTimeout, bool reserved1,
-                                         bool /* oem0 */, bool /* oem1 */,
-                                         bool /* oem2 */)
+ipmi::RspType<> ipmiAppClearMessageFlags(
+    ipmi::Context::ptr& ctx, bool receiveMessage, bool eventMsgBufFull,
+    bool reserved2, bool watchdogTimeout, bool reserved1, bool /* oem0 */,
+    bool /* oem1 */, bool /* oem2 */)
 {
     ipmi::ChannelInfo chInfo;
 
diff --git a/src/chassiscommands.cpp b/src/chassiscommands.cpp
index 8a40017..8e5c836 100644
--- a/src/chassiscommands.cpp
+++ b/src/chassiscommands.cpp
@@ -97,8 +97,8 @@
     try
     {
         std::string service = LEDService.getService(*bus);
-        ipmi::Value enabled = getDbusProperty(*bus, service, objName,
-                                              ledInterface, ledProp);
+        ipmi::Value enabled =
+            getDbusProperty(*bus, service, objName, ledInterface, ledProp);
         state = std::get<bool>(enabled);
     }
     catch (const sdbusplus::exception_t& e)
@@ -227,8 +227,8 @@
 
     try
     {
-        auto service = ipmi::getService(*busp, powerRestoreIntf,
-                                        powerRestorePath);
+        auto service =
+            ipmi::getService(*busp, powerRestoreIntf, powerRestorePath);
 
         ipmi::Value result =
             ipmi::getDbusProperty(*busp, service, powerRestorePath,
@@ -279,8 +279,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 variant =
             ipmi::getDbusProperty(*busp, service, chassisStatePath,
@@ -377,8 +377,8 @@
         "xyz.openbmc_project.Control.Host.RestartCause";
 
     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)
     {
diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp
index 1e8b480..8a8a53d 100644
--- a/src/firmware-update.cpp
+++ b/src/firmware-update.cpp
@@ -380,30 +380,30 @@
             sdbusplus::bus::match::rules::propertiesChanged(
                 objPath, "xyz.openbmc_project.Software.ActivationProgress"),
             [&](sdbusplus::message_t& msg) {
-            std::map<std::string, ipmi::DbusVariant> props;
-            std::vector<std::string> inVal;
-            std::string iface;
-            try
-            {
-                msg.read(iface, props, inVal);
-            }
-            catch (const std::exception& e)
-            {
-                phosphor::logging::log<phosphor::logging::level::ERR>(
-                    "Exception caught in get ActivationProgress");
-                return;
-            }
-
-            auto it = props.find("Progress");
-            if (it != props.end())
-            {
-                progressPercent = std::get<uint8_t>(it->second);
-                if (progressPercent == 100)
+                std::map<std::string, ipmi::DbusVariant> props;
+                std::vector<std::string> inVal;
+                std::string iface;
+                try
                 {
-                    fwUpdateState = fwStateUpdateSuccess;
+                    msg.read(iface, props, inVal);
                 }
-            }
-        });
+                catch (const std::exception& e)
+                {
+                    phosphor::logging::log<phosphor::logging::level::ERR>(
+                        "Exception caught in get ActivationProgress");
+                    return;
+                }
+
+                auto it = props.find("Progress");
+                if (it != props.end())
+                {
+                    progressPercent = std::get<uint8_t>(it->second);
+                    if (progressPercent == 100)
+                    {
+                        fwUpdateState = fwStateUpdateSuccess;
+                    }
+                }
+            });
     }
     uint8_t activationTimerTimeout()
     {
@@ -465,13 +465,13 @@
         std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
         bus->async_method_call(
             [](const boost::system::error_code ec) {
-            if (ec)
-            {
-                phosphor::logging::log<phosphor::logging::level::ERR>(
-                    "async_method_call error: activateImage failed");
-                return;
-            }
-        },
+                if (ec)
+                {
+                    phosphor::logging::log<phosphor::logging::level::ERR>(
+                        "async_method_call error: activateImage failed");
+                    return;
+                }
+            },
             "xyz.openbmc_project.Software.BMC.Updater", objPath,
             "org.freedesktop.DBus.Properties", "Set",
             "xyz.openbmc_project.Software.Activation", "RequestedActivation",
@@ -562,8 +562,9 @@
     std::unique_ptr<sdbusplus::bus::match_t>& fwUpdateMatchSignal)
 {
     // Setup timer for watching signal
-    static sdbusplus::Timer timer(
-        [&fwUpdateMatchSignal]() { fwUpdateMatchSignal = nullptr; });
+    static sdbusplus::Timer timer([&fwUpdateMatchSignal]() {
+        fwUpdateMatchSignal = nullptr;
+    });
 
     static sdbusplus::Timer activationStatusTimer([]() {
         if (fwUpdateStatus.activationTimerTimeout() > 95)
@@ -831,12 +832,13 @@
 }
 
 #ifdef INTEL_PFR_ENABLED
-using fwVersionInfoType = std::tuple<uint8_t,   // ID Tag
-                                     uint8_t,   // Major Version Number
-                                     uint8_t,   // Minor Version Number
-                                     uint32_t,  // Build Number
-                                     uint32_t,  // Build Timestamp
-                                     uint32_t>; // Update Timestamp
+using fwVersionInfoType =
+    std::tuple<uint8_t,   // ID Tag
+               uint8_t,   // Major Version Number
+               uint8_t,   // Minor Version Number
+               uint32_t,  // Build Number
+               uint32_t,  // Build Timestamp
+               uint32_t>; // Update Timestamp
 ipmi::RspType<uint8_t, std::vector<fwVersionInfoType>> ipmiGetFwVersionInfo()
 {
     // Byte 1 - Count (N) Number of devices data is being returned for.
@@ -926,9 +928,8 @@
     return ipmi::responseSuccess(fwVerInfoList.size(), fwVerInfoList);
 }
 
-std::array<uint8_t, imageCount> getSecurityVersionInfo(const char* mtdDevBuf,
-                                                       size_t svnVerOffsetInPfm,
-                                                       size_t bkcVerOffsetInPfm)
+std::array<uint8_t, imageCount> getSecurityVersionInfo(
+    const char* mtdDevBuf, size_t svnVerOffsetInPfm, size_t bkcVerOffsetInPfm)
 {
     constexpr size_t bufLength = 1;
     std::array<uint8_t, imageCount> fwSecurityVersionBuf = {0}, temp;
@@ -1301,10 +1302,9 @@
  *  @returns IPMI completion code plus response data
  *   - Byte 2: Current control status
  **/
-ipmi::RspType<bool, bool, bool, bool, uint4_t>
-    ipmiGetSetFirmwareUpdateControl(const ipmi::Context::ptr& ctx,
-                                    const uint8_t controlReq,
-                                    const std::optional<std::string>& fileName)
+ipmi::RspType<bool, bool, bool, bool, uint4_t> ipmiGetSetFirmwareUpdateControl(
+    const ipmi::Context::ptr& ctx, const uint8_t controlReq,
+    const std::optional<std::string>& fileName)
 {
     bool isIPMBChannel = false;
 
@@ -1687,8 +1687,8 @@
 static void registerFirmwareFunctions()
 {
     // guarantee that we start with an already timed out timestamp
-    fwRandomNumGenTs = std::chrono::steady_clock::now() -
-                       fwRandomNumExpirySeconds;
+    fwRandomNumGenTs =
+        std::chrono::steady_clock::now() - fwRandomNumExpirySeconds;
     fwUpdateStatus.setState(
         static_cast<uint8_t>(FwUpdateStatusCache::fwStateInit));
 
diff --git a/src/ipmi_to_redfish_hooks.cpp b/src/ipmi_to_redfish_hooks.cpp
index 98ee532..d2eac78 100644
--- a/src/ipmi_to_redfish_hooks.cpp
+++ b/src/ipmi_to_redfish_hooks.cpp
@@ -49,8 +49,8 @@
     // Walk through the SEL request record to build the appropriate Redfish
     // message
     static constexpr std::string_view openBMCMessageRegistryVersion = "0.1";
-    std::string messageID = "OpenBMC." +
-                            std::string(openBMCMessageRegistryVersion);
+    std::string messageID =
+        "OpenBMC." + std::string(openBMCMessageRegistryVersion);
     std::vector<std::string> messageArgs;
     BIOSSensors sensor = static_cast<BIOSSensors>(selData.sensorNum);
     BIOSEventTypes eventType = static_cast<BIOSEventTypes>(selData.eventType);
@@ -296,8 +296,8 @@
     }
     else
     {
-        std::string messageArgsString = boost::algorithm::join(messageArgs,
-                                                               ",");
+        std::string messageArgsString =
+            boost::algorithm::join(messageArgs, ",");
         phosphor::logging::log<phosphor::logging::level::INFO>(
             journalMsg.c_str(),
             phosphor::logging::entry("REDFISH_MESSAGE_ID=%s",
@@ -319,8 +319,8 @@
     // Walk through the SEL request record to build the appropriate Redfish
     // message
     static constexpr std::string_view openBMCMessageRegistryVersion = "0.1";
-    std::string messageID = "OpenBMC." +
-                            std::string(openBMCMessageRegistryVersion);
+    std::string messageID =
+        "OpenBMC." + std::string(openBMCMessageRegistryVersion);
     std::vector<std::string> messageArgs;
     BIOSSMISensors sensor = static_cast<BIOSSMISensors>(selData.sensorNum);
     BIOSEventTypes eventType = static_cast<BIOSEventTypes>(selData.eventType);
@@ -869,22 +869,23 @@
 {
     // Save the raw IPMI string of the request
     std::string ipmiRaw;
-    std::array selBytes = {static_cast<uint8_t>(recordID),
-                           static_cast<uint8_t>(recordID >> 8),
-                           recordType,
-                           static_cast<uint8_t>(timestamp),
-                           static_cast<uint8_t>(timestamp >> 8),
-                           static_cast<uint8_t>(timestamp >> 16),
-                           static_cast<uint8_t>(timestamp >> 24),
-                           static_cast<uint8_t>(generatorID),
-                           static_cast<uint8_t>(generatorID >> 8),
-                           evmRev,
-                           sensorType,
-                           sensorNum,
-                           eventType,
-                           eventData1,
-                           eventData2,
-                           eventData3};
+    std::array selBytes = {
+        static_cast<uint8_t>(recordID),
+        static_cast<uint8_t>(recordID >> 8),
+        recordType,
+        static_cast<uint8_t>(timestamp),
+        static_cast<uint8_t>(timestamp >> 8),
+        static_cast<uint8_t>(timestamp >> 16),
+        static_cast<uint8_t>(timestamp >> 24),
+        static_cast<uint8_t>(generatorID),
+        static_cast<uint8_t>(generatorID >> 8),
+        evmRev,
+        sensorType,
+        sensorNum,
+        eventType,
+        eventData1,
+        eventData2,
+        eventData3};
     redfish_hooks::toHexStr(boost::beast::span<uint8_t>(selBytes), ipmiRaw);
 
     // First check that this is a system event record type since that
@@ -896,12 +897,13 @@
     }
 
     // Extract the SEL data for the hook
-    redfish_hooks::SELData selData = {.generatorID = generatorID,
-                                      .sensorNum = sensorNum,
-                                      .eventType = eventType,
-                                      .offset = eventData1 & 0x0F,
-                                      .eventData2 = eventData2,
-                                      .eventData3 = eventData3};
+    redfish_hooks::SELData selData = {
+        .generatorID = generatorID,
+        .sensorNum = sensorNum,
+        .eventType = eventType,
+        .offset = eventData1 & 0x0F,
+        .eventData2 = eventData2,
+        .eventData3 = eventData3};
 
     return redfish_hooks::startRedfishHook(selData, ipmiRaw);
 }
@@ -912,24 +914,26 @@
 {
     // Save the raw IPMI string of the selData
     std::string ipmiRaw;
-    std::array selBytes = {static_cast<uint8_t>(generatorID),
-                           static_cast<uint8_t>(generatorID >> 8),
-                           evmRev,
-                           sensorType,
-                           sensorNum,
-                           eventType,
-                           eventData1,
-                           eventData2,
-                           eventData3};
+    std::array selBytes = {
+        static_cast<uint8_t>(generatorID),
+        static_cast<uint8_t>(generatorID >> 8),
+        evmRev,
+        sensorType,
+        sensorNum,
+        eventType,
+        eventData1,
+        eventData2,
+        eventData3};
     redfish_hooks::toHexStr(boost::beast::span<uint8_t>(selBytes), ipmiRaw);
 
     // Extract the SEL data for the hook
-    redfish_hooks::SELData selData = {.generatorID = generatorID,
-                                      .sensorNum = sensorNum,
-                                      .eventType = eventType,
-                                      .offset = eventData1 & 0x0F,
-                                      .eventData2 = eventData2,
-                                      .eventData3 = eventData3};
+    redfish_hooks::SELData selData = {
+        .generatorID = generatorID,
+        .sensorNum = sensorNum,
+        .eventType = eventType,
+        .offset = eventData1 & 0x0F,
+        .eventData2 = eventData2,
+        .eventData3 = eventData3};
 
     return redfish_hooks::startRedfishHook(selData, ipmiRaw);
 }
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index 2bcb348..865b3a1 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -223,11 +223,10 @@
     initData();
 }
 
-int8_t Manufacturing::getProperty(const std::string& service,
-                                  const std::string& path,
-                                  const std::string& interface,
-                                  const std::string& propertyName,
-                                  ipmi::Value* reply)
+int8_t Manufacturing::getProperty(
+    const std::string& service, const std::string& path,
+    const std::string& interface, const std::string& propertyName,
+    ipmi::Value* reply)
 {
     try
     {
@@ -243,11 +242,10 @@
     return 0;
 }
 
-int8_t Manufacturing::setProperty(const std::string& service,
-                                  const std::string& path,
-                                  const std::string& interface,
-                                  const std::string& propertyName,
-                                  ipmi::Value value)
+int8_t Manufacturing::setProperty(
+    const std::string& service, const std::string& path,
+    const std::string& interface, const std::string& propertyName,
+    ipmi::Value value)
 {
     try
     {
@@ -536,8 +534,8 @@
         {
             constexpr const char* netBasePath = "/sys/class/net/eth";
             constexpr const char* carrierSuffix = "/carrier";
-            std::ifstream netIfs(netBasePath + std::to_string(instance) +
-                                 carrierSuffix);
+            std::ifstream netIfs(
+                netBasePath + std::to_string(instance) + carrierSuffix);
             if (!netIfs.good())
             {
                 return ipmi::responseInvalidFieldRequest();
@@ -672,9 +670,9 @@
                         pwmName = "Pwm_" + std::to_string(instance + 1);
                     }
                     fanPwmInstancePath = fanPwmPath + pwmName;
-                    ret = mtm.setProperty(fanService, fanPwmInstancePath,
-                                          fanIntf, "Value",
-                                          static_cast<double>(pwmValue));
+                    ret =
+                        mtm.setProperty(fanService, fanPwmInstancePath, fanIntf,
+                                        "Value", static_cast<double>(pwmValue));
                     if (ret < 0)
                     {
                         return ipmi::responseUnspecifiedError();
@@ -704,8 +702,8 @@
                         return ipmi::response(retCode);
                     }
 
-                    if ((mtm.mtmTestBeepFd = ::open(beepDevName,
-                                                    O_RDWR | O_CLOEXEC)) < 0)
+                    if ((mtm.mtmTestBeepFd =
+                             ::open(beepDevName, O_RDWR | O_CLOEXEC)) < 0)
                     {
                         lg2::error("Failed to open input device");
                         return ipmi::responseUnspecifiedError();
@@ -766,8 +764,8 @@
                 lg2::error("Failed to query HSBP drive sub tree objects");
                 return ipmi::responseUnspecifiedError();
             }
-            std::string driveObjPath = driveBasePath + "Drive_" +
-                                       std::to_string(instance + 1);
+            std::string driveObjPath =
+                driveBasePath + "Drive_" + std::to_string(instance + 1);
             if (std::find(driveList.begin(), driveList.end(), driveObjPath) ==
                 driveList.end())
             {
@@ -981,8 +979,8 @@
         writeData.push_back(static_cast<uint8_t>(macOffset));
         std::vector<uint8_t> readBuf(macRecordSize);
         std::string i2cBus = "/dev/i2c-" + std::to_string(fruBus);
-        ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, fruAddress, writeData,
-                                             readBuf);
+        ipmi::Cc retI2C =
+            ipmi::i2cWriteRead(i2cBus, fruAddress, writeData, readBuf);
         if (retI2C == ipmi::ccSuccess)
         {
             uint8_t cs = calculateChecksum(readBuf.cbegin(), readBuf.cend());
@@ -1025,14 +1023,14 @@
         writeData.push_back(macHeader);
         std::for_each(ethData.cbegin(), ethData.cend(),
                       [&](uint8_t i) { writeData.push_back(i); });
-        uint8_t macCheckSum = calculateChecksum(++writeData.cbegin(),
-                                                writeData.cend());
+        uint8_t macCheckSum =
+            calculateChecksum(++writeData.cbegin(), writeData.cend());
         writeData.push_back(macCheckSum);
 
         std::string i2cBus = "/dev/i2c-" + std::to_string(fruBus);
         std::vector<uint8_t> readBuf;
-        ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, fruAddress, writeData,
-                                          readBuf);
+        ipmi::Cc ret =
+            ipmi::i2cWriteRead(i2cBus, fruAddress, writeData, readBuf);
 
         // prepare for read to detect chip is write protected
         writeData.resize(1);
@@ -1108,9 +1106,9 @@
                   "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", ethData.at(0),
                   ethData.at(1), ethData.at(2), ethData.at(3), ethData.at(4),
                   ethData.at(5));
-    std::ofstream oEthFile(factoryEthAddrBaseFileName +
-                               std::to_string(dataType),
-                           std::ofstream::out);
+    std::ofstream oEthFile(
+        factoryEthAddrBaseFileName + std::to_string(dataType),
+        std::ofstream::out);
     if (!oEthFile.good())
     {
         return ipmi::responseUnspecifiedError();
@@ -1137,9 +1135,9 @@
     constexpr uint8_t invalidData = 0;
     constexpr uint8_t validData = 1;
 
-    std::ifstream iEthFile(factoryEthAddrBaseFileName +
-                               std::to_string(dataType),
-                           std::ifstream::in);
+    std::ifstream iEthFile(
+        factoryEthAddrBaseFileName + std::to_string(dataType),
+        std::ifstream::in);
     if (!iEthFile.good())
     {
         if (readMacFromFru(ctx, dataType, ethData))
@@ -1263,8 +1261,8 @@
 
     std::vector<uint8_t> readBuf(readCount);
 
-    ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
-                                         readBuf);
+    ipmi::Cc retI2C =
+        ipmi::i2cWriteRead(i2cBus, targetAddr, writeData, readBuf);
     if (retI2C != ipmi::ccSuccess)
     {
         return ipmi::response(retI2C);
@@ -1283,8 +1281,8 @@
     std::vector<uint8_t> writeData = {0x61, 0x1};
     std::vector<uint8_t> readBuf(0);
 
-    ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
-                                         readBuf);
+    ipmi::Cc retI2C =
+        ipmi::i2cWriteRead(i2cBus, targetAddr, writeData, readBuf);
     return ipmi::response(retI2C);
 }
 
@@ -1334,10 +1332,9 @@
     return configPaths;
 }
 
-static ipmi::RspType<> startOrStopService(ipmi::Context::ptr& ctx,
-                                          const uint8_t enable,
-                                          const std::string& serviceName,
-                                          bool disableOrEnableUnitFiles = true)
+static ipmi::RspType<> startOrStopService(
+    ipmi::Context::ptr& ctx, const uint8_t enable,
+    const std::string& serviceName, bool disableOrEnableUnitFiles = true)
 {
     constexpr bool runtimeOnly = false;
     constexpr bool force = false;
@@ -1404,14 +1401,13 @@
         boost::algorithm::replace_first_copy(
             objectPath, "/xyz/openbmc_project/inventory/system/board/", ""),
         "/", "_2f");
-    std::string unitName = "xyz.openbmc_project.mctpd@" + serviceArgument +
-                           ".service";
+    std::string unitName =
+        "xyz.openbmc_project.mctpd@" + serviceArgument + ".service";
     return unitName;
 }
 
-static ipmi::RspType<> handleMCTPFeature(ipmi::Context::ptr& ctx,
-                                         const uint8_t enable,
-                                         const std::string& binding)
+static ipmi::RspType<> handleMCTPFeature(
+    ipmi::Context::ptr& ctx, const uint8_t enable, const std::string& binding)
 {
     std::vector<std::string> configPaths;
     try
@@ -1501,9 +1497,8 @@
     return ipmi::responseSuccess();
 }
 
-static ipmi::RspType<> handleMCTPSlotFeature(ipmi::Context::ptr& ctx,
-                                             const uint8_t enable,
-                                             const uint8_t featureArg)
+static ipmi::RspType<> handleMCTPSlotFeature(
+    ipmi::Context::ptr& ctx, const uint8_t enable, const uint8_t featureArg)
 {
     uint8_t slotNum = (featureArg & slotNumMask);
     switch ((featureArg & muxTypeMask) >> muxTypeShift)
@@ -1549,11 +1544,9 @@
  *
  * @returns IPMI completion code
  */
-ipmi::RspType<> mtmBMCFeatureControl(ipmi::Context::ptr ctx,
-                                     const uint8_t feature,
-                                     const uint8_t enable,
-                                     const uint8_t featureArg,
-                                     const uint16_t reserved)
+ipmi::RspType<> mtmBMCFeatureControl(
+    ipmi::Context::ptr ctx, const uint8_t feature, const uint8_t enable,
+    const uint8_t featureArg, const uint16_t reserved)
 {
     if (reserved != 0)
     {
@@ -1636,6 +1629,6 @@
 
     ipmi::registerFilter(ipmi::prioOemBase,
                          [](ipmi::message::Request::ptr request) {
-        return ipmi::mfgFilterMessage(request);
-    });
+                             return ipmi::mfgFilterMessage(request);
+                         });
 }
diff --git a/src/me_to_redfish_hooks.cpp b/src/me_to_redfish_hooks.cpp
index 8c51db2..c964608 100644
--- a/src/me_to_redfish_hooks.cpp
+++ b/src/me_to_redfish_hooks.cpp
@@ -81,22 +81,23 @@
                "to ME while MCTP stack is configured in Bus Owner Proxy mode"}};
 
 static const boost::container::flat_map<uint8_t, std::string>
-    unsupportedFeature = {{0x00, "Other Segment Defined Feature"},
-                          {0x01, "Fast NM limiting"},
-                          {0x02, "Volumetric Airflow and Outlet Temperature"},
-                          {0x03, "CUPS"},
-                          {0x04, "Thermal policies and Inlet Temperature"},
-                          {0x05, "Platform limiting with MICs"},
-                          {0x07, "Shared power supplies"},
-                          {0x08, "MIC Proxy"},
-                          {0x09, "Reset warning"},
-                          {0x0A, "PMBus Proxy"},
-                          {0x0B, "Always on"},
-                          {0x0C, "IPMI Intel ME FW update"},
-                          {0x0D, "MCTP bus owner"},
-                          {0x0E, "MCTP bus owner proxy"},
-                          {0x0F, "Dual BIOS"},
-                          {0x10, "Battery less"}};
+    unsupportedFeature = {
+        {0x00, "Other Segment Defined Feature"},
+        {0x01, "Fast NM limiting"},
+        {0x02, "Volumetric Airflow and Outlet Temperature"},
+        {0x03, "CUPS"},
+        {0x04, "Thermal policies and Inlet Temperature"},
+        {0x05, "Platform limiting with MICs"},
+        {0x07, "Shared power supplies"},
+        {0x08, "MIC Proxy"},
+        {0x09, "Reset warning"},
+        {0x0A, "PMBus Proxy"},
+        {0x0B, "Always on"},
+        {0x0C, "IPMI Intel ME FW update"},
+        {0x0D, "MCTP bus owner"},
+        {0x0E, "MCTP bus owner proxy"},
+        {0x0F, "Dual BIOS"},
+        {0x10, "Battery less"}};
 
 static const boost::container::flat_map<uint8_t, std::string> umaError = {
     {0x00, "UMA Read integrity error. Checksum of data read from UMA differs "
diff --git a/src/multinodecommands.cpp b/src/multinodecommands.cpp
index a0e7183..d6712b3 100644
--- a/src/multinodecommands.cpp
+++ b/src/multinodecommands.cpp
@@ -33,8 +33,8 @@
     auto pdbus = getSdBus();
     try
     {
-        std::string service = getService(*pdbus, multiNodeIntf,
-                                         multiNodeObjPath);
+        std::string service =
+            getService(*pdbus, multiNodeIntf, multiNodeObjPath);
         Value dbusValue = getDbusProperty(*pdbus, service, multiNodeObjPath,
                                           multiNodeIntf, name);
         return std::get<uint8_t>(dbusValue);
@@ -53,8 +53,8 @@
     auto pdbus = getSdBus();
     try
     {
-        std::string service = getService(*pdbus, multiNodeIntf,
-                                         multiNodeObjPath);
+        std::string service =
+            getService(*pdbus, multiNodeIntf, multiNodeObjPath);
         Value dbusValue = getDbusProperty(*pdbus, service, multiNodeObjPath,
                                           multiNodeIntf, "NodeRole");
         std::string valueStr = std::get<std::string>(dbusValue);
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index d0158de..11b00c8 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -268,8 +268,8 @@
     // trigger the write FIFO operation.
     std::vector<uint8_t> writeData = {cmdReg, val};
     std::vector<uint8_t> readBuf(0);
-    ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
-                                         readBuf);
+    ipmi::Cc retI2C =
+        ipmi::i2cWriteRead(i2cBus, targetAddr, writeData, readBuf);
     if (retI2C)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -374,8 +374,8 @@
     return IPMI_CC_OK;
 }
 
-ipmi::RspType<> ipmiOEMDisableBMCSystemReset(bool disableResetOnSMI,
-                                             uint7_t reserved1)
+ipmi::RspType<>
+    ipmiOEMDisableBMCSystemReset(bool disableResetOnSMI, uint7_t reserved1)
 {
     if (reserved1)
     {
@@ -386,8 +386,8 @@
 
     try
     {
-        auto service = ipmi::getService(*busp, bmcResetDisablesIntf,
-                                        bmcResetDisablesPath);
+        auto service =
+            ipmi::getService(*busp, bmcResetDisablesIntf, bmcResetDisablesPath);
         ipmi::setDbusProperty(*busp, service, bmcResetDisablesPath,
                               bmcResetDisablesIntf, "ResetOnSMI",
                               !disableResetOnSMI);
@@ -413,8 +413,8 @@
     std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
     try
     {
-        auto service = ipmi::getService(*busp, bmcResetDisablesIntf,
-                                        bmcResetDisablesPath);
+        auto service =
+            ipmi::getService(*busp, bmcResetDisablesIntf, bmcResetDisablesPath);
         Value variant =
             ipmi::getDbusProperty(*busp, service, bmcResetDisablesPath,
                                   bmcResetDisablesIntf, "ResetOnSMI");
@@ -469,8 +469,8 @@
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
     try
     {
-        std::string hsbpObjPath = "/xyz/openbmc_project/software/HSBP_" +
-                                  std::to_string(hscNumber);
+        std::string hsbpObjPath =
+            "/xyz/openbmc_project/software/HSBP_" + std::to_string(hscNumber);
         auto service = getService(*dbus, biosVersionIntf, hsbpObjPath);
         Value hscVersionValue =
             getDbusProperty(*dbus, "xyz.openbmc_project.HsbpManager",
@@ -560,8 +560,8 @@
         if (results.size() == matchedPhosphor)
         {
             meMajor = static_cast<uint8_t>(std::stoi(results[1]));
-            meMinor = static_cast<uint8_t>(std::stoi(results[2]) << 4 |
-                                           std::stoi(results[3]));
+            meMinor = static_cast<uint8_t>(
+                std::stoi(results[2]) << 4 | std::stoi(results[3]));
         }
     }
     return true;
@@ -594,8 +594,8 @@
             }
 
             std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-            std::string service = getService(*dbus, biosVersionIntf,
-                                             biosActiveObjPath);
+            std::string service =
+                getService(*dbus, biosVersionIntf, biosActiveObjPath);
             try
             {
                 Value variant =
@@ -717,11 +717,11 @@
     }
 
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-    std::string service = getService(*dbus, powerRestoreDelayIntf,
-                                     powerRestoreDelayObjPath);
-    Value variant = getDbusProperty(*dbus, service, powerRestoreDelayObjPath,
-                                    powerRestoreDelayIntf,
-                                    powerRestoreDelayProp);
+    std::string service =
+        getService(*dbus, powerRestoreDelayIntf, powerRestoreDelayObjPath);
+    Value variant =
+        getDbusProperty(*dbus, service, powerRestoreDelayObjPath,
+                        powerRestoreDelayIntf, powerRestoreDelayProp);
 
     uint64_t val = std::get<uint64_t>(variant);
     val /= 1000000UL;
@@ -742,10 +742,9 @@
 // Allows an update utility or system BIOS to send the status of an embedded
 // firmware update attempt to the BMC. After received, BMC will create a logging
 // record.
-ipmi::RspType<> ipmiOEMSendEmbeddedFwUpdStatus(uint8_t status, uint8_t target,
-                                               uint8_t majorRevision,
-                                               uint8_t minorRevision,
-                                               uint32_t auxInfo)
+ipmi::RspType<> ipmiOEMSendEmbeddedFwUpdStatus(
+    uint8_t status, uint8_t target, uint8_t majorRevision,
+    uint8_t minorRevision, uint32_t auxInfo)
 {
     std::string firmware;
     int instance = (target & targetInstanceMask) >> targetInstanceShift;
@@ -830,8 +829,8 @@
             break;
     }
 
-    std::string firmwareInstanceStr = firmware +
-                                      " instance: " + std::to_string(instance);
+    std::string firmwareInstanceStr =
+        firmware + " instance: " + std::to_string(instance);
     std::string message("[firmware update] " + firmwareInstanceStr +
                         " status: <" + action + "> " + buildInfo);
 
@@ -842,12 +841,11 @@
     return ipmi::responseSuccess();
 }
 
-ipmi::RspType<uint8_t, std::vector<uint8_t>>
-    ipmiOEMSlotIpmb(ipmi::Context::ptr& ctx, uint6_t reserved1,
-                    uint2_t slotNumber, uint3_t baseBoardSlotNum,
-                    [[maybe_unused]] uint3_t riserSlotNum, uint2_t reserved2,
-                    uint8_t targetAddr, uint8_t netFn, uint8_t cmd,
-                    std::optional<std::vector<uint8_t>> writeData)
+ipmi::RspType<uint8_t, std::vector<uint8_t>> ipmiOEMSlotIpmb(
+    ipmi::Context::ptr& ctx, uint6_t reserved1, uint2_t slotNumber,
+    uint3_t baseBoardSlotNum, [[maybe_unused]] uint3_t riserSlotNum,
+    uint2_t reserved2, uint8_t targetAddr, uint8_t netFn, uint8_t cmd,
+    std::optional<std::vector<uint8_t>> writeData)
 {
     if (reserved1 || reserved2)
     {
@@ -902,8 +900,8 @@
     delay = (delay << 8) | data->byteLSB;
     uint64_t val = delay * 1000000;
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-    std::string service = getService(*dbus, powerRestoreDelayIntf,
-                                     powerRestoreDelayObjPath);
+    std::string service =
+        getService(*dbus, powerRestoreDelayIntf, powerRestoreDelayObjPath);
     setDbusProperty(*dbus, service, powerRestoreDelayObjPath,
                     powerRestoreDelayIntf, powerRestoreDelayProp, val);
     *dataLen = 0;
@@ -921,8 +919,8 @@
     std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
     try
     {
-        auto service = ipmi::getService(*busp, cpuPresenceIntf,
-                                        cpuPresencePath);
+        auto service =
+            ipmi::getService(*busp, cpuPresenceIntf, cpuPresencePath);
 
         ipmi::Value result = ipmi::getDbusProperty(
             *busp, service, cpuPresencePath, cpuPresenceIntf, "Present");
@@ -1000,10 +998,10 @@
         return ipmi::responseUnspecifiedError();
     }
 
-    return ipmi::responseSuccess(resetOnIERR, resetOnERR2, allowResetOnMCERR, 0,
-                                 0x3F, cpu1IERRCount, cpu1Status, cpu2IERRCount,
-                                 cpu2Status, cpu3IERRCount, cpu3Status,
-                                 cpu4IERRCount, cpu4Status, crashdumpCount);
+    return ipmi::responseSuccess(
+        resetOnIERR, resetOnERR2, allowResetOnMCERR, 0, 0x3F, cpu1IERRCount,
+        cpu1Status, cpu2IERRCount, cpu2Status, cpu3IERRCount, cpu3Status,
+        cpu4IERRCount, cpu4Status, crashdumpCount);
 }
 
 ipmi::RspType<> ipmiOEMSetProcessorErrConfig(
@@ -1089,8 +1087,8 @@
     try
     {
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        std::string service = getService(*dbus, oemShutdownPolicyIntf,
-                                         oemShutdownPolicyObjPath);
+        std::string service =
+            getService(*dbus, oemShutdownPolicyIntf, oemShutdownPolicyObjPath);
         Value variant = getDbusProperty(
             *dbus, service, oemShutdownPolicyObjPath, oemShutdownPolicyIntf,
             oemShutdownPolicyObjPathProp);
@@ -1172,8 +1170,8 @@
     try
     {
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        std::string service = getService(*dbus, oemShutdownPolicyIntf,
-                                         oemShutdownPolicyObjPath);
+        std::string service =
+            getService(*dbus, oemShutdownPolicyIntf, oemShutdownPolicyObjPath);
         setDbusProperty(
             *dbus, service, oemShutdownPolicyObjPath, oemShutdownPolicyIntf,
             oemShutdownPolicyObjPathProp,
@@ -1203,8 +1201,8 @@
         }
         auto ethIP = ethdevice + "/ipv4";
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        auto ethernetObj = getDbusObject(*dbus, networkIPIntf, networkRoot,
-                                         ethIP);
+        auto ethernetObj =
+            getDbusObject(*dbus, networkIPIntf, networkRoot, ethIP);
         auto value = getDbusProperty(*dbus, networkService, ethernetObj.first,
                                      networkIPIntf, "Origin");
         if (std::get<std::string>(value) ==
@@ -1239,8 +1237,8 @@
         }
         auto ethIP = ethdevice + "/ipv6";
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        auto objectInfo = getDbusObject(*dbus, networkIPIntf, networkRoot,
-                                        ethIP);
+        auto objectInfo =
+            getDbusObject(*dbus, networkIPIntf, networkRoot, ethIP);
         auto properties = getAllDbusProperties(*dbus, objectInfo.second,
                                                objectInfo.first, networkIPIntf);
         if (std::get<std::string>(properties["Origin"]) ==
@@ -1521,8 +1519,8 @@
     try
     {
         std::string service = getService(bus, intf, objPath);
-        Value stateValue = getDbusProperty(bus, service, objPath, intf,
-                                           "State");
+        Value stateValue =
+            getDbusProperty(bus, service, objPath, intf, "State");
         std::string strState = std::get<std::string>(stateValue);
         state = ledAction::actionDbusToIpmi.at(
             sdbusplus::xyz::openbmc_project::Led::server::Physical::
@@ -1556,11 +1554,9 @@
     return ipmi::responseSuccess(ledstate);
 }
 
-ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(ipmi_netfn_t, ipmi_cmd_t,
-                                         ipmi_request_t request,
-                                         ipmi_response_t response,
-                                         ipmi_data_len_t dataLen,
-                                         ipmi_context_t)
+ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(
+    ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t request, ipmi_response_t response,
+    ipmi_data_len_t dataLen, ipmi_context_t)
 {
     CfgHostSerialReq* req = reinterpret_cast<CfgHostSerialReq*>(request);
     uint8_t* resp = reinterpret_cast<uint8_t*>(response);
@@ -1864,10 +1860,10 @@
 static std::string getConfigPath(const std::string& name)
 {
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-    auto method = dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
-                                        "/xyz/openbmc_project/object_mapper",
-                                        "xyz.openbmc_project.ObjectMapper",
-                                        "GetSubTree");
+    auto method =
+        dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
+                              "/xyz/openbmc_project/object_mapper",
+                              "xyz.openbmc_project.ObjectMapper", "GetSubTree");
 
     method.append("/", 0, std::array<const char*, 1>{pidConfigurationIface});
     std::string path;
@@ -1882,10 +1878,10 @@
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "ipmiOEMGetFscParameter: mapper error");
     };
-    auto config = std::find_if(resp.begin(), resp.end(),
-                               [&name](const auto& pair) {
-        return pair.first.find(name) != std::string::npos;
-    });
+    auto config =
+        std::find_if(resp.begin(), resp.end(), [&name](const auto& pair) {
+            return pair.first.find(name) != std::string::npos;
+        });
     if (config != resp.end())
     {
         path = std::move(config->first);
@@ -1898,10 +1894,10 @@
 {
     boost::container::flat_map<std::string, PropertyMap> ret;
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-    auto method = dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
-                                        "/xyz/openbmc_project/object_mapper",
-                                        "xyz.openbmc_project.ObjectMapper",
-                                        "GetSubTree");
+    auto method =
+        dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
+                              "/xyz/openbmc_project/object_mapper",
+                              "xyz.openbmc_project.ObjectMapper", "GetSubTree");
 
     method.append("/", 0, std::array<const char*, 1>{pidConfigurationIface});
     GetSubTreeType resp;
@@ -2413,9 +2409,8 @@
 static const constexpr uint32_t oneMonth = 0xf53700;
 static const constexpr uint8_t userSpecific = 0x01;
 static const constexpr uint8_t crSetCompleted = 0;
-ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr& ctx,
-                                          uint8_t parameter,
-                                          ipmi::message::Payload& payload)
+ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(
+    ipmi::Context::ptr& ctx, uint8_t parameter, ipmi::message::Payload& payload)
 {
     switch (static_cast<crParameter>(parameter))
     {
@@ -2702,10 +2697,9 @@
     }
 }
 
-ipmi::RspType<> ipmiOEMSetFaultIndication(uint8_t sourceId, uint8_t faultType,
-                                          uint8_t faultState,
-                                          uint8_t faultGroup,
-                                          std::array<uint8_t, 8>& ledStateData)
+ipmi::RspType<> ipmiOEMSetFaultIndication(
+    uint8_t sourceId, uint8_t faultType, uint8_t faultState, uint8_t faultGroup,
+    std::array<uint8_t, 8>& ledStateData)
 {
     constexpr auto maxFaultType = static_cast<size_t>(RemoteFaultType::max);
     static const std::array<std::string, maxFaultType> faultNames = {
@@ -3174,11 +3168,11 @@
     try
     {
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        std::string service = getService(*dbus, oemNmiSourceIntf,
-                                         oemNmiSourceObjPath);
-        Value variant = getDbusProperty(*dbus, service, oemNmiSourceObjPath,
-                                        oemNmiSourceIntf,
-                                        oemNmiBmcSourceObjPathProp);
+        std::string service =
+            getService(*dbus, oemNmiSourceIntf, oemNmiSourceObjPath);
+        Value variant =
+            getDbusProperty(*dbus, service, oemNmiSourceObjPath,
+                            oemNmiSourceIntf, oemNmiBmcSourceObjPathProp);
 
         switch (nmi::NMISource::convertBMCSourceSignalFromString(
             std::get<std::string>(variant)))
@@ -3267,8 +3261,8 @@
     {
         // keep NMI signal source
         std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-        std::string service = getService(*dbus, oemNmiSourceIntf,
-                                         oemNmiSourceObjPath);
+        std::string service =
+            getService(*dbus, oemNmiSourceIntf, oemNmiSourceObjPath);
         setDbusProperty(*dbus, service, oemNmiSourceObjPath, oemNmiSourceIntf,
                         oemNmiBmcSourceObjPathProp,
                         nmi::convertForMessage(bmcSourceSignal));
@@ -3303,9 +3297,8 @@
 
 }; // namespace dimmOffset
 
-ipmi::RspType<>
-    ipmiOEMSetDimmOffset(uint8_t type,
-                         const std::vector<std::tuple<uint8_t, uint8_t>>& data)
+ipmi::RspType<> ipmiOEMSetDimmOffset(
+    uint8_t type, const std::vector<std::tuple<uint8_t, uint8_t>>& data)
 {
     if (type != static_cast<uint8_t>(dimmOffsetTypes::dimmPower) &&
         type != static_cast<uint8_t>(dimmOffsetTypes::staticCltt))
@@ -3775,8 +3768,8 @@
     return ipmi::responseSuccess(result);
 }
 
-std::optional<uint8_t> getMultiNodeInfoPresence(ipmi::Context::ptr& ctx,
-                                                const std::string& name)
+std::optional<uint8_t>
+    getMultiNodeInfoPresence(ipmi::Context::ptr& ctx, const std::string& name)
 {
     Value dbusValue = 0;
     std::string serviceName;
@@ -3846,8 +3839,8 @@
     // This command should run only from multi-node product.
     // For all other platforms this command will return invalid.
 
-    std::optional<uint8_t> nodeInfo = getMultiNodeInfoPresence(ctx,
-                                                               "NodePresence");
+    std::optional<uint8_t> nodeInfo =
+        getMultiNodeInfoPresence(ctx, "NodePresence");
     if (!nodeInfo || !*nodeInfo)
     {
         return ipmi::responseInvalidCommand();
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 26b289b..997875c 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -93,22 +93,22 @@
     "type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
     "sensors/'",
     [](sdbusplus::message_t&) {
-    sensorTree.clear();
-    sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
-                     std::chrono::system_clock::now().time_since_epoch())
-                     .count();
-});
+        sensorTree.clear();
+        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&) {
-    sensorTree.clear();
-    sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
-                        std::chrono::system_clock::now().time_since_epoch())
-                        .count();
-});
+        sensorTree.clear();
+        sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
+                            std::chrono::system_clock::now().time_since_epoch())
+                            .count();
+    });
 
 // this keeps track of deassertions for sensor event status command. A
 // deasertion can only happen if an assertion was seen first.
@@ -121,42 +121,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, ipmi::DbusVariant> values;
-    m.read(std::string(), values);
+        boost::container::flat_map<std::string, ipmi::DbusVariant> 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())
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "thresholdChanged: Assert non bool");
-            return;
-        }
-        if (*ptr)
-        {
-            phosphor::logging::log<phosphor::logging::level::INFO>(
-                "thresholdChanged: Assert",
-                phosphor::logging::entry("SENSOR=%s", 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)
+            {
+                phosphor::logging::log<phosphor::logging::level::ERR>(
+                    "thresholdChanged: Assert non bool");
+                return;
+            }
+            if (*ptr)
             {
                 phosphor::logging::log<phosphor::logging::level::INFO>(
-                    "thresholdChanged: deassert",
+                    "thresholdChanged: Assert",
                     phosphor::logging::entry("SENSOR=%s", m.get_path()));
-                value = *ptr;
+                thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
+            }
+            else
+            {
+                auto& value =
+                    thresholdDeassertMap[m.get_path()][findAssert->first];
+                if (value)
+                {
+                    phosphor::logging::log<phosphor::logging::level::INFO>(
+                        "thresholdChanged: deassert",
+                        phosphor::logging::entry("SENSOR=%s", m.get_path()));
+                    value = *ptr;
+                }
             }
         }
-    }
-});
+    });
 
 static void getSensorMaxMin(const SensorMap& sensorMap, double& max,
                             double& min)
@@ -323,9 +324,9 @@
     }
 
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
-    auto setHealth = dbus->new_method_call(meHealth::busname, meHealth::path,
-                                           meHealth::interface,
-                                           meHealth::method);
+    auto setHealth =
+        dbus->new_method_call(meHealth::busname, meHealth::path,
+                              meHealth::interface, meHealth::method);
     setHealth.append(std::to_string(static_cast<size_t>(eventData2)), state);
     try
     {
@@ -468,8 +469,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 |=
@@ -781,8 +782,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(
@@ -791,8 +792,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(
@@ -809,8 +810,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(
@@ -819,8 +820,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(
@@ -971,8 +972,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>(
@@ -985,8 +986,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>(
@@ -1007,8 +1008,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>(
@@ -1020,8 +1021,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>(
@@ -1141,15 +1142,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())
@@ -1171,9 +1172,9 @@
             }
             if (criticalHighAlarm)
             {
-                assertions.set(
-                    static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
-                                            upperCriticalGoingHigh));
+                assertions.set(static_cast<size_t>(
+                    IPMIGetSensorEventEnableThresholds::
+                        upperCriticalGoingHigh));
             }
             if (criticalLowAlarm)
             {
@@ -1205,9 +1206,9 @@
         return GENERAL_ERROR;
     }
 
-    size_t lastRecord = getNumberOfSensors() + fruCount +
-                        ipmi::storage::type12Count +
-                        ipmi::storage::nmDiscoverySDRCount - 1;
+    size_t lastRecord =
+        getNumberOfSensors() + fruCount + ipmi::storage::type12Count +
+        ipmi::storage::nmDiscoverySDRCount - 1;
     if (recordID == lastRecordIndex)
     {
         recordID = lastRecord;
@@ -1234,8 +1235,8 @@
                     "getSensorDataRecord: NM DiscoveryIndex error");
                 return GENERAL_ERROR;
             }
-            recordData = ipmi::storage::getNMDiscoverySDR(nmDiscoveryIndex,
-                                                          recordID);
+            recordData =
+                ipmi::storage::getNMDiscoverySDR(nmDiscoveryIndex, recordID);
         }
         else if (fruIndex >= fruCount)
         {
@@ -1441,8 +1442,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;
@@ -1602,8 +1603,8 @@
         // Return the number of sensors attached to the LUN
         if ((ctx->lun == 0) && (numSensors > 0))
         {
-            sdrCount = (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN
-                                                       : numSensors;
+            sdrCount =
+                (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN : numSensors;
         }
         else if ((ctx->lun == 1) && (numSensors > maxSensorsPerLUN))
         {
@@ -1680,9 +1681,9 @@
         return ipmi::response(ret);
     }
 
-    uint16_t recordCount = getNumberOfSensors() + fruCount +
-                           ipmi::storage::type12Count +
-                           ipmi::storage::nmDiscoverySDRCount;
+    uint16_t recordCount =
+        getNumberOfSensors() + fruCount + ipmi::storage::type12Count +
+        ipmi::storage::nmDiscoverySDRCount;
 
     uint8_t operationSupport = static_cast<uint8_t>(
         SdrRepositoryInfoOps::overflow); // write not supported
@@ -1763,9 +1764,9 @@
         return ipmi::response(ret);
     }
 
-    size_t lastRecord = getNumberOfSensors() + fruCount +
-                        ipmi::storage::type12Count +
-                        ipmi::storage::nmDiscoverySDRCount - 1;
+    size_t lastRecord =
+        getNumberOfSensors() + fruCount + ipmi::storage::type12Count +
+        ipmi::storage::nmDiscoverySDRCount - 1;
     uint16_t nextRecordId = lastRecord > recordID ? recordID + 1 : 0XFFFF;
 
     if (!getSensorSubtree(sensorTree) && sensorTree.empty())
@@ -1791,8 +1792,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)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
diff --git a/src/smbiosmdrv2handler.cpp b/src/smbiosmdrv2handler.cpp
index d3c862e..16f8ae0 100644
--- a/src/smbiosmdrv2handler.cpp
+++ b/src/smbiosmdrv2handler.cpp
@@ -278,8 +278,8 @@
  *  @returns IPMI completion code plus response data
  *  - dataOut
  */
-ipmi::RspType<std::vector<uint8_t>> mdr2GetDir(uint16_t agentId,
-                                               uint8_t dirIndex)
+ipmi::RspType<std::vector<uint8_t>>
+    mdr2GetDir(uint16_t agentId, uint8_t dirIndex)
 {
     std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
     std::string service = ipmi::getService(*bus, mdrv2Interface, mdrv2Path);
@@ -369,10 +369,10 @@
  *  - bool
  */
 
-ipmi::RspType<bool> mdr2SendDir(uint16_t agentId, uint8_t dirVersion,
-                                uint8_t dirIndex, uint8_t returnedEntries,
-                                uint8_t remainingEntries,
-                                std::vector<uint8_t> dataInfo)
+ipmi::RspType<bool>
+    mdr2SendDir(uint16_t agentId, uint8_t dirVersion, uint8_t dirIndex,
+                uint8_t returnedEntries, uint8_t remainingEntries,
+                std::vector<uint8_t> dataInfo)
 {
     if ((static_cast<size_t>(returnedEntries) * dataInfoSize) !=
         dataInfo.size())
@@ -785,8 +785,8 @@
                 "Offset is out of range");
             return ipmi::responseParmOutOfRange();
         }
-        uint8_t* destAddr = mdrv2->smbiosDir.dir[idIndex].dataStorage +
-                            xferOffset;
+        uint8_t* destAddr =
+            mdrv2->smbiosDir.dir[idIndex].dataStorage + xferOffset;
         uint8_t* sourceAddr = reinterpret_cast<uint8_t*>(mdrv2->area->vPtr);
         uint32_t calcChecksum = mdrv2->calcChecksum32(sourceAddr, xferLength);
         if (calcChecksum != checksum)
@@ -1093,10 +1093,9 @@
 
 @return xferStartAck and session on success.
 **/
-ipmi::RspType<uint8_t, uint16_t>
-    cmd_mdr2_data_start(uint16_t agentId, std::array<uint8_t, 16> dataInfo,
-                        uint32_t dataLength, uint32_t xferAddress,
-                        uint32_t xferLength, uint16_t timeout)
+ipmi::RspType<uint8_t, uint16_t> cmd_mdr2_data_start(
+    uint16_t agentId, std::array<uint8_t, 16> dataInfo, uint32_t dataLength,
+    uint32_t xferAddress, uint32_t xferLength, uint16_t timeout)
 {
     uint16_t session = 0;
 
@@ -1142,8 +1141,8 @@
     {
         try
         {
-            mdrv2->area = std::make_unique<SharedMemoryArea>(xferAddress,
-                                                             xferLength);
+            mdrv2->area =
+                std::make_unique<SharedMemoryArea>(xferAddress, xferLength);
         }
         catch (const std::system_error& e)
         {
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 25eea96..a1a19f2 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -307,55 +307,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) {
@@ -421,10 +423,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)
     {
@@ -520,31 +521,33 @@
     uint8_t& address = device->second.second;
 
     boost::container::flat_map<std::string, DbusVariant>* 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::ccResponseError;
@@ -570,43 +573,43 @@
         return ipmi::ccResponseError;
     }
 
-    auto entity =
-        std::find_if(entities.begin(), entities.end(),
-                     [bus, address, &entityData](ManagedEntry& entry) {
-        auto findFruDevice = entry.second.find(
-            "xyz.openbmc_project.Inventory.Decorator.FruDevice");
-        if (findFruDevice == entry.second.end())
-        {
-            return false;
-        }
+    auto entity = std::find_if(
+        entities.begin(), entities.end(),
+        [bus, address, &entityData](ManagedEntry& entry) {
+            auto findFruDevice = entry.second.find(
+                "xyz.openbmc_project.Inventory.Decorator.FruDevice");
+            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;
+            }
 
-        // 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())
     {
@@ -695,8 +698,8 @@
         if (boost::starts_with(filename, intel_oem::ipmi::sel::selLogFilename))
         {
             // If we find an ipmi_sel log file, save the path
-            selLogFiles.emplace_back(intel_oem::ipmi::sel::selLogDir /
-                                     filename);
+            selLogFiles.emplace_back(
+                intel_oem::ipmi::sel::selLogDir / filename);
         }
     }
     // As the log files rotate, they are appended with a ".#" that is higher for
@@ -1081,10 +1084,9 @@
     return ipmi::responseSuccess(responseID);
 }
 
-ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr&,
-                                           uint16_t reservationID,
-                                           const std::array<uint8_t, 3>& clr,
-                                           uint8_t eraseOperation)
+ipmi::RspType<uint8_t> ipmiStorageClearSEL(
+    ipmi::Context::ptr&, uint16_t reservationID,
+    const std::array<uint8_t, 3>& clr, uint8_t eraseOperation)
 {
     if (!checkSELReservation(reservationID))
     {
@@ -1183,8 +1185,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;
@@ -1218,8 +1220,8 @@
     }
     else
     {
-        throw std::runtime_error("getNMDiscoverySDR:: Illegal index " +
-                                 std::to_string(index));
+        throw std::runtime_error(
+            "getNMDiscoverySDR:: Illegal index " + std::to_string(index));
     }
 
     return resp;
diff --git a/tests/test_sensorcommands.cpp b/tests/test_sensorcommands.cpp
index 2707a3e..afa31f2 100644
--- a/tests/test_sensorcommands.cpp
+++ b/tests/test_sensorcommands.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);
@@ -429,8 +429,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);
