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/common/flight_recorder.hpp b/common/flight_recorder.hpp
index 47afed0..123c2f5 100644
--- a/common/flight_recorder.hpp
+++ b/common/flight_recorder.hpp
@@ -77,8 +77,8 @@
             int currentIndex = index++;
             tapeRecorder[currentIndex] = std::make_tuple(
                 pldm::utils::getCurrentSystemTime(), isRequest, buffer);
-            index = (currentIndex == FLIGHT_RECORDER_MAX_ENTRIES - 1) ? 0
-                                                                      : index;
+            index =
+                (currentIndex == FLIGHT_RECORDER_MAX_ENTRIES - 1) ? 0 : index;
         }
     }
 
@@ -96,8 +96,8 @@
                  flightRecorderDumpPath);
             for (const auto& message : tapeRecorder)
             {
-                recorderOutputFile << std::get<FlightRecorderTimeStamp>(message)
-                                   << " : ";
+                recorderOutputFile
+                    << std::get<FlightRecorderTimeStamp>(message) << " : ";
                 if (std::get<ReqOrResponse>(message))
                 {
                     recorderOutputFile << "Tx : \n";
diff --git a/common/test/mocked_utils.hpp b/common/test/mocked_utils.hpp
index e42677c..1e7cf6e 100644
--- a/common/test/mocked_utils.hpp
+++ b/common/test/mocked_utils.hpp
@@ -25,8 +25,8 @@
 class GetManagedEmptyObject
 {
   public:
-    static pldm::utils::ObjectValueTree getManagedObj(const char* /*service*/,
-                                                      const char* /*path*/)
+    static pldm::utils::ObjectValueTree
+        getManagedObj(const char* /*service*/, const char* /*path*/)
     {
         return pldm::utils::ObjectValueTree{};
     }
@@ -35,8 +35,8 @@
 class GetManagedObject
 {
   public:
-    static pldm::utils::ObjectValueTree getManagedObj(const char* /*service*/,
-                                                      const char* /*path*/)
+    static pldm::utils::ObjectValueTree
+        getManagedObj(const char* /*service*/, const char* /*path*/)
     {
         return pldm::utils::ObjectValueTree{
             {sdbusplus::message::object_path("/foo/bar"),
diff --git a/common/test/pldm_utils_test.cpp b/common/test/pldm_utils_test.cpp
index c750ae3..d00bebd 100644
--- a/common/test/pldm_utils_test.cpp
+++ b/common/test/pldm_utils_test.cpp
@@ -143,9 +143,9 @@
     uint16_t entityID = 33;
     uint16_t stateSetId = 196;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
 
@@ -177,9 +177,9 @@
     uint16_t entityID = 44;
     uint16_t stateSetId = 196;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
 
@@ -211,9 +211,9 @@
     uint16_t entityID = 33;
     uint16_t stateSetId = 196;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states));
 
     auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo);
 
@@ -227,9 +227,9 @@
     auto repo = pldm_pdr_init();
     uint8_t tid = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
 
@@ -288,9 +288,9 @@
     uint16_t entityID = 33;
     uint16_t stateSetId = 196;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
 
@@ -345,9 +345,9 @@
     uint16_t entityID = 67;
     uint16_t stateSetId = 192;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
 
@@ -403,9 +403,9 @@
     uint16_t entityID = 67;
     uint16_t stateSetId = 192;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
 
@@ -479,9 +479,9 @@
     uint16_t entityID = 67;
     uint16_t stateSetId = 192;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states) * 3);
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states) * 3);
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
     auto state_start = rec->possible_states;
@@ -525,9 +525,9 @@
     uint16_t entityID = 67;
     uint16_t stateSetId = 192;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_effecter_possible_states) * 3);
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_effecter_possible_states) * 3);
 
     auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
     auto state_start = rec->possible_states;
@@ -571,9 +571,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
 
@@ -605,9 +605,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
 
@@ -639,9 +639,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto record = findStateSensorPDR(tid, entityID, stateSetId, repo);
 
@@ -655,9 +655,9 @@
     auto repo = pldm_pdr_init();
     uint8_t tid = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
 
@@ -716,9 +716,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
 
@@ -773,9 +773,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
 
@@ -831,9 +831,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
 
@@ -874,9 +874,9 @@
                            &handle),
               0);
 
-    std::vector<uint8_t> pdr_third(sizeof(struct pldm_state_sensor_pdr) -
-                                   sizeof(uint8_t) +
-                                   sizeof(struct state_sensor_possible_states));
+    std::vector<uint8_t> pdr_third(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states));
 
     auto rec_third = reinterpret_cast<pldm_state_sensor_pdr*>(pdr_third.data());
 
@@ -906,9 +906,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states) * 3);
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states) * 3);
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
     auto state_start = rec->possible_states;
@@ -954,9 +954,9 @@
     uint16_t entityID = 5;
     uint16_t stateSetId = 1;
 
-    std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
-                             sizeof(uint8_t) +
-                             sizeof(struct state_sensor_possible_states) * 3);
+    std::vector<uint8_t> pdr(
+        sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+        sizeof(struct state_sensor_possible_states) * 3);
 
     auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
     auto state_start = rec->possible_states;
diff --git a/common/transport.cpp b/common/transport.cpp
index d992415..9641c38 100644
--- a/common/transport.cpp
+++ b/common/transport.cpp
@@ -151,9 +151,8 @@
     return pldm_transport_recv_msg(transport, &tid, (void**)&rx, &len);
 }
 
-pldm_requester_rc_t PldmTransport::sendRecvMsg(pldm_tid_t tid, const void* tx,
-                                               size_t txLen, void*& rx,
-                                               size_t& rxLen)
+pldm_requester_rc_t PldmTransport::sendRecvMsg(
+    pldm_tid_t tid, const void* tx, size_t txLen, void*& rx, size_t& rxLen)
 {
     return pldm_transport_send_recv_msg(transport, tid, tx, txLen, &rx, &rxLen);
 }
diff --git a/common/utils.cpp b/common/utils.cpp
index 1cd5a72..e652021 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -27,10 +27,9 @@
 namespace utils
 {
 
-std::vector<std::vector<uint8_t>> findStateEffecterPDR(uint8_t /*tid*/,
-                                                       uint16_t entityID,
-                                                       uint16_t stateSetId,
-                                                       const pldm_pdr* repo)
+std::vector<std::vector<uint8_t>>
+    findStateEffecterPDR(uint8_t /*tid*/, uint16_t entityID,
+                         uint16_t stateSetId, const pldm_pdr* repo)
 {
     uint8_t* outData = nullptr;
     uint32_t size{};
@@ -80,10 +79,9 @@
     return pdrs;
 }
 
-std::vector<std::vector<uint8_t>> findStateSensorPDR(uint8_t /*tid*/,
-                                                     uint16_t entityID,
-                                                     uint16_t stateSetId,
-                                                     const pldm_pdr* repo)
+std::vector<std::vector<uint8_t>>
+    findStateSensorPDR(uint8_t /*tid*/, uint16_t entityID, uint16_t stateSetId,
+                       const pldm_pdr* repo)
 {
     uint8_t* outData = nullptr;
     uint32_t size{};
@@ -203,9 +201,8 @@
     return true;
 }
 
-std::optional<std::vector<set_effecter_state_field>>
-    parseEffecterData(const std::vector<uint8_t>& effecterData,
-                      uint8_t effecterCount)
+std::optional<std::vector<set_effecter_state_field>> parseEffecterData(
+    const std::vector<uint8_t>& effecterData, uint8_t effecterCount)
 {
     std::vector<set_effecter_state_field> stateField;
 
@@ -316,8 +313,8 @@
 {
     auto setDbusValue = [&dBusMap, this](const auto& variant) {
         auto& bus = getBus();
-        auto service = getService(dBusMap.objectPath.c_str(),
-                                  dBusMap.interface.c_str());
+        auto service =
+            getService(dBusMap.objectPath.c_str(), dBusMap.interface.c_str());
         auto method = bus.new_method_call(
             service.c_str(), dBusMap.objectPath.c_str(), dbusProperties, "Set");
         method.append(dBusMap.interface.c_str(), dBusMap.propertyName.c_str(),
@@ -388,8 +385,8 @@
 {
     auto& bus = DBusHandler::getBus();
     auto service = getService(objPath, dbusInterface);
-    auto method = bus.new_method_call(service.c_str(), objPath, dbusProperties,
-                                      "Get");
+    auto method =
+        bus.new_method_call(service.c_str(), objPath, dbusProperties, "Get");
     method.append(dbusInterface, dbusProp);
     return bus.call(method, dbusTimeout).unpack<PropertyValue>();
 }
@@ -404,14 +401,13 @@
     return bus.call(method).unpack<ObjectValueTree>();
 }
 
-PropertyMap
-    DBusHandler::getDbusPropertiesVariant(const char* serviceName,
-                                          const char* objPath,
-                                          const char* dbusInterface) const
+PropertyMap DBusHandler::getDbusPropertiesVariant(
+    const char* serviceName, const char* objPath,
+    const char* dbusInterface) const
 {
     auto& bus = DBusHandler::getBus();
-    auto method = bus.new_method_call(serviceName, objPath, dbusProperties,
-                                      "GetAll");
+    auto method =
+        bus.new_method_call(serviceName, objPath, dbusProperties, "GetAll");
     method.append(dbusInterface);
     return bus.call(method, dbusTimeout).unpack<PropertyMap>();
 }
@@ -556,8 +552,8 @@
             {
                 return sensorPdr->sensor_id;
             }
-            possible_states_start += possibleStateSize + sizeof(setId) +
-                                     sizeof(possibleStateSize);
+            possible_states_start +=
+                possibleStateSize + sizeof(setId) + sizeof(possibleStateSize);
         }
     }
     return PLDM_INVALID_EFFECTER_ID;
@@ -606,8 +602,8 @@
         if (!trimStr.empty())
         {
             dstStr.remove_prefix(dstStr.find_first_not_of(trimStr));
-            dstStr.remove_suffix(dstStr.size() - 1 -
-                                 dstStr.find_last_not_of(trimStr));
+            dstStr.remove_suffix(
+                dstStr.size() - 1 - dstStr.find_last_not_of(trimStr));
         }
 
         if (!dstStr.empty())
diff --git a/common/utils.hpp b/common/utils.hpp
index 6b8ea7c..5561399 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -106,9 +106,8 @@
  *  @return[out] parse success and get a valid set_effecter_state_field
  *               structure, return nullopt means parse failed
  */
-std::optional<std::vector<set_effecter_state_field>>
-    parseEffecterData(const std::vector<uint8_t>& effecterData,
-                      uint8_t effecterCount);
+std::optional<std::vector<set_effecter_state_field>> parseEffecterData(
+    const std::vector<uint8_t>& effecterData, uint8_t effecterCount);
 
 /**
  *  @brief creates an error log
@@ -312,8 +311,8 @@
     auto getDbusProperty(const char* objPath, const char* dbusProp,
                          const char* dbusInterface)
     {
-        auto VariantValue = getDbusPropertyVariant(objPath, dbusProp,
-                                                   dbusInterface);
+        auto VariantValue =
+            getDbusPropertyVariant(objPath, dbusProp, dbusInterface);
         return std::get<Property>(VariantValue);
     }
 
@@ -403,10 +402,8 @@
  *  @param[in] repo - pointer to BMC's primary PDR repo.
  *  @return array[array[uint8_t]] - StateEffecterPDRs
  */
-std::vector<std::vector<uint8_t>> findStateEffecterPDR(uint8_t tid,
-                                                       uint16_t entityID,
-                                                       uint16_t stateSetId,
-                                                       const pldm_pdr* repo);
+std::vector<std::vector<uint8_t>> findStateEffecterPDR(
+    uint8_t tid, uint16_t entityID, uint16_t stateSetId, const pldm_pdr* repo);
 /** @brief Find State Sensor PDR
  *  @param[in] tid - PLDM terminus ID.
  *  @param[in] entityID - entity that can be associated with PLDM State set.
@@ -414,10 +411,8 @@
  *  @param[in] repo - pointer to BMC's primary PDR repo.
  *  @return array[array[uint8_t]] - StateSensorPDRs
  */
-std::vector<std::vector<uint8_t>> findStateSensorPDR(uint8_t tid,
-                                                     uint16_t entityID,
-                                                     uint16_t stateSetId,
-                                                     const pldm_pdr* repo);
+std::vector<std::vector<uint8_t>> findStateSensorPDR(
+    uint8_t tid, uint16_t entityID, uint16_t stateSetId, const pldm_pdr* repo);
 
 /** @brief Find sensor id from a state sensor PDR
  *
diff --git a/fw-update/device_updater.cpp b/fw-update/device_updater.cpp
index 50456eb..c8f58b1 100644
--- a/fw-update/device_updater.cpp
+++ b/fw-update/device_updater.cpp
@@ -35,9 +35,9 @@
     compImgSetVerStrInfo.length =
         static_cast<uint8_t>(compImageSetVersion.size());
 
-    Request request(sizeof(pldm_msg_hdr) +
-                    sizeof(struct pldm_request_update_req) +
-                    compImgSetVerStrInfo.length);
+    Request request(
+        sizeof(pldm_msg_hdr) + sizeof(struct pldm_request_update_req) +
+        compImgSetVerStrInfo.length);
     auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
 
     auto rc = encode_request_update_req(
@@ -165,9 +165,9 @@
     compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVersion.data());
     compVerStrInfo.length = static_cast<uint8_t>(compVersion.size());
 
-    Request request(sizeof(pldm_msg_hdr) +
-                    sizeof(struct pldm_pass_component_table_req) +
-                    compVerStrInfo.length);
+    Request request(
+        sizeof(pldm_msg_hdr) + sizeof(struct pldm_pass_component_table_req) +
+        compVerStrInfo.length);
     auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
     auto rc = encode_pass_component_table_req(
         instanceId, transferFlag, compClassification, compIdentifier,
@@ -212,9 +212,9 @@
     uint8_t compResponse = 0;
     uint8_t compResponseCode = 0;
 
-    auto rc = decode_pass_component_table_resp(response, respMsgLen,
-                                               &completionCode, &compResponse,
-                                               &compResponseCode);
+    auto rc =
+        decode_pass_component_table_resp(response, respMsgLen, &completionCode,
+                                         &compResponse, &compResponseCode);
     if (rc)
     {
         // Handle error scenario
@@ -293,9 +293,9 @@
     compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVersion.data());
     compVerStrInfo.length = static_cast<uint8_t>(compVersion.size());
 
-    Request request(sizeof(pldm_msg_hdr) +
-                    sizeof(struct pldm_update_component_req) +
-                    compVerStrInfo.length);
+    Request request(
+        sizeof(pldm_msg_hdr) + sizeof(struct pldm_update_component_req) +
+        compVerStrInfo.length);
     auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
 
     auto rc = encode_update_component_req(
@@ -436,13 +436,13 @@
     response.resize(sizeof(pldm_msg_hdr) + sizeof(completionCode) + length);
     responseMsg = reinterpret_cast<pldm_msg*>(response.data());
     package.seekg(compOffset + offset);
-    package.read(reinterpret_cast<char*>(response.data() +
-                                         sizeof(pldm_msg_hdr) +
-                                         sizeof(completionCode)),
-                 length - padBytes);
-    rc = encode_request_firmware_data_resp(request->hdr.instance_id,
-                                           completionCode, responseMsg,
-                                           sizeof(completionCode));
+    package.read(
+        reinterpret_cast<char*>(
+            response.data() + sizeof(pldm_msg_hdr) + sizeof(completionCode)),
+        length - padBytes);
+    rc = encode_request_firmware_data_resp(
+        request->hdr.instance_id, completionCode, responseMsg,
+        sizeof(completionCode));
     if (rc)
     {
         error(
@@ -462,8 +462,8 @@
     auto responseMsg = reinterpret_cast<pldm_msg*>(response.data());
 
     uint8_t transferResult = 0;
-    auto rc = decode_transfer_complete_req(request, payloadLength,
-                                           &transferResult);
+    auto rc =
+        decode_transfer_complete_req(request, payloadLength, &transferResult);
     if (rc)
     {
         error(
@@ -652,8 +652,8 @@
 {
     pldmRequest.reset();
     auto instanceId = updateManager->instanceIdDb.next(eid);
-    Request request(sizeof(pldm_msg_hdr) +
-                    sizeof(struct pldm_activate_firmware_req));
+    Request request(
+        sizeof(pldm_msg_hdr) + sizeof(struct pldm_activate_firmware_req));
     auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
 
     auto rc = encode_activate_firmware_req(
diff --git a/fw-update/device_updater.hpp b/fw-update/device_updater.hpp
index 6d96da8..4613a7c 100644
--- a/fw-update/device_updater.hpp
+++ b/fw-update/device_updater.hpp
@@ -53,8 +53,7 @@
                            const ComponentInfo& compInfo,
                            uint32_t maxTransferSize,
                            UpdateManager* updateManager) :
-        eid(eid),
-        package(package), fwDeviceIDRecord(fwDeviceIDRecord),
+        eid(eid), package(package), fwDeviceIDRecord(fwDeviceIDRecord),
         compImageInfos(compImageInfos), compInfo(compInfo),
         maxTransferSize(maxTransferSize), updateManager(updateManager)
     {}
diff --git a/fw-update/inventory_manager.cpp b/fw-update/inventory_manager.cpp
index b466984..43508a7 100644
--- a/fw-update/inventory_manager.cpp
+++ b/fw-update/inventory_manager.cpp
@@ -20,8 +20,8 @@
     for (const auto& eid : eids)
     {
         auto instanceId = instanceIdDb.next(eid);
-        Request requestMsg(sizeof(pldm_msg_hdr) +
-                           PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES);
+        Request requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
         auto rc = encode_query_device_identifiers_req(
             instanceId, PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES, request);
@@ -47,9 +47,8 @@
     }
 }
 
-void InventoryManager::queryDeviceIdentifiers(mctp_eid_t eid,
-                                              const pldm_msg* response,
-                                              size_t respMsgLen)
+void InventoryManager::queryDeviceIdentifiers(
+    mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen)
 {
     if (response == nullptr || !respMsgLen)
     {
@@ -152,8 +151,8 @@
 void InventoryManager::sendGetFirmwareParametersRequest(mctp_eid_t eid)
 {
     auto instanceId = instanceIdDb.next(eid);
-    Request requestMsg(sizeof(pldm_msg_hdr) +
-                       PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES);
+    Request requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto rc = encode_get_firmware_parameters_req(
         instanceId, PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES, request);
@@ -178,9 +177,8 @@
     }
 }
 
-void InventoryManager::getFirmwareParameters(mctp_eid_t eid,
-                                             const pldm_msg* response,
-                                             size_t respMsgLen)
+void InventoryManager::getFirmwareParameters(
+    mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen)
 {
     if (response == nullptr || !respMsgLen)
     {
diff --git a/fw-update/inventory_manager.hpp b/fw-update/inventory_manager.hpp
index 1ea4685..953d7a4 100644
--- a/fw-update/inventory_manager.hpp
+++ b/fw-update/inventory_manager.hpp
@@ -41,9 +41,8 @@
         pldm::requester::Handler<pldm::requester::Request>& handler,
         InstanceIdDb& instanceIdDb, DescriptorMap& descriptorMap,
         ComponentInfoMap& componentInfoMap) :
-        handler(handler),
-        instanceIdDb(instanceIdDb), descriptorMap(descriptorMap),
-        componentInfoMap(componentInfoMap)
+        handler(handler), instanceIdDb(instanceIdDb),
+        descriptorMap(descriptorMap), componentInfoMap(componentInfoMap)
     {}
 
     /** @brief Discover the firmware identifiers and component details of FDs
diff --git a/fw-update/package_parser.cpp b/fw-update/package_parser.cpp
index e13a8d5..6acb7ba 100644
--- a/fw-update/package_parser.cpp
+++ b/fw-update/package_parser.cpp
@@ -130,9 +130,9 @@
         fwDeviceIDRecords.emplace_back(std::make_tuple(
             deviceUpdateOptionFlags, componentsList,
             utils::toString(compImageSetVersionStr), std::move(descriptors),
-            FirmwareDevicePackageData{fwDevicePkgData.ptr,
-                                      fwDevicePkgData.ptr +
-                                          fwDevicePkgData.length}));
+            FirmwareDevicePackageData{
+                fwDevicePkgData.ptr,
+                fwDevicePkgData.ptr + fwDevicePkgData.length}));
         offset += deviceIdRecHeader.record_length;
         pkgHdrRemainingSize -= deviceIdRecHeader.record_length;
     }
@@ -151,9 +151,9 @@
         pldm_component_image_information compImageInfo{};
         variable_field compVersion{};
 
-        auto rc = decode_pldm_comp_image_info(pkgHdr.data() + offset,
-                                              pkgHdrRemainingSize,
-                                              &compImageInfo, &compVersion);
+        auto rc = decode_pldm_comp_image_info(
+            pkgHdr.data() + offset, pkgHdrRemainingSize, &compImageInfo,
+            &compVersion);
         if (rc)
         {
             error(
diff --git a/fw-update/package_parser.hpp b/fw-update/package_parser.hpp
index 2192acc..5578916 100644
--- a/fw-update/package_parser.hpp
+++ b/fw-update/package_parser.hpp
@@ -47,8 +47,7 @@
     explicit PackageParser(PackageHeaderSize pkgHeaderSize,
                            const PackageVersion& pkgVersion,
                            ComponentBitmapBitLength componentBitmapBitLength) :
-        pkgHeaderSize(pkgHeaderSize),
-        pkgVersion(pkgVersion),
+        pkgHeaderSize(pkgHeaderSize), pkgVersion(pkgVersion),
         componentBitmapBitLength(componentBitmapBitLength)
     {}
 
diff --git a/fw-update/update_manager.hpp b/fw-update/update_manager.hpp
index 26a1de9..61db3e7 100644
--- a/fw-update/update_manager.hpp
+++ b/fw-update/update_manager.hpp
@@ -46,8 +46,7 @@
         pldm::requester::Handler<pldm::requester::Request>& handler,
         InstanceIdDb& instanceIdDb, const DescriptorMap& descriptorMap,
         const ComponentInfoMap& componentInfoMap) :
-        event(event),
-        handler(handler), instanceIdDb(instanceIdDb),
+        event(event), handler(handler), instanceIdDb(instanceIdDb),
         descriptorMap(descriptorMap), componentInfoMap(componentInfoMap),
         watch(event.get(),
               std::bind_front(&UpdateManager::processPackage, this)),
diff --git a/fw-update/watch.cpp b/fw-update/watch.cpp
index 208d818..60f18fc 100644
--- a/fw-update/watch.cpp
+++ b/fw-update/watch.cpp
@@ -35,8 +35,8 @@
         // Store a copy of errno, because the string creation below will
         // invalidate errno due to one more system calls.
         auto error = errno;
-        throw std::runtime_error("inotify_init1 failed, errno="s +
-                                 std::strerror(error));
+        throw std::runtime_error(
+            "inotify_init1 failed, errno="s + std::strerror(error));
     }
 
     wd = inotify_add_watch(fd, "/tmp/images", IN_CLOSE_WRITE);
@@ -44,15 +44,15 @@
     {
         auto error = errno;
         close(fd);
-        throw std::runtime_error("inotify_add_watch failed, errno="s +
-                                 std::strerror(error));
+        throw std::runtime_error(
+            "inotify_add_watch failed, errno="s + std::strerror(error));
     }
 
     auto rc = sd_event_add_io(loop, nullptr, fd, EPOLLIN, callback, this);
     if (0 > rc)
     {
-        throw std::runtime_error("failed to add to event loop, rc="s +
-                                 std::strerror(-rc));
+        throw std::runtime_error(
+            "failed to add to event loop, rc="s + std::strerror(-rc));
     }
 }
 
@@ -82,8 +82,8 @@
     if (0 > bytes)
     {
         auto error = errno;
-        throw std::runtime_error("failed to read inotify event, errno="s +
-                                 std::strerror(error));
+        throw std::runtime_error(
+            "failed to read inotify event, errno="s + std::strerror(error));
     }
 
     auto offset = 0;
diff --git a/host-bmc/dbus_to_event_handler.cpp b/host-bmc/dbus_to_event_handler.cpp
index 41826d0..9ad607e 100644
--- a/host-bmc/dbus_to_event_handler.cpp
+++ b/host-bmc/dbus_to_event_handler.cpp
@@ -21,17 +21,16 @@
 DbusToPLDMEvent::DbusToPLDMEvent(
     int /* mctp_fd */, uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
     pldm::requester::Handler<pldm::requester::Request>* handler) :
-    mctp_eid(mctp_eid),
-    instanceIdDb(instanceIdDb), handler(handler)
+    mctp_eid(mctp_eid), instanceIdDb(instanceIdDb), handler(handler)
 {}
 
 void DbusToPLDMEvent::sendEventMsg(uint8_t eventType,
                                    const std::vector<uint8_t>& eventDataVec)
 {
     auto instanceId = instanceIdDb.next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
-                                    eventDataVec.size());
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+        eventDataVec.size());
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
     auto rc = encode_platform_event_message_req(
@@ -47,8 +46,9 @@
         return;
     }
 
-    auto platformEventMessageResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+                                                  const pldm_msg* response,
+                                                  size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error("Failed to receive response for platform event message");
@@ -113,62 +113,65 @@
                               dbusMapping.interface.c_str()),
             [this, sensorEventDataVec, dbusValueMapping, dbusMapping, sensorId,
              offset](auto& msg) mutable {
-            DbusChangedProps props{};
-            std::string intf;
-            uint8_t previousState = PLDM_SENSOR_UNKNOWN;
-            msg.read(intf, props);
-            if (!props.contains(dbusMapping.propertyName))
-            {
-                return;
-            }
-            for (const auto& itr : dbusValueMapping)
-            {
-                bool findValue = false;
-                if (dbusMapping.propertyType == "string")
+                DbusChangedProps props{};
+                std::string intf;
+                uint8_t previousState = PLDM_SENSOR_UNKNOWN;
+                msg.read(intf, props);
+                if (!props.contains(dbusMapping.propertyName))
                 {
-                    std::string src = std::get<std::string>(itr.second);
-                    std::string dst = std::get<std::string>(
-                        props.at(dbusMapping.propertyName));
-
-                    auto values = pldm::utils::split(src, "||", " ");
-                    for (const auto& value : values)
+                    return;
+                }
+                for (const auto& itr : dbusValueMapping)
+                {
+                    bool findValue = false;
+                    if (dbusMapping.propertyType == "string")
                     {
-                        if (value == dst)
+                        std::string src = std::get<std::string>(itr.second);
+                        std::string dst = std::get<std::string>(
+                            props.at(dbusMapping.propertyName));
+
+                        auto values = pldm::utils::split(src, "||", " ");
+                        for (const auto& value : values)
                         {
-                            findValue = true;
-                            break;
+                            if (value == dst)
+                            {
+                                findValue = true;
+                                break;
+                            }
                         }
                     }
-                }
-                else
-                {
-                    findValue = itr.second == props.at(dbusMapping.propertyName)
-                                    ? true
-                                    : false;
-                }
-
-                if (findValue)
-                {
-                    auto eventData =
-                        reinterpret_cast<struct pldm_sensor_event_data*>(
-                            sensorEventDataVec.data());
-                    eventData->event_class[1] = itr.first;
-                    if (sensorCacheMap.contains(sensorId) &&
-                        sensorCacheMap[sensorId][offset] != PLDM_SENSOR_UNKNOWN)
-                    {
-                        previousState = sensorCacheMap[sensorId][offset];
-                    }
                     else
                     {
-                        previousState = itr.first;
+                        findValue =
+                            itr.second == props.at(dbusMapping.propertyName)
+                                ? true
+                                : false;
                     }
-                    eventData->event_class[2] = previousState;
-                    this->sendEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec);
-                    updateSensorCacheMaps(sensorId, offset, previousState);
-                    break;
+
+                    if (findValue)
+                    {
+                        auto eventData =
+                            reinterpret_cast<struct pldm_sensor_event_data*>(
+                                sensorEventDataVec.data());
+                        eventData->event_class[1] = itr.first;
+                        if (sensorCacheMap.contains(sensorId) &&
+                            sensorCacheMap[sensorId][offset] !=
+                                PLDM_SENSOR_UNKNOWN)
+                        {
+                            previousState = sensorCacheMap[sensorId][offset];
+                        }
+                        else
+                        {
+                            previousState = itr.first;
+                        }
+                        eventData->event_class[2] = previousState;
+                        this->sendEventMsg(PLDM_SENSOR_EVENT,
+                                           sensorEventDataVec);
+                        updateSensorCacheMaps(sensorId, offset, previousState);
+                        break;
+                    }
                 }
-            }
-        });
+            });
         stateSensorMatchs.emplace_back(std::move(stateSensorMatch));
     }
 }
@@ -179,8 +182,8 @@
     const std::map<Type, sensorEvent> sensorHandlers = {
         {PLDM_STATE_SENSOR_PDR,
          [this](SensorId sensorId, const DbusObjMaps& dbusMaps) {
-        this->sendStateSensorEvent(sensorId, dbusMaps);
-    }}};
+             this->sendStateSensorEvent(sensorId, dbusMaps);
+         }}};
 
     pldm_state_sensor_pdr* pdr = nullptr;
     std::unique_ptr<pldm_pdr, decltype(&pldm_pdr_destroy)> sensorPdrRepo(
diff --git a/host-bmc/dbus_to_host_effecters.cpp b/host-bmc/dbus_to_host_effecters.cpp
index 0774685..9b1c250 100644
--- a/host-bmc/dbus_to_host_effecters.cpp
+++ b/host-bmc/dbus_to_host_effecters.cpp
@@ -68,12 +68,12 @@
         EffecterInfo effecterInfo;
         effecterInfo.mctpEid = entry.value("mctp_eid", 0xFF);
         auto jsonEffecterInfo = entry.value("effecter_info", empty);
-        auto effecterId = jsonEffecterInfo.value("effecterID",
-                                                 PLDM_INVALID_EFFECTER_ID);
+        auto effecterId =
+            jsonEffecterInfo.value("effecterID", PLDM_INVALID_EFFECTER_ID);
         effecterInfo.containerId = jsonEffecterInfo.value("containerID", 0);
         effecterInfo.entityType = jsonEffecterInfo.value("entityType", 0);
-        effecterInfo.entityInstance = jsonEffecterInfo.value("entityInstance",
-                                                             0);
+        effecterInfo.entityInstance =
+            jsonEffecterInfo.value("entityInstance", 0);
         effecterInfo.compEffecterCnt =
             jsonEffecterInfo.value("compositeEffecterCount", 0);
         auto effecters = entry.value("effecters", emptyList);
@@ -83,10 +83,10 @@
             auto jsonDbusInfo = effecter.value("dbus_info", empty);
             dbusInfo.dbusMap.objectPath = jsonDbusInfo.value("object_path", "");
             dbusInfo.dbusMap.interface = jsonDbusInfo.value("interface", "");
-            dbusInfo.dbusMap.propertyName = jsonDbusInfo.value("property_name",
-                                                               "");
-            dbusInfo.dbusMap.propertyType = jsonDbusInfo.value("property_type",
-                                                               "");
+            dbusInfo.dbusMap.propertyName =
+                jsonDbusInfo.value("property_name", "");
+            dbusInfo.dbusMap.propertyType =
+                jsonDbusInfo.value("property_type", "");
             Json propertyValues = jsonDbusInfo["property_values"];
 
             populatePropVals(propertyValues, dbusInfo.propertyValues,
@@ -192,8 +192,8 @@
     uint8_t newState{};
     try
     {
-        newState = findNewStateValue(effecterInfoIndex, dbusInfoIndex,
-                                     it->second);
+        newState =
+            findNewStateValue(effecterInfoIndex, dbusInfoIndex, it->second);
     }
     catch (const std::out_of_range& e)
     {
@@ -235,10 +235,9 @@
     }
 }
 
-uint8_t
-    HostEffecterParser::findNewStateValue(size_t effecterInfoIndex,
-                                          size_t dbusInfoIndex,
-                                          const PropertyValue& propertyValue)
+uint8_t HostEffecterParser::findNewStateValue(
+    size_t effecterInfoIndex, size_t dbusInfoIndex,
+    const PropertyValue& propertyValue)
 {
     const auto& propValues = hostEffecterInfo[effecterInfoIndex]
                                  .dbusInfo[dbusInfoIndex]
@@ -285,8 +284,9 @@
         return rc;
     }
 
-    auto setStateEffecterStatesRespHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto setStateEffecterStatesRespHandler = [](mctp_eid_t /*eid*/,
+                                                const pldm_msg* response,
+                                                size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error(
@@ -326,11 +326,9 @@
     return rc;
 }
 
-void HostEffecterParser::createHostEffecterMatch(const std::string& objectPath,
-                                                 const std::string& interface,
-                                                 size_t effecterInfoIndex,
-                                                 size_t dbusInfoIndex,
-                                                 uint16_t effecterId)
+void HostEffecterParser::createHostEffecterMatch(
+    const std::string& objectPath, const std::string& interface,
+    size_t effecterInfoIndex, size_t dbusInfoIndex, uint16_t effecterId)
 {
     using namespace sdbusplus::bus::match::rules;
     effecterInfoMatch.emplace_back(std::make_unique<sdbusplus::bus::match_t>(
@@ -338,12 +336,12 @@
         propertiesChanged(objectPath, interface),
         [this, effecterInfoIndex, dbusInfoIndex,
          effecterId](sdbusplus::message_t& msg) {
-        DbusChgHostEffecterProps props;
-        std::string iface;
-        msg.read(iface, props);
-        processHostEffecterChangeNotification(props, effecterInfoIndex,
-                                              dbusInfoIndex, effecterId);
-    }));
+            DbusChgHostEffecterProps props;
+            std::string iface;
+            msg.read(iface, props);
+            processHostEffecterChangeNotification(props, effecterInfoIndex,
+                                                  dbusInfoIndex, effecterId);
+        }));
 }
 
 } // namespace host_effecters
diff --git a/host-bmc/dbus_to_host_effecters.hpp b/host-bmc/dbus_to_host_effecters.hpp
index c06e8b0..7591381 100644
--- a/host-bmc/dbus_to_host_effecters.hpp
+++ b/host-bmc/dbus_to_host_effecters.hpp
@@ -86,8 +86,8 @@
         pldm::utils::DBusHandler* const dbusHandler,
         const std::string& jsonPath,
         pldm::requester::Handler<pldm::requester::Request>* handler) :
-        instanceIdDb(instanceIdDb),
-        sockFd(fd), pdrRepo(repo), dbusHandler(dbusHandler), handler(handler)
+        instanceIdDb(instanceIdDb), sockFd(fd), pdrRepo(repo),
+        dbusHandler(dbusHandler), handler(handler)
     {
         try
         {
@@ -141,10 +141,9 @@
      * @param[in] effecterId - host effecter id
      * @return - PLDM status code
      */
-    virtual int
-        setHostStateEffecter(size_t effecterInfoIndex,
-                             std::vector<set_effecter_state_field>& stateField,
-                             uint16_t effecterId);
+    virtual int setHostStateEffecter(
+        size_t effecterInfoIndex,
+        std::vector<set_effecter_state_field>& stateField, uint16_t effecterId);
 
     /* @brief Fetches the new state value and the index in stateField set which
      *        needs to be set with the new value in the setStateEffecter call
@@ -166,11 +165,9 @@
      * @param[in] dbusInfoIndex - index of dbusInfo within effecterInfo
      * @param[in] effecterId - host effecter id
      */
-    virtual void createHostEffecterMatch(const std::string& objectPath,
-                                         const std::string& interface,
-                                         size_t effecterInfoIndex,
-                                         size_t dbusInfoIndex,
-                                         uint16_t effecterId);
+    virtual void createHostEffecterMatch(
+        const std::string& objectPath, const std::string& interface,
+        size_t effecterInfoIndex, size_t dbusInfoIndex, uint16_t effecterId);
 
   protected:
     pldm::InstanceIdDb* instanceIdDb; //!< Reference to the InstanceIdDb object
diff --git a/host-bmc/host_condition.hpp b/host-bmc/host_condition.hpp
index f7d67fb..ad5a862 100644
--- a/host-bmc/host_condition.hpp
+++ b/host-bmc/host_condition.hpp
@@ -25,7 +25,7 @@
     virtual ~Host() = default;
 
     Host(sdbusplus::bus_t& bus, const std::string& path) :
-        HostIntf(bus, path.c_str()){};
+        HostIntf(bus, path.c_str()) {};
 
     /** @brief Override reads to CurrentFirmwareCondition */
     FirmwareCondition currentFirmwareCondition() const override;
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index ff50f94..4bcdb7c 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -74,8 +74,8 @@
     }
 
     pldm_entity entity{t->entity_type, t->entity_instance, t->container_id};
-    auto node = pldm_entity_association_tree_find_with_locality(entityTree,
-                                                                &entity, true);
+    auto node = pldm_entity_association_tree_find_with_locality(
+        entityTree, &entity, true);
     if (node)
     {
         pldm_entity e = pldm_entity_extract(node);
@@ -90,9 +90,9 @@
     pldm_entity_association_tree* bmcEntityTree,
     pldm::InstanceIdDb& instanceIdDb,
     pldm::requester::Handler<pldm::requester::Request>* handler) :
-    mctp_eid(mctp_eid),
-    event(event), repo(repo), stateSensorHandler(eventsJsonsDir),
-    entityTree(entityTree), instanceIdDb(instanceIdDb), handler(handler),
+    mctp_eid(mctp_eid), event(event), repo(repo),
+    stateSensorHandler(eventsJsonsDir), entityTree(entityTree),
+    instanceIdDb(instanceIdDb), handler(handler),
     entityMaps(parseEntityMap(ENTITY_MAP_JSON)), oemUtilsHandler(nullptr)
 {
     mergedHostParents = false;
@@ -101,31 +101,31 @@
         propertiesChanged("/xyz/openbmc_project/state/host0",
                           "xyz.openbmc_project.State.Host"),
         [this, repo, entityTree, bmcEntityTree](sdbusplus::message_t& msg) {
-        DbusChangedProps props{};
-        std::string intf;
-        msg.read(intf, props);
-        const auto itr = props.find("CurrentHostState");
-        if (itr != props.end())
-        {
-            PropertyValue value = itr->second;
-            auto propVal = std::get<std::string>(value);
-            if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
+            DbusChangedProps props{};
+            std::string intf;
+            msg.read(intf, props);
+            const auto itr = props.find("CurrentHostState");
+            if (itr != props.end())
             {
-                // Delete all the remote terminus information
-                std::erase_if(tlPDRInfo, [](const auto& item) {
-                    auto const& [key, value] = item;
-                    return key != TERMINUS_HANDLE;
-                });
-                pldm_pdr_remove_remote_pdrs(repo);
-                pldm_entity_association_tree_destroy_root(entityTree);
-                pldm_entity_association_tree_copy_root(bmcEntityTree,
-                                                       entityTree);
-                this->sensorMap.clear();
-                this->responseReceived = false;
-                this->mergedHostParents = false;
+                PropertyValue value = itr->second;
+                auto propVal = std::get<std::string>(value);
+                if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
+                {
+                    // Delete all the remote terminus information
+                    std::erase_if(tlPDRInfo, [](const auto& item) {
+                        const auto& [key, value] = item;
+                        return key != TERMINUS_HANDLE;
+                    });
+                    pldm_pdr_remove_remote_pdrs(repo);
+                    pldm_entity_association_tree_destroy_root(entityTree);
+                    pldm_entity_association_tree_copy_root(bmcEntityTree,
+                                                           entityTree);
+                    this->sensorMap.clear();
+                    this->responseReceived = false;
+                    this->mergedHostParents = false;
+                }
             }
-        }
-    });
+        });
 }
 
 void HostPDRHandler::fetchPDR(PDRRecordHandles&& recordHandles)
@@ -159,8 +159,8 @@
 {
     pdrFetchEvent.reset();
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_GET_PDR_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_GET_PDR_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     uint32_t recordHandle{};
     if (!nextRecordHandle && (!modifiedPDRRecordHandles.empty()) &&
@@ -180,9 +180,9 @@
     }
     auto instanceId = instanceIdDb.next(mctp_eid);
 
-    auto rc = encode_get_pdr_req(instanceId, recordHandle, 0,
-                                 PLDM_GET_FIRSTPART, UINT16_MAX, 0, request,
-                                 PLDM_GET_PDR_REQ_BYTES);
+    auto rc =
+        encode_get_pdr_req(instanceId, recordHandle, 0, PLDM_GET_FIRSTPART,
+                           UINT16_MAX, 0, request, PLDM_GET_PDR_REQ_BYTES);
     if (rc != PLDM_SUCCESS)
     {
         instanceIdDb.free(mctp_eid, instanceId);
@@ -299,8 +299,8 @@
             {
                 auto record = oemPlatformHandler->fetchLastBMCRecord(repo);
 
-                uint32_t record_handle = pldm_pdr_get_record_handle(repo,
-                                                                    record);
+                uint32_t record_handle =
+                    pldm_pdr_get_record_handle(repo, record);
 
                 rc =
                     pldm_entity_association_pdr_add_from_node_with_record_handle(
@@ -377,9 +377,9 @@
         return;
     }
     auto instanceId = instanceIdDb.next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
-                                    actualSize);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+        actualSize);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     rc = encode_platform_event_message_req(
         instanceId, 1, TERMINUS_ID, PLDM_PDR_REPOSITORY_CHG_EVENT,
@@ -394,8 +394,9 @@
         return;
     }
 
-    auto platformEventMessageResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+                                                  const pldm_msg* response,
+                                                  size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error(
@@ -449,9 +450,8 @@
     }
 }
 
-void HostPDRHandler::processHostPDRs(mctp_eid_t /*eid*/,
-                                     const pldm_msg* response,
-                                     size_t respMsgLen)
+void HostPDRHandler::processHostPDRs(
+    mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen)
 {
     static bool merged = false;
     static PDRList stateSensorPDRs{};
@@ -704,8 +704,8 @@
 {
     responseReceived = false;
     auto instanceId = instanceIdDb.next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_GET_VERSION_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_GET_VERSION_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto rc = encode_get_version_req(instanceId, 0, PLDM_GET_FIRSTPART,
                                      PLDM_BASE, request);
@@ -795,9 +795,11 @@
                     return;
                 }
 
-                auto getStateSensorReadingRespHandler =
-                    [=, this](mctp_eid_t /*eid*/, const pldm_msg* response,
-                              size_t respMsgLen) {
+                auto getStateSensorReadingRespHandler = [=, this](
+                                                            mctp_eid_t /*eid*/,
+                                                            const pldm_msg*
+                                                                response,
+                                                            size_t respMsgLen) {
                     if (response == nullptr || !respMsgLen)
                     {
                         error(
@@ -884,8 +886,8 @@
                                 "STATE", eventState);
                             return;
                         }
-                        const auto& [containerId, entityType,
-                                     entityInstance] = entityInfo;
+                        const auto& [containerId, entityType, entityInstance] =
+                            entityInfo;
                         auto stateSetId = stateSetIds[sensorOffset];
                         pldm::responder::events::StateSensorEntry
                             stateSensorEntry{containerId,    entityType,
@@ -932,9 +934,11 @@
         return;
     }
 
-    auto getFruRecordTableMetadataResponseHandler =
-        [this, fruRecordSetPDRs](mctp_eid_t /*eid*/, const pldm_msg* response,
-                                 size_t respMsgLen) {
+    auto getFruRecordTableMetadataResponseHandler = [this, fruRecordSetPDRs](
+                                                        mctp_eid_t /*eid*/,
+                                                        const pldm_msg*
+                                                            response,
+                                                        size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error(
@@ -992,8 +996,8 @@
     }
 
     auto instanceId = instanceIdDb.next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES);
 
     // send the getFruRecordTable command
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
@@ -1009,9 +1013,11 @@
         return;
     }
 
-    auto getFruRecordTableResponseHandler =
-        [totalTableRecords, this, fruRecordSetPDRs](
-            mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto getFruRecordTableResponseHandler = [totalTableRecords, this,
+                                             fruRecordSetPDRs](
+                                                mctp_eid_t /*eid*/,
+                                                const pldm_msg* response,
+                                                size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error("Failed to receive response for the get fru record table");
@@ -1022,8 +1028,8 @@
         uint32_t next_data_transfer_handle = 0;
         uint8_t transfer_flag = 0;
         size_t fru_record_table_length = 0;
-        std::vector<uint8_t> fru_record_table_data(respMsgLen -
-                                                   sizeof(pldm_msg_hdr));
+        std::vector<uint8_t> fru_record_table_data(
+            respMsgLen - sizeof(pldm_msg_hdr));
         auto responsePtr = reinterpret_cast<const struct pldm_msg*>(response);
         auto rc = decode_get_fru_record_table_resp(
             responsePtr, respMsgLen, &cc, &next_data_transfer_handle,
diff --git a/host-bmc/host_pdr_handler.hpp b/host-bmc/host_pdr_handler.hpp
index c75c172..6f3d008 100644
--- a/host-bmc/host_pdr_handler.hpp
+++ b/host-bmc/host_pdr_handler.hpp
@@ -206,10 +206,9 @@
      *  @param[in] size - size of input PDR record in bytes
      *  @param[in] record_handle - record handle of the PDR
      */
-    void
-        mergeEntityAssociations(const std::vector<uint8_t>& pdr,
-                                [[maybe_unused]] const uint32_t& size,
-                                [[maybe_unused]] const uint32_t& record_handle);
+    void mergeEntityAssociations(
+        const std::vector<uint8_t>& pdr, [[maybe_unused]] const uint32_t& size,
+        [[maybe_unused]] const uint32_t& record_handle);
 
     /** @brief process the Host's PDR and add to BMC's PDR repo
      *  @param[in] eid - MCTP id of Host
diff --git a/host-bmc/utils.cpp b/host-bmc/utils.cpp
index 648776d..41a5ec3 100644
--- a/host-bmc/utils.cpp
+++ b/host-bmc/utils.cpp
@@ -93,9 +93,10 @@
                 continue;
             }
 
-            fs::path p = path / fs::path{entityName +
-                                         std::to_string(
-                                             node_entity.entity_instance_num)};
+            fs::path p =
+                path /
+                fs::path{entityName +
+                         std::to_string(node_entity.entity_instance_num)};
             std::string entity_path = p.string();
             if (oemPlatformHandler)
             {
@@ -234,13 +235,13 @@
     char* err;
     try
     {
-        std::ranges::transform(entities.items(),
-                               std::inserter(entityMaps, entityMaps.begin()),
-                               [&err](const auto& element) {
-            std::string key = static_cast<EntityName>(element.key());
-            return std::make_pair(strtol(key.c_str(), &err, 10),
-                                  static_cast<EntityName>(element.value()));
-        });
+        std::ranges::transform(
+            entities.items(), std::inserter(entityMaps, entityMaps.begin()),
+            [&err](const auto& element) {
+                std::string key = static_cast<EntityName>(element.key());
+                return std::make_pair(strtol(key.c_str(), &err, 10),
+                                      static_cast<EntityName>(element.value()));
+            });
     }
     catch (const std::exception& e)
     {
diff --git a/libpldmresponder/base.hpp b/libpldmresponder/base.hpp
index ad41299..b0829c4 100644
--- a/libpldmresponder/base.hpp
+++ b/libpldmresponder/base.hpp
@@ -25,23 +25,23 @@
         handlers.emplace(
             PLDM_GET_PLDM_TYPES,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getPLDMTypes(request, payloadLength);
-        });
+                return this->getPLDMTypes(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_PLDM_COMMANDS,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getPLDMCommands(request, payloadLength);
-        });
+                return this->getPLDMCommands(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_PLDM_VERSION,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getPLDMVersion(request, payloadLength);
-        });
+                return this->getPLDMVersion(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_TID,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getTID(request, payloadLength);
-        });
+                return this->getTID(request, payloadLength);
+            });
     }
 
     /** @brief Handler for getPLDMTypes
diff --git a/libpldmresponder/bios.cpp b/libpldmresponder/bios.cpp
index d97229d..1f3d536 100644
--- a/libpldmresponder/bios.cpp
+++ b/libpldmresponder/bios.cpp
@@ -35,11 +35,11 @@
     minutes = pldm::utils::decimalToBcd(time->tm_min);
     hours = pldm::utils::decimalToBcd(time->tm_hour);
     day = pldm::utils::decimalToBcd(time->tm_mday);
-    month = pldm::utils::decimalToBcd(time->tm_mon +
-                                      1); // The number of months in the range
-                                          // 0 to 11.PLDM expects range 1 to 12
-    year = pldm::utils::decimalToBcd(time->tm_year +
-                                     1900); // The number of years since 1900
+    month = pldm::utils::decimalToBcd(
+        time->tm_mon + 1);     // The number of months in the range
+                               // 0 to 11.PLDM expects range 1 to 12
+    year = pldm::utils::decimalToBcd(
+        time->tm_year + 1900); // The number of years since 1900
 }
 
 std::time_t timeToEpoch(uint8_t seconds, uint8_t minutes, uint8_t hours,
@@ -80,34 +80,34 @@
     handlers.emplace(
         PLDM_SET_DATE_TIME,
         [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-        return this->setDateTime(request, payloadLength);
-    });
+            return this->setDateTime(request, payloadLength);
+        });
     handlers.emplace(
         PLDM_GET_DATE_TIME,
         [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-        return this->getDateTime(request, payloadLength);
-    });
+            return this->getDateTime(request, payloadLength);
+        });
     handlers.emplace(
         PLDM_GET_BIOS_TABLE,
         [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-        return this->getBIOSTable(request, payloadLength);
-    });
+            return this->getBIOSTable(request, payloadLength);
+        });
     handlers.emplace(
         PLDM_SET_BIOS_TABLE,
         [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-        return this->setBIOSTable(request, payloadLength);
-    });
+            return this->setBIOSTable(request, payloadLength);
+        });
     handlers.emplace(
         PLDM_GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE,
         [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-        return this->getBIOSAttributeCurrentValueByHandle(request,
-                                                          payloadLength);
-    });
+            return this->getBIOSAttributeCurrentValueByHandle(request,
+                                                              payloadLength);
+        });
     handlers.emplace(
         PLDM_SET_BIOS_ATTRIBUTE_CURRENT_VALUE,
         [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-        return this->setBIOSAttributeCurrentValue(request, payloadLength);
-    });
+            return this->setBIOSAttributeCurrentValue(request, payloadLength);
+        });
 }
 
 Response Handler::getDateTime(const pldm_msg* request, size_t /*payloadLength*/)
diff --git a/libpldmresponder/bios_attribute.cpp b/libpldmresponder/bios_attribute.cpp
index 7ae6af7..d169b14 100644
--- a/libpldmresponder/bios_attribute.cpp
+++ b/libpldmresponder/bios_attribute.cpp
@@ -16,9 +16,9 @@
 
 BIOSAttribute::BIOSAttribute(const Json& entry,
                              DBusHandler* const dbusHandler) :
-    name(entry.at("attribute_name")),
-    readOnly(false), displayName(entry.at("display_name")),
-    helpText(entry.at("help_text")), dbusHandler(dbusHandler)
+    name(entry.at("attribute_name")), readOnly(false),
+    displayName(entry.at("display_name")), helpText(entry.at("help_text")),
+    dbusHandler(dbusHandler)
 {
     try
     {
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index 712555d..f58e7de 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -45,8 +45,7 @@
     pldm::requester::Handler<pldm::requester::Request>* handler,
     pldm::responder::platform_config::Handler* platformConfigHandler,
     pldm::responder::bios::Callback requestPLDMServiceName) :
-    jsonDir(jsonDir),
-    tableDir(tableDir), dbusHandler(dbusHandler), eid(eid),
+    jsonDir(jsonDir), tableDir(tableDir), dbusHandler(dbusHandler), eid(eid),
     instanceIdDb(instanceIdDb), handler(handler),
     platformConfigHandler(platformConfigHandler),
     requestPLDMServiceName(requestPLDMServiceName)
@@ -350,8 +349,8 @@
                     valueDisplayNames.insert(valueDisplayNames.end(),
                                              vdn.begin(), vdn.end());
                 }
-                auto getValue = [](uint16_t handle,
-                                   const Table& table) -> std::string {
+                auto getValue =
+                    [](uint16_t handle, const Table& table) -> std::string {
                     auto stringEntry = pldm_bios_table_string_find_by_handle(
                         table.data(), table.size(), handle);
 
@@ -414,8 +413,8 @@
                 // get default_value
                 for (size_t i = 0; i < defIndices.size(); i++)
                 {
-                    defaultValue = getValue(pvHandls[defIndices[i]],
-                                            *stringTable);
+                    defaultValue =
+                        getValue(pvHandls[defIndices[i]], *stringTable);
                 }
 
                 break;
@@ -518,8 +517,8 @@
     try
     {
         auto& bus = dbusHandler->getBus();
-        auto service = dbusHandler->getService(biosConfigPath,
-                                               biosConfigInterface);
+        auto service =
+            dbusHandler->getService(biosConfigPath, biosConfigInterface);
         auto method = bus.new_method_call(service.c_str(), biosConfigPath,
                                           dbusProperties, "Set");
         std::variant<BaseBIOSTable> value = baseBIOSTableMaps;
@@ -571,9 +570,9 @@
     {
         auto& bus = dbusHandler->getBus();
         auto service = dbusHandler->getService(biosObjPath, biosInterface);
-        auto method = bus.new_method_call(service.c_str(), biosObjPath,
-                                          "org.freedesktop.DBus.Properties",
-                                          "Get");
+        auto method =
+            bus.new_method_call(service.c_str(), biosObjPath,
+                                "org.freedesktop.DBus.Properties", "Get");
         method.append(biosInterface, "BaseBIOSTable");
         auto reply = bus.call(method, dbusTimeout);
         std::variant<BaseBIOSTable> varBiosTable{};
@@ -722,10 +721,9 @@
     return std::string(buffer.data(), buffer.data() + strLength);
 }
 
-std::string
-    BIOSConfig::displayStringHandle(uint16_t handle, uint8_t index,
-                                    const std::optional<Table>& attrTable,
-                                    const std::optional<Table>& stringTable)
+std::string BIOSConfig::displayStringHandle(
+    uint16_t handle, uint8_t index, const std::optional<Table>& attrTable,
+    const std::optional<Table>& stringTable)
 {
     auto attrEntry = pldm_bios_table_attr_find_by_handle(
         attrTable->data(), attrTable->size(), handle);
@@ -905,8 +903,8 @@
 
     auto attrValHeader = table::attribute_value::decodeHeader(attrValueEntry);
 
-    auto attrEntry = table::attribute::findByHandle(*attrTable,
-                                                    attrValHeader.attrHandle);
+    auto attrEntry =
+        table::attribute::findByHandle(*attrTable, attrValHeader.attrHandle);
     if (!attrEntry)
     {
         return PLDM_ERROR;
@@ -918,8 +916,8 @@
         return rc;
     }
 
-    auto destTable = table::attribute_value::updateTable(*attrValueTable, entry,
-                                                         size);
+    auto destTable =
+        table::attribute_value::updateTable(*attrValueTable, entry, size);
 
     if (!destTable)
     {
@@ -1095,8 +1093,8 @@
 
         auto iter = std::find_if(biosAttributes.begin(), biosAttributes.end(),
                                  [&attributeName](const auto& attr) {
-            return attr->name == attributeName;
-        });
+                                     return attr->name == attributeName;
+                                 });
 
         if (iter == biosAttributes.end())
         {
@@ -1161,26 +1159,26 @@
         pldm::utils::DBusHandler::getBus(),
         propertiesChanged(objPath, objInterface),
         [this](sdbusplus::message_t& msg) {
-        constexpr auto propertyName = "PendingAttributes";
+            constexpr auto propertyName = "PendingAttributes";
 
-        using Value =
-            std::variant<std::string, PendingAttributes, BaseBIOSTable>;
-        using Properties = std::map<DbusProp, Value>;
+            using Value =
+                std::variant<std::string, PendingAttributes, BaseBIOSTable>;
+            using Properties = std::map<DbusProp, Value>;
 
-        Properties props{};
-        std::string intf;
-        msg.read(intf, props);
+            Properties props{};
+            std::string intf;
+            msg.read(intf, props);
 
-        auto valPropMap = props.find(propertyName);
-        if (valPropMap == props.end())
-        {
-            return;
-        }
+            auto valPropMap = props.find(propertyName);
+            if (valPropMap == props.end())
+            {
+                return;
+            }
 
-        PendingAttributes pendingAttributes =
-            std::get<PendingAttributes>(valPropMap->second);
-        this->constructPendingAttribute(pendingAttributes);
-    });
+            PendingAttributes pendingAttributes =
+                std::get<PendingAttributes>(valPropMap->second);
+            this->constructPendingAttribute(pendingAttributes);
+        });
 
     biosAttrMatch.emplace_back(std::move(updateBIOSMatch));
 }
diff --git a/libpldmresponder/bios_config.hpp b/libpldmresponder/bios_config.hpp
index 5812e3b..05f960d 100644
--- a/libpldmresponder/bios_config.hpp
+++ b/libpldmresponder/bios_config.hpp
@@ -232,11 +232,12 @@
                         propertiesChanged(dBusMap->objectPath,
                                           dBusMap->interface),
                         [this, biosAttrIndex](sdbusplus::message_t& msg) {
-                    DbusChObjProperties props;
-                    std::string iface;
-                    msg.read(iface, props);
-                    processBiosAttrChangeNotification(props, biosAttrIndex);
-                }));
+                            DbusChObjProperties props;
+                            std::string iface;
+                            msg.read(iface, props);
+                            processBiosAttrChangeNotification(props,
+                                                              biosAttrIndex);
+                        }));
 
                 biosAttrMatch.push_back(
                     std::make_unique<sdbusplus::bus::match_t>(
@@ -244,17 +245,17 @@
                         interfacesAdded() + argNpath(0, dBusMap->objectPath),
                         [this, biosAttrIndex, interface = dBusMap->interface](
                             sdbusplus::message_t& msg) {
-                    sdbusplus::message::object_path path;
-                    DbusIfacesAdded interfaces;
+                            sdbusplus::message::object_path path;
+                            DbusIfacesAdded interfaces;
 
-                    msg.read(path, interfaces);
-                    auto ifaceIt = interfaces.find(interface);
-                    if (ifaceIt != interfaces.end())
-                    {
-                        processBiosAttrChangeNotification(ifaceIt->second,
-                                                          biosAttrIndex);
-                    }
-                }));
+                            msg.read(path, interfaces);
+                            auto ifaceIt = interfaces.find(interface);
+                            if (ifaceIt != interfaces.end())
+                            {
+                                processBiosAttrChangeNotification(
+                                    ifaceIt->second, biosAttrIndex);
+                            }
+                        }));
             }
         }
         catch (const std::exception& e)
diff --git a/libpldmresponder/bios_enum_attribute.cpp b/libpldmresponder/bios_enum_attribute.cpp
index 5d436c1..2434c79 100644
--- a/libpldmresponder/bios_enum_attribute.cpp
+++ b/libpldmresponder/bios_enum_attribute.cpp
@@ -49,8 +49,9 @@
 uint8_t BIOSEnumAttribute::getValueIndex(const std::string& value,
                                          const std::vector<std::string>& pVs)
 {
-    auto iter = std::find_if(pVs.begin(), pVs.end(),
-                             [&value](const auto& v) { return v == value; });
+    auto iter = std::find_if(pVs.begin(), pVs.end(), [&value](const auto& v) {
+        return v == value;
+    });
     if (iter == pVs.end())
     {
         throw std::invalid_argument("value must be one of possible value");
@@ -183,8 +184,8 @@
 
     auto it = std::find_if(valMap.begin(), valMap.end(),
                            [&valueString](const auto& typePair) {
-        return typePair.second == valueString;
-    });
+                               return typePair.second == valueString;
+                           });
     if (it == valMap.end())
     {
         return;
@@ -205,8 +206,8 @@
     const BIOSStringTable& stringTable, Table& attrTable, Table& attrValueTable,
     std::optional<std::variant<int64_t, std::string>> optAttributeValue)
 {
-    auto possibleValuesHandle = getPossibleValuesHandle(stringTable,
-                                                        possibleValues);
+    auto possibleValuesHandle =
+        getPossibleValuesHandle(stringTable, possibleValues);
     std::vector<uint8_t> defaultIndices(1, 0);
     defaultIndices[0] = getValueIndex(defaultValue, possibleValues);
 
@@ -215,8 +216,8 @@
         (uint8_t)possibleValuesHandle.size(), possibleValuesHandle.data(),
         (uint8_t)defaultIndices.size(),       defaultIndices.data()};
 
-    auto attrTableEntry = table::attribute::constructEnumEntry(attrTable,
-                                                               &info);
+    auto attrTableEntry =
+        table::attribute::constructEnumEntry(attrTable, &info);
     auto [attrHandle, attrType,
           _] = table::attribute::decodeHeader(attrTableEntry);
 
diff --git a/libpldmresponder/bios_integer_attribute.cpp b/libpldmresponder/bios_integer_attribute.cpp
index 058df1b..fd578a6 100644
--- a/libpldmresponder/bios_integer_attribute.cpp
+++ b/libpldmresponder/bios_integer_attribute.cpp
@@ -112,8 +112,8 @@
         integerInfo.scalarIncrement,  integerInfo.defaultValue,
     };
 
-    auto attrTableEntry = table::attribute::constructIntegerEntry(attrTable,
-                                                                  &info);
+    auto attrTableEntry =
+        table::attribute::constructIntegerEntry(attrTable, &info);
 
     auto [attrHandle, attrType,
           _] = table::attribute::decodeHeader(attrTableEntry);
@@ -223,8 +223,8 @@
     const std::variant<int64_t, std::string>& attributevalue,
     Table& attrValueEntry)
 {
-    attrValueEntry.resize(sizeof(pldm_bios_attr_val_table_entry) +
-                          sizeof(int64_t) - 1);
+    attrValueEntry.resize(
+        sizeof(pldm_bios_attr_val_table_entry) + sizeof(int64_t) - 1);
 
     auto entry = reinterpret_cast<pldm_bios_attr_val_table_entry*>(
         attrValueEntry.data());
diff --git a/libpldmresponder/bios_string_attribute.cpp b/libpldmresponder/bios_string_attribute.cpp
index d55c99a..4b4bf3d 100644
--- a/libpldmresponder/bios_string_attribute.cpp
+++ b/libpldmresponder/bios_string_attribute.cpp
@@ -108,8 +108,8 @@
         stringInfo.defString.data(),
     };
 
-    auto attrTableEntry = table::attribute::constructStringEntry(attrTable,
-                                                                 &info);
+    auto attrTableEntry =
+        table::attribute::constructStringEntry(attrTable, &info);
     auto [attrHandle, attrType,
           _] = table::attribute::decodeHeader(attrTableEntry);
 
@@ -160,8 +160,8 @@
     std::string value = std::get<std::string>(attributevalue);
     uint16_t len = value.size();
 
-    attrValueEntry.resize(sizeof(pldm_bios_attr_val_table_entry) +
-                          sizeof(uint16_t) + len - 1);
+    attrValueEntry.resize(
+        sizeof(pldm_bios_attr_val_table_entry) + sizeof(uint16_t) + len - 1);
 
     auto entry = reinterpret_cast<pldm_bios_attr_val_table_entry*>(
         attrValueEntry.data());
diff --git a/libpldmresponder/bios_table.cpp b/libpldmresponder/bios_table.cpp
index d7e3e39..17bb79b 100644
--- a/libpldmresponder/bios_table.cpp
+++ b/libpldmresponder/bios_table.cpp
@@ -106,8 +106,8 @@
                                                buffer.size());
     return std::string(buffer.data(), buffer.data() + strLength);
 }
-const pldm_bios_string_table_entry* constructEntry(Table& table,
-                                                   const std::string& str)
+const pldm_bios_string_table_entry*
+    constructEntry(Table& table, const std::string& str)
 {
     auto tableSize = table.size();
     auto entryLength = pldm_bios_table_string_entry_encode_length(str.length());
@@ -115,8 +115,8 @@
     // Preconditions are upheld therefore no error check necessary
     pldm_bios_table_string_entry_encode(table.data() + tableSize, entryLength,
                                         str.c_str(), str.length());
-    return reinterpret_cast<pldm_bios_string_table_entry*>(table.data() +
-                                                           tableSize);
+    return reinterpret_cast<pldm_bios_string_table_entry*>(
+        table.data() + tableSize);
 }
 
 } // namespace string
@@ -131,23 +131,22 @@
     return {attrHandle, attrType, stringHandle};
 }
 
-const pldm_bios_attr_table_entry* findByHandle(const Table& table,
-                                               uint16_t handle)
+const pldm_bios_attr_table_entry*
+    findByHandle(const Table& table, uint16_t handle)
 {
     return pldm_bios_table_attr_find_by_handle(table.data(), table.size(),
                                                handle);
 }
 
-const pldm_bios_attr_table_entry* findByStringHandle(const Table& table,
-                                                     uint16_t handle)
+const pldm_bios_attr_table_entry*
+    findByStringHandle(const Table& table, uint16_t handle)
 {
     return pldm_bios_table_attr_find_by_string_handle(table.data(),
                                                       table.size(), handle);
 }
 
-const pldm_bios_attr_table_entry*
-    constructStringEntry(Table& table,
-                         pldm_bios_table_attr_entry_string_info* info)
+const pldm_bios_attr_table_entry* constructStringEntry(
+    Table& table, pldm_bios_table_attr_entry_string_info* info)
 {
     auto entryLength =
         pldm_bios_table_attr_entry_string_encode_length(info->def_length);
@@ -162,13 +161,12 @@
               "RC", rc);
         throw std::runtime_error("Failed to encode BIOS table string entry");
     }
-    return reinterpret_cast<pldm_bios_attr_table_entry*>(table.data() +
-                                                         tableSize);
+    return reinterpret_cast<pldm_bios_attr_table_entry*>(
+        table.data() + tableSize);
 }
 
-const pldm_bios_attr_table_entry*
-    constructIntegerEntry(Table& table,
-                          pldm_bios_table_attr_entry_integer_info* info)
+const pldm_bios_attr_table_entry* constructIntegerEntry(
+    Table& table, pldm_bios_table_attr_entry_integer_info* info)
 {
     auto entryLength = pldm_bios_table_attr_entry_integer_encode_length();
     auto tableSize = table.size();
@@ -183,8 +181,8 @@
         throw std::runtime_error(
             "Failed to encode BIOS attribute table integer entry");
     }
-    return reinterpret_cast<pldm_bios_attr_table_entry*>(table.data() +
-                                                         tableSize);
+    return reinterpret_cast<pldm_bios_attr_table_entry*>(
+        table.data() + tableSize);
 }
 
 StringField decodeStringEntry(const pldm_bios_attr_table_entry* entry)
@@ -233,8 +231,8 @@
     pldm_bios_table_attr_entry_enum_encode(table.data() + tableSize,
                                            entryLength, info);
 
-    return reinterpret_cast<pldm_bios_attr_table_entry*>(table.data() +
-                                                         tableSize);
+    return reinterpret_cast<pldm_bios_attr_table_entry*>(
+        table.data() + tableSize);
 }
 
 EnumField decodeEnumEntry(const pldm_bios_attr_table_entry* entry)
@@ -276,8 +274,8 @@
 std::string decodeStringEntry(const pldm_bios_attr_val_table_entry* entry)
 {
     variable_field currentString{};
-    pldm_bios_table_attr_value_entry_string_decode_string(entry,
-                                                          &currentString);
+    pldm_bios_table_attr_value_entry_string_decode_string(
+        entry, &currentString);
     return std::string(currentString.ptr,
                        currentString.ptr + currentString.length);
 }
@@ -297,9 +295,8 @@
     return currHdls;
 }
 
-const pldm_bios_attr_val_table_entry*
-    constructStringEntry(Table& table, uint16_t attrHandle, uint8_t attrType,
-                         const std::string& str)
+const pldm_bios_attr_val_table_entry* constructStringEntry(
+    Table& table, uint16_t attrHandle, uint8_t attrType, const std::string& str)
 {
     auto strLen = str.size();
     auto entryLength =
@@ -317,14 +314,12 @@
         throw std::runtime_error(
             "Failed to encode BIOS attribute table string entry");
     }
-    return reinterpret_cast<pldm_bios_attr_val_table_entry*>(table.data() +
-                                                             tableSize);
+    return reinterpret_cast<pldm_bios_attr_val_table_entry*>(
+        table.data() + tableSize);
 }
 
-const pldm_bios_attr_val_table_entry* constructIntegerEntry(Table& table,
-                                                            uint16_t attrHandle,
-                                                            uint8_t attrType,
-                                                            uint64_t value)
+const pldm_bios_attr_val_table_entry* constructIntegerEntry(
+    Table& table, uint16_t attrHandle, uint8_t attrType, uint64_t value)
 {
     auto entryLength = pldm_bios_table_attr_value_entry_encode_integer_length();
 
@@ -340,8 +335,8 @@
         throw std::runtime_error(
             "Failed to encode BIOS attribute table integery entry");
     }
-    return reinterpret_cast<pldm_bios_attr_val_table_entry*>(table.data() +
-                                                             tableSize);
+    return reinterpret_cast<pldm_bios_attr_val_table_entry*>(
+        table.data() + tableSize);
 }
 
 const pldm_bios_attr_val_table_entry*
@@ -363,8 +358,8 @@
         throw std::runtime_error(
             "Failed to encode BIOS attribute table enum entry");
     }
-    return reinterpret_cast<pldm_bios_attr_val_table_entry*>(table.data() +
-                                                             tableSize);
+    return reinterpret_cast<pldm_bios_attr_val_table_entry*>(
+        table.data() + tableSize);
 }
 
 std::optional<Table> updateTable(const Table& table, const void* entry,
diff --git a/libpldmresponder/bios_table.hpp b/libpldmresponder/bios_table.hpp
index 5959c7c..8b5f8bc 100644
--- a/libpldmresponder/bios_table.hpp
+++ b/libpldmresponder/bios_table.hpp
@@ -164,8 +164,8 @@
  *  @param[in] str - string itself
  *  @return pointer to the constructed entry
  */
-const pldm_bios_string_table_entry* constructEntry(Table& table,
-                                                   const std::string& str);
+const pldm_bios_string_table_entry*
+    constructEntry(Table& table, const std::string& str);
 
 } // namespace string
 
@@ -193,16 +193,16 @@
  *  @param[in] handle - attribute handle
  *  @return Pointer to the attribute table entry
  */
-const pldm_bios_attr_table_entry* findByHandle(const Table& table,
-                                               uint16_t handle);
+const pldm_bios_attr_table_entry*
+    findByHandle(const Table& table, uint16_t handle);
 
 /** @brief Find attribute entry by string handle
  *  @param[in] table - attribute table
  *  @param[in] handle - string handle
  *  @return Pointer to the attribute table entry
  */
-const pldm_bios_attr_table_entry* findByStringHandle(const Table& table,
-                                                     uint16_t handle);
+const pldm_bios_attr_table_entry*
+    findByStringHandle(const Table& table, uint16_t handle);
 
 /** @struct StringField
  *  @brief String field of attribute table
@@ -228,9 +228,8 @@
  *  @param[in] info - string info
  *  @return pointer to the constructed entry
  */
-const pldm_bios_attr_table_entry*
-    constructStringEntry(Table& table,
-                         pldm_bios_table_attr_entry_string_info* info);
+const pldm_bios_attr_table_entry* constructStringEntry(
+    Table& table, pldm_bios_table_attr_entry_string_info* info);
 
 /** @struct IntegerField
  *  @brief Integer field of attribute table
@@ -249,9 +248,8 @@
  *  @param[in] info - integer info
  *  @return pointer to the constructed entry
  */
-const pldm_bios_attr_table_entry*
-    constructIntegerEntry(Table& table,
-                          pldm_bios_table_attr_entry_integer_info* info);
+const pldm_bios_attr_table_entry* constructIntegerEntry(
+    Table& table, pldm_bios_table_attr_entry_integer_info* info);
 
 /** @brief decode integer entry of attribute table
  *  @param[in] entry - Pointer to an attribute table entry
@@ -280,9 +278,8 @@
  *  @param[in] info - enum info
  *  @return pointer to the constructed entry
  */
-const pldm_bios_attr_table_entry*
-    constructEnumEntry(Table& table,
-                       pldm_bios_table_attr_entry_enum_info* info);
+const pldm_bios_attr_table_entry* constructEnumEntry(
+    Table& table, pldm_bios_table_attr_entry_enum_info* info);
 
 } // namespace attribute
 
@@ -343,10 +340,8 @@
  *  @param[in] value - The integer
  *  @return Pointer to the constructed entry
  */
-const pldm_bios_attr_val_table_entry* constructIntegerEntry(Table& table,
-                                                            uint16_t attrHandle,
-                                                            uint8_t attrType,
-                                                            uint64_t value);
+const pldm_bios_attr_val_table_entry* constructIntegerEntry(
+    Table& table, uint16_t attrHandle, uint8_t attrType, uint64_t value);
 
 /** @brief Construct enum entry of attribute value table at the end of
  *         the given table
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index a126a62..5a7368e 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -105,8 +105,8 @@
                     pldm_entity node = pldm_entity_extract(it.second);
                     if (node.entity_type == entity.entity_type)
                     {
-                        entity.entity_instance_num = node.entity_instance_num +
-                                                     1;
+                        entity.entity_instance_num =
+                            node.entity_instance_num + 1;
                         break;
                     }
                 }
@@ -230,9 +230,9 @@
     std::string currentBmcVersion;
     try
     {
-        auto method = bus.new_method_call(pldm::utils::mapperService,
-                                          fwFunctionalObjPath,
-                                          pldm::utils::dbusProperties, "Get");
+        auto method =
+            bus.new_method_call(pldm::utils::mapperService, fwFunctionalObjPath,
+                                pldm::utils::dbusProperties, "Get");
         method.append("xyz.openbmc_project.Association", "endpoints");
         std::variant<std::vector<std::string>> paths;
         auto reply = bus.call(method, dbusTimeout);
@@ -385,10 +385,9 @@
     }
 }
 
-int FruImpl::getFRURecordByOption(std::vector<uint8_t>& fruData,
-                                  uint16_t /* fruTableHandle */,
-                                  uint16_t recordSetIdentifer,
-                                  uint8_t recordType, uint8_t fieldType)
+int FruImpl::getFRURecordByOption(
+    std::vector<uint8_t>& fruData, uint16_t /* fruTableHandle */,
+    uint16_t recordSetIdentifer, uint8_t recordType, uint8_t fieldType)
 {
     using sum = uint32_t;
 
@@ -487,9 +486,9 @@
         sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_MIN_RESP_BYTES, 0);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
 
-    auto rc = encode_get_fru_record_table_resp(request->hdr.instance_id,
-                                               PLDM_SUCCESS, 0,
-                                               PLDM_START_AND_END, responsePtr);
+    auto rc =
+        encode_get_fru_record_table_resp(request->hdr.instance_id, PLDM_SUCCESS,
+                                         0, PLDM_START_AND_END, responsePtr);
     if (rc != PLDM_SUCCESS)
     {
         return ccOnlyResponse(request, rc);
@@ -534,8 +533,8 @@
         return ccOnlyResponse(request, rc);
     }
 
-    auto respPayloadLength = PLDM_GET_FRU_RECORD_BY_OPTION_MIN_RESP_BYTES +
-                             fruData.size();
+    auto respPayloadLength =
+        PLDM_GET_FRU_RECORD_BY_OPTION_MIN_RESP_BYTES + fruData.size();
     Response response(sizeof(pldm_msg_hdr) + respPayloadLength, 0);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
 
@@ -573,8 +572,8 @@
         return ccOnlyResponse(request, rc);
     }
 
-    Response response(sizeof(pldm_msg_hdr) +
-                      PLDM_SET_FRU_RECORD_TABLE_RESP_BYTES);
+    Response response(
+        sizeof(pldm_msg_hdr) + PLDM_SET_FRU_RECORD_TABLE_RESP_BYTES);
     struct pldm_msg* responsePtr = reinterpret_cast<pldm_msg*>(response.data());
 
     rc = encode_set_fru_record_table_resp(
diff --git a/libpldmresponder/fru.hpp b/libpldmresponder/fru.hpp
index a0757e6..af55f92 100644
--- a/libpldmresponder/fru.hpp
+++ b/libpldmresponder/fru.hpp
@@ -67,8 +67,8 @@
             const std::filesystem::path& fruMasterJsonPath, pldm_pdr* pdrRepo,
             pldm_entity_association_tree* entityTree,
             pldm_entity_association_tree* bmcEntityTree) :
-        parser(configPath, fruMasterJsonPath),
-        pdrRepo(pdrRepo), entityTree(entityTree), bmcEntityTree(bmcEntityTree)
+        parser(configPath, fruMasterJsonPath), pdrRepo(pdrRepo),
+        entityTree(entityTree), bmcEntityTree(bmcEntityTree)
     {}
 
     /** @brief Total length of the FRU table in bytes, this includes the pad
@@ -268,23 +268,23 @@
         handlers.emplace(
             PLDM_GET_FRU_RECORD_TABLE_METADATA,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getFRURecordTableMetadata(request, payloadLength);
-        });
+                return this->getFRURecordTableMetadata(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_FRU_RECORD_TABLE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getFRURecordTable(request, payloadLength);
-        });
+                return this->getFRURecordTable(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_FRU_RECORD_BY_OPTION,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getFRURecordByOption(request, payloadLength);
-        });
+                return this->getFRURecordByOption(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_SET_FRU_RECORD_TABLE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->setFRURecordTable(request, payloadLength);
-        });
+                return this->setFRURecordTable(request, payloadLength);
+            });
     }
 
     /** @brief Handler for Get FRURecordTableMetadata
diff --git a/libpldmresponder/fru_parser.cpp b/libpldmresponder/fru_parser.cpp
index c5ea3ea..bc04f56 100644
--- a/libpldmresponder/fru_parser.cpp
+++ b/libpldmresponder/fru_parser.cpp
@@ -147,8 +147,8 @@
             }
 
             FruRecordInfo fruInfo;
-            fruInfo = std::make_tuple(recordType, encType,
-                                      std::move(fieldInfo));
+            fruInfo =
+                std::make_tuple(recordType, encType, std::move(fieldInfo));
 
             auto search = recordMap.find(dbusIntfName);
 
diff --git a/libpldmresponder/pdr.cpp b/libpldmresponder/pdr.cpp
index aa05303..9a149f7 100644
--- a/libpldmresponder/pdr.cpp
+++ b/libpldmresponder/pdr.cpp
@@ -33,14 +33,13 @@
     }
 }
 
-const pldm_pdr_record* getRecordByHandle(const RepoInterface& pdrRepo,
-                                         RecordHandle recordHandle,
-                                         PdrEntry& pdrEntry)
+const pldm_pdr_record* getRecordByHandle(
+    const RepoInterface& pdrRepo, RecordHandle recordHandle, PdrEntry& pdrEntry)
 {
     uint8_t* pdrData = nullptr;
-    auto record = pldm_pdr_find_record(pdrRepo.getPdr(), recordHandle, &pdrData,
-                                       &pdrEntry.size,
-                                       &pdrEntry.handle.nextRecordHandle);
+    auto record =
+        pldm_pdr_find_record(pdrRepo.getPdr(), recordHandle, &pdrData,
+                             &pdrEntry.size, &pdrEntry.handle.nextRecordHandle);
     if (record)
     {
         pdrEntry.data = pdrData;
diff --git a/libpldmresponder/pdr_numeric_effecter.hpp b/libpldmresponder/pdr_numeric_effecter.hpp
index a425da3..362b10d 100644
--- a/libpldmresponder/pdr_numeric_effecter.hpp
+++ b/libpldmresponder/pdr_numeric_effecter.hpp
@@ -48,8 +48,8 @@
         pdr->hdr.version = 1;
         pdr->hdr.type = PLDM_NUMERIC_EFFECTER_PDR;
         pdr->hdr.record_change_num = 0;
-        pdr->hdr.length = sizeof(pldm_numeric_effecter_value_pdr) -
-                          sizeof(pldm_pdr_hdr);
+        pdr->hdr.length =
+            sizeof(pldm_numeric_effecter_value_pdr) - sizeof(pldm_pdr_hdr);
 
         pdr->terminus_handle = e.value("terminus_handle", 0);
 
@@ -99,15 +99,15 @@
         pdr->aux_oem_unit_handle = e.value("aux_oem_unit_handle", 0);
         pdr->aux_rate_unit = e.value("aux_rate_unit", 0);
         pdr->is_linear = e.value("is_linear", true);
-        pdr->effecter_data_size = e.value("effecter_data_size",
-                                          PLDM_EFFECTER_DATA_SIZE_UINT8);
+        pdr->effecter_data_size =
+            e.value("effecter_data_size", PLDM_EFFECTER_DATA_SIZE_UINT8);
         pdr->resolution = e.value("effecter_resolution_init", 1.00);
         pdr->offset = e.value("offset", 0.00);
         pdr->accuracy = e.value("accuracy", 0);
         pdr->plus_tolerance = e.value("plus_tolerance", 0);
         pdr->minus_tolerance = e.value("minus_tolerance", 0);
-        pdr->state_transition_interval = e.value("state_transition_interval",
-                                                 0.00);
+        pdr->state_transition_interval =
+            e.value("state_transition_interval", 0.00);
         pdr->transition_interval = e.value("transition_interval", 0.00);
         switch (pdr->effecter_data_size)
         {
@@ -139,8 +139,8 @@
                 break;
         }
 
-        pdr->range_field_format = e.value("range_field_format",
-                                          PLDM_RANGE_FIELD_FORMAT_UINT8);
+        pdr->range_field_format =
+            e.value("range_field_format", PLDM_RANGE_FIELD_FORMAT_UINT8);
         pdr->range_field_support.byte = e.value("range_field_support", 0);
         switch (pdr->range_field_format)
         {
@@ -208,8 +208,8 @@
         pldm::utils::DBusMapping dbusMapping{};
         try
         {
-            auto service = dBusIntf.getService(objectPath.c_str(),
-                                               interface.c_str());
+            auto service =
+                dBusIntf.getService(objectPath.c_str(), interface.c_str());
 
             dbusMapping = pldm::utils::DBusMapping{objectPath, interface,
                                                    propertyName, propertyType};
diff --git a/libpldmresponder/pdr_state_effecter.hpp b/libpldmresponder/pdr_state_effecter.hpp
index 42af4ad..d431b0b 100644
--- a/libpldmresponder/pdr_state_effecter.hpp
+++ b/libpldmresponder/pdr_state_effecter.hpp
@@ -111,8 +111,8 @@
 
         pldm::responder::pdr_utils::DbusMappings dbusMappings{};
         pldm::responder::pdr_utils::DbusValMaps dbusValMaps{};
-        uint8_t* start = entry.data() + sizeof(pldm_state_effecter_pdr) -
-                         sizeof(uint8_t);
+        uint8_t* start =
+            entry.data() + sizeof(pldm_state_effecter_pdr) - sizeof(uint8_t);
         for (const auto& effecter : effecters)
         {
             auto set = effecter.value("set", empty);
@@ -146,8 +146,8 @@
             pldm::utils::DBusMapping dbusMapping{};
             try
             {
-                auto service = dBusIntf.getService(objectPath.c_str(),
-                                                   interface.c_str());
+                auto service =
+                    dBusIntf.getService(objectPath.c_str(), interface.c_str());
 
                 dbusMapping = pldm::utils::DBusMapping{
                     objectPath, interface, propertyName, propertyType};
diff --git a/libpldmresponder/pdr_state_sensor.hpp b/libpldmresponder/pdr_state_sensor.hpp
index 58236da..03bac20 100644
--- a/libpldmresponder/pdr_state_sensor.hpp
+++ b/libpldmresponder/pdr_state_sensor.hpp
@@ -122,8 +122,8 @@
 
         pldm::responder::pdr_utils::DbusMappings dbusMappings{};
         pldm::responder::pdr_utils::DbusValMaps dbusValMaps{};
-        uint8_t* start = entry.data() + sizeof(pldm_state_sensor_pdr) -
-                         sizeof(uint8_t);
+        uint8_t* start =
+            entry.data() + sizeof(pldm_state_sensor_pdr) - sizeof(uint8_t);
         for (const auto& sensor : sensors)
         {
             auto set = sensor.value("set", empty);
@@ -157,8 +157,8 @@
             pldm::utils::DBusMapping dbusMapping{};
             try
             {
-                auto service = dBusIntf.getService(objectPath.c_str(),
-                                                   interface.c_str());
+                auto service =
+                    dBusIntf.getService(objectPath.c_str(), interface.c_str());
 
                 dbusMapping = pldm::utils::DBusMapping{
                     objectPath, interface, propertyName, propertyType};
diff --git a/libpldmresponder/pdr_utils.cpp b/libpldmresponder/pdr_utils.cpp
index c15e282..7d87c67 100644
--- a/libpldmresponder/pdr_utils.cpp
+++ b/libpldmresponder/pdr_utils.cpp
@@ -48,9 +48,9 @@
 {
     constexpr uint32_t firstNum = 0;
     uint8_t* pdrData = nullptr;
-    auto record = pldm_pdr_find_record(getPdr(), firstNum, &pdrData,
-                                       &pdrEntry.size,
-                                       &pdrEntry.handle.nextRecordHandle);
+    auto record =
+        pldm_pdr_find_record(getPdr(), firstNum, &pdrData, &pdrEntry.size,
+                             &pdrEntry.handle.nextRecordHandle);
     if (record)
     {
         pdrEntry.data = pdrData;
@@ -63,9 +63,9 @@
                                            PdrEntry& pdrEntry)
 {
     uint8_t* pdrData = nullptr;
-    auto record = pldm_pdr_get_next_record(getPdr(), currRecord, &pdrData,
-                                           &pdrEntry.size,
-                                           &pdrEntry.handle.nextRecordHandle);
+    auto record =
+        pldm_pdr_get_next_record(getPdr(), currRecord, &pdrData, &pdrEntry.size,
+                                 &pdrEntry.handle.nextRecordHandle);
     if (record)
     {
         pdrEntry.data = pdrData;
@@ -209,8 +209,8 @@
                            std::move(sensorInfo));
 }
 
-std::vector<FruRecordDataFormat> parseFruRecordTable(const uint8_t* fruData,
-                                                     size_t fruLen)
+std::vector<FruRecordDataFormat>
+    parseFruRecordTable(const uint8_t* fruData, size_t fruLen)
 {
     // Refer: DSP0257_1.0.0 Table 2
     // 7: uint16_t(FRU Record Set Identifier), uint8_t(FRU Record Type),
@@ -239,23 +239,24 @@
 
         index += 5;
 
-        std::ranges::for_each(std::views::iota(0, (int)record->num_fru_fields),
-                              [fruData, &fru, &index](int) {
-            auto tlv =
-                reinterpret_cast<const pldm_fru_record_tlv*>(fruData + index);
-            FruTLV frutlv;
-            frutlv.fruFieldType = tlv->type;
-            frutlv.fruFieldLen = tlv->length;
-            frutlv.fruFieldValue.resize(tlv->length);
-            for (const auto& i : std::views::iota(0, (int)tlv->length))
-            {
-                memcpy(frutlv.fruFieldValue.data() + i, tlv->value + i, 1);
-            }
-            fru.fruTLV.push_back(frutlv);
+        std::ranges::for_each(
+            std::views::iota(0, (int)record->num_fru_fields),
+            [fruData, &fru, &index](int) {
+                auto tlv = reinterpret_cast<const pldm_fru_record_tlv*>(
+                    fruData + index);
+                FruTLV frutlv;
+                frutlv.fruFieldType = tlv->type;
+                frutlv.fruFieldLen = tlv->length;
+                frutlv.fruFieldValue.resize(tlv->length);
+                for (const auto& i : std::views::iota(0, (int)tlv->length))
+                {
+                    memcpy(frutlv.fruFieldValue.data() + i, tlv->value + i, 1);
+                }
+                fru.fruTLV.push_back(frutlv);
 
-            // 2: 1byte FRU Field Type, 1byte FRU Field Length
-            index += fruFieldTypeLength + (unsigned)tlv->length;
-        });
+                // 2: 1byte FRU Field Type, 1byte FRU Field Length
+                index += fruFieldTypeLength + (unsigned)tlv->length;
+            });
 
         frus.push_back(fru);
     }
diff --git a/libpldmresponder/pdr_utils.hpp b/libpldmresponder/pdr_utils.hpp
index 01fe223..a5374aa 100644
--- a/libpldmresponder/pdr_utils.hpp
+++ b/libpldmresponder/pdr_utils.hpp
@@ -161,9 +161,8 @@
      *  @return opaque pointer acting as PDR record handle, will be NULL if
      *          record was not found
      */
-    virtual const pldm_pdr_record*
-        getNextRecord(const pldm_pdr_record* currRecord,
-                      PdrEntry& pdrEntry) = 0;
+    virtual const pldm_pdr_record* getNextRecord(
+        const pldm_pdr_record* currRecord, PdrEntry& pdrEntry) = 0;
 
     /** @brief Get record handle of a PDR record
      *
@@ -239,8 +238,8 @@
  *  @return std::vector<FruRecordDataFormat> - the vector of the FRU record data
  *          format structure
  */
-std::vector<FruRecordDataFormat> parseFruRecordTable(const uint8_t* fruData,
-                                                     size_t fruLen);
+std::vector<FruRecordDataFormat>
+    parseFruRecordTable(const uint8_t* fruData, size_t fruLen);
 
 /** @brief Return the size of data type based on the effecterDataSize enum value
  *
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 1e0955a..522899c 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -87,22 +87,23 @@
         {PLDM_STATE_EFFECTER_PDR,
          [this](const DBusHandler& dBusIntf, const auto& json,
                 RepoInterface& repo) {
-        pdr_state_effecter::generateStateEffecterPDR<pldm::utils::DBusHandler,
-                                                     Handler>(dBusIntf, json,
-                                                              *this, repo);
-    }},
+             pdr_state_effecter::generateStateEffecterPDR<
+                 pldm::utils::DBusHandler, Handler>(dBusIntf, json, *this,
+                                                    repo);
+         }},
         {PLDM_NUMERIC_EFFECTER_PDR,
          [this](const DBusHandler& dBusIntf, const auto& json,
                 RepoInterface& repo) {
-        pdr_numeric_effecter::generateNumericEffecterPDR<
-            pldm::utils::DBusHandler, Handler>(dBusIntf, json, *this, repo);
-    }},
+             pdr_numeric_effecter::generateNumericEffecterPDR<
+                 pldm::utils::DBusHandler, Handler>(dBusIntf, json, *this,
+                                                    repo);
+         }},
         {PLDM_STATE_SENSOR_PDR, [this](const DBusHandler& dBusIntf,
                                        const auto& json, RepoInterface& repo) {
-        pdr_state_sensor::generateStateSensorPDR<pldm::utils::DBusHandler,
-                                                 Handler>(dBusIntf, json, *this,
-                                                          repo);
-    }}};
+             pdr_state_sensor::generateStateSensorPDR<pldm::utils::DBusHandler,
+                                                      Handler>(dBusIntf, json,
+                                                               *this, repo);
+         }}};
 
     Type pdrType{};
     for (const auto& directory : dir)
@@ -120,16 +121,16 @@
                         for (const auto& effecter : effecterPDRs)
                         {
                             pdrType = effecter.value("pdrType", 0);
-                            generateHandlers.at(pdrType)(dBusIntf, effecter,
-                                                         repo);
+                            generateHandlers.at(
+                                pdrType)(dBusIntf, effecter, repo);
                         }
 
                         auto sensorPDRs = json.value("sensorPDRs", empty);
                         for (const auto& sensor : sensorPDRs)
                         {
                             pdrType = sensor.value("pdrType", 0);
-                            generateHandlers.at(pdrType)(dBusIntf, sensor,
-                                                         repo);
+                            generateHandlers.at(
+                                pdrType)(dBusIntf, sensor, repo);
                         }
                     }
                 }
@@ -296,9 +297,9 @@
         return CmdHandler::ccOnlyResponse(request, PLDM_ERROR_INVALID_LENGTH);
     }
 
-    int rc = decode_set_state_effecter_states_req(request, payloadLength,
-                                                  &effecterId, &compEffecterCnt,
-                                                  stateField.data());
+    int rc = decode_set_state_effecter_states_req(
+        request, payloadLength, &effecterId, &compEffecterCnt,
+        stateField.data());
 
     if (rc != PLDM_SUCCESS)
     {
@@ -378,8 +379,8 @@
             const auto& handlers = eventHandlers.at(eventClass);
             for (const auto& handler : handlers)
             {
-                auto rc = handler(request, payloadLength, formatVersion, tid,
-                                  offset);
+                auto rc =
+                    handler(request, payloadLength, formatVersion, tid, offset);
                 if (rc != PLDM_SUCCESS)
                 {
                     return CmdHandler::ccOnlyResponse(request, rc);
@@ -414,8 +415,8 @@
     uint16_t sensorId{};
     uint8_t eventClass{};
     size_t eventClassDataOffset{};
-    auto eventData = reinterpret_cast<const uint8_t*>(request->payload) +
-                     eventDataOffset;
+    auto eventData =
+        reinterpret_cast<const uint8_t*>(request->payload) + eventDataOffset;
     auto eventDataSize = payloadLength - eventDataOffset;
 
     auto rc = decode_sensor_event_data(eventData, eventDataSize, &sensorId,
@@ -427,8 +428,8 @@
 
     auto eventClassData = reinterpret_cast<const uint8_t*>(request->payload) +
                           eventDataOffset + eventClassDataOffset;
-    auto eventClassDataSize = payloadLength - eventDataOffset -
-                              eventClassDataOffset;
+    auto eventClassDataSize =
+        payloadLength - eventDataOffset - eventClassDataOffset;
 
     if (eventClass == PLDM_STATE_SENSOR_STATE)
     {
@@ -496,12 +497,13 @@
         }
 
         const auto& [containerId, entityType, entityInstance] = entityInfo;
-        events::StateSensorEntry stateSensorEntry{containerId,
-                                                  entityType,
-                                                  entityInstance,
-                                                  sensorOffset,
-                                                  stateSetIds[sensorOffset],
-                                                  false};
+        events::StateSensorEntry stateSensorEntry{
+            containerId,
+            entityType,
+            entityInstance,
+            sensorOffset,
+            stateSetIds[sensorOffset],
+            false};
         return hostPDRHandler->handleStateSensorEvent(stateSensorEntry,
                                                       eventState);
     }
@@ -513,17 +515,16 @@
     return PLDM_SUCCESS;
 }
 
-int Handler::pldmPDRRepositoryChgEvent(const pldm_msg* request,
-                                       size_t payloadLength,
-                                       uint8_t /*formatVersion*/, uint8_t tid,
-                                       size_t eventDataOffset)
+int Handler::pldmPDRRepositoryChgEvent(
+    const pldm_msg* request, size_t payloadLength, uint8_t /*formatVersion*/,
+    uint8_t tid, size_t eventDataOffset)
 {
     uint8_t eventDataFormat{};
     uint8_t numberOfChangeRecords{};
     size_t dataOffset{};
 
-    auto eventData = reinterpret_cast<const uint8_t*>(request->payload) +
-                     eventDataOffset;
+    auto eventData =
+        reinterpret_cast<const uint8_t*>(request->payload) + eventDataOffset;
     auto eventDataSize = payloadLength - eventDataOffset;
 
     auto rc = decode_pldm_pdr_repository_chg_event_data(
@@ -569,8 +570,8 @@
                 }
 
                 rc = getPDRRecordHandles(
-                    reinterpret_cast<const ChangeEntry*>(changeRecordData +
-                                                         dataOffset),
+                    reinterpret_cast<const ChangeEntry*>(
+                        changeRecordData + dataOffset),
                     changeRecordDataSize - dataOffset,
                     static_cast<size_t>(numberOfChangeEntries),
                     pdrRecordHandles);
@@ -581,8 +582,8 @@
                 }
             }
 
-            changeRecordData += dataOffset +
-                                (numberOfChangeEntries * sizeof(ChangeEntry));
+            changeRecordData +=
+                dataOffset + (numberOfChangeEntries * sizeof(ChangeEntry));
             changeRecordDataSize -=
                 dataOffset + (numberOfChangeEntries * sizeof(ChangeEntry));
         }
@@ -618,10 +619,9 @@
     return PLDM_SUCCESS;
 }
 
-int Handler::getPDRRecordHandles(const ChangeEntry* changeEntryData,
-                                 size_t changeEntryDataSize,
-                                 size_t numberOfChangeEntries,
-                                 PDRRecordHandles& pdrRecordHandles)
+int Handler::getPDRRecordHandles(
+    const ChangeEntry* changeEntryData, size_t changeEntryDataSize,
+    size_t numberOfChangeEntries, PDRRecordHandles& pdrRecordHandles)
 {
     if (numberOfChangeEntries > (changeEntryDataSize / sizeof(ChangeEntry)))
     {
@@ -672,11 +672,11 @@
     // PresentValue (uint8|sint8|uint16|sint16|uint32|sint32 )
     // Size of PendingValue and PresentValue calculated based on size is
     // provided in effecter data size
-    size_t responsePayloadLength = sizeof(completionCode) +
-                                   sizeof(effecterDataSize) +
-                                   sizeof(effecterOperationalState) +
-                                   getEffecterDataSize(effecterDataSize) +
-                                   getEffecterDataSize(effecterDataSize);
+    size_t responsePayloadLength =
+        sizeof(completionCode) + sizeof(effecterDataSize) +
+        sizeof(effecterOperationalState) +
+        getEffecterDataSize(effecterDataSize) +
+        getEffecterDataSize(effecterDataSize);
 
     Response response(responsePayloadLength + sizeof(pldm_msg_hdr));
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
@@ -698,8 +698,8 @@
 Response Handler::setNumericEffecterValue(const pldm_msg* request,
                                           size_t payloadLength)
 {
-    Response response(sizeof(pldm_msg_hdr) +
-                      PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES);
+    Response response(
+        sizeof(pldm_msg_hdr) + PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES);
     uint16_t effecterId{};
     uint8_t effecterDataSize{};
     uint8_t effecterValue[4] = {};
@@ -718,9 +718,9 @@
     {
         const pldm::utils::DBusHandler dBusIntf;
         rc = platform_numeric_effecter::setNumericEffecterValueHandler<
-            pldm::utils::DBusHandler, Handler>(dBusIntf, *this, effecterId,
-                                               effecterDataSize, effecterValue,
-                                               sizeof(effecterValue));
+            pldm::utils::DBusHandler, Handler>(
+            dBusIntf, *this, effecterId, effecterDataSize, effecterValue,
+            sizeof(effecterValue));
     }
 
     return ccOnlyResponse(request, rc);
@@ -810,13 +810,13 @@
         return ccOnlyResponse(request, rc);
     }
 
-    Response response(sizeof(pldm_msg_hdr) +
-                      PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
-                      sizeof(get_sensor_state_field) * comSensorCnt);
+    Response response(
+        sizeof(pldm_msg_hdr) + PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
+        sizeof(get_sensor_state_field) * comSensorCnt);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
-    rc = encode_get_state_sensor_readings_resp(request->hdr.instance_id, rc,
-                                               comSensorCnt, stateField.data(),
-                                               responsePtr);
+    rc = encode_get_state_sensor_readings_resp(
+        request->hdr.instance_id, rc, comSensorCnt, stateField.data(),
+        responsePtr);
     if (rc != PLDM_SUCCESS)
     {
         return ccOnlyResponse(request, rc);
@@ -973,8 +973,8 @@
 
 void Handler::setEventReceiver()
 {
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_SET_EVENT_RECEIVER_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_SET_EVENT_RECEIVER_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto instanceId = instanceIdDb->next(eid);
     uint8_t eventMessageGlobalEnable =
@@ -995,8 +995,9 @@
         return;
     }
 
-    auto processSetEventReceiverResponse =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto processSetEventReceiverResponse = [](mctp_eid_t /*eid*/,
+                                              const pldm_msg* response,
+                                              size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error("Failed to receive response for setEventReceiver command");
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index e43058e..47c9ecf 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -28,9 +28,9 @@
 {
 namespace platform
 {
-using generatePDR = std::function<void(const pldm::utils::DBusHandler& dBusIntf,
-                                       const pldm::utils::Json& json,
-                                       pdr_utils::RepoInterface& repo)>;
+using generatePDR = std::function<void(
+    const pldm::utils::DBusHandler& dBusIntf, const pldm::utils::Json& json,
+    pdr_utils::RepoInterface& repo)>;
 
 using EffecterId = uint16_t;
 using DbusObjMaps =
@@ -58,8 +58,7 @@
             pldm::requester::Handler<pldm::requester::Request>* handler,
             sdeventplus::Event& event, bool buildPDRLazily = false,
             const std::optional<EventMap>& addOnHandlersMap = std::nullopt) :
-        eid(eid),
-        instanceIdDb(instanceIdDb), pdrRepo(repo),
+        eid(eid), instanceIdDb(instanceIdDb), pdrRepo(repo),
         hostPDRHandler(hostPDRHandler),
         dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
         dBusIntf(dBusIntf), platformConfigHandler(platformConfigHandler),
@@ -76,47 +75,48 @@
         handlers.emplace(
             PLDM_GET_PDR,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getPDR(request, payloadLength);
-        });
+                return this->getPDR(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_SET_NUMERIC_EFFECTER_VALUE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->setNumericEffecterValue(request, payloadLength);
-        });
+                return this->setNumericEffecterValue(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_NUMERIC_EFFECTER_VALUE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getNumericEffecterValue(request, payloadLength);
-        });
+                return this->getNumericEffecterValue(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_SET_STATE_EFFECTER_STATES,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->setStateEffecterStates(request, payloadLength);
-        });
+                return this->setStateEffecterStates(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_PLATFORM_EVENT_MESSAGE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->platformEventMessage(request, payloadLength);
-        });
+                return this->platformEventMessage(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_STATE_SENSOR_READINGS,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getStateSensorReadings(request, payloadLength);
-        });
+                return this->getStateSensorReadings(request, payloadLength);
+            });
 
         // Default handler for PLDM Events
         eventHandlers[PLDM_SENSOR_EVENT].emplace_back(
             [this](const pldm_msg* request, size_t payloadLength,
                    uint8_t formatVersion, uint8_t tid, size_t eventDataOffset) {
-            return this->sensorEvent(request, payloadLength, formatVersion, tid,
-                                     eventDataOffset);
-        });
+                return this->sensorEvent(request, payloadLength, formatVersion,
+                                         tid, eventDataOffset);
+            });
         eventHandlers[PLDM_PDR_REPOSITORY_CHG_EVENT].emplace_back(
             [this](const pldm_msg* request, size_t payloadLength,
                    uint8_t formatVersion, uint8_t tid, size_t eventDataOffset) {
-            return this->pldmPDRRepositoryChgEvent(
-                request, payloadLength, formatVersion, tid, eventDataOffset);
-        });
+                return this->pldmPDRRepositoryChgEvent(
+                    request, payloadLength, formatVersion, tid,
+                    eventDataOffset);
+            });
 
         // Additional OEM event handlers for PLDM events, append it to the
         // standard handlers
@@ -359,8 +359,8 @@
             if (pdr->effecter_id != effecterId)
             {
                 pdr = nullptr;
-                pdrRecord = stateEffecterPDRs.getNextRecord(pdrRecord,
-                                                            pdrEntry);
+                pdrRecord =
+                    stateEffecterPDRs.getNextRecord(pdrRecord, pdrEntry);
                 continue;
             }
 
@@ -385,15 +385,15 @@
         int rc = PLDM_SUCCESS;
         try
         {
-            const auto& [dbusMappings,
-                         dbusValMaps] = effecterDbusObjMaps.at(effecterId);
+            const auto& [dbusMappings, dbusValMaps] =
+                effecterDbusObjMaps.at(effecterId);
             for (uint8_t currState = 0; currState < compEffecterCnt;
                  ++currState)
             {
                 std::vector<StateSetNum> allowed{};
                 // computation is based on table 79 from DSP0248 v1.1.1
-                uint8_t bitfieldIndex = stateField[currState].effecter_state /
-                                        8;
+                uint8_t bitfieldIndex =
+                    stateField[currState].effecter_state / 8;
                 uint8_t bit = stateField[currState].effecter_state -
                               (8 * bitfieldIndex);
                 if (states->possible_states_size < bitfieldIndex ||
diff --git a/libpldmresponder/platform_config.cpp b/libpldmresponder/platform_config.cpp
index 8d7fe79..8f181f1 100644
--- a/libpldmresponder/platform_config.cpp
+++ b/libpldmresponder/platform_config.cpp
@@ -41,8 +41,8 @@
 
     if (!names.empty())
     {
-        std::optional<std::string> sysType = getSysSpecificJsonDir(sysDirPath,
-                                                                   names);
+        std::optional<std::string> sysType =
+            getSysSpecificJsonDir(sysDirPath, names);
         if (sysType.has_value())
         {
             systemType = sysType.value();
@@ -136,9 +136,8 @@
     return std::nullopt;
 }
 
-std::optional<std::string>
-    Handler::getSysSpecificJsonDir(const fs::path& dirPath,
-                                   const std::vector<std::string>& dirNames)
+std::optional<std::string> Handler::getSysSpecificJsonDir(
+    const fs::path& dirPath, const std::vector<std::string>& dirNames)
 {
     // The current setup assumes that the BIOS and PDR configurations always
     // come from the same system type. If, in the future, we need to use BIOS
diff --git a/libpldmresponder/platform_config.hpp b/libpldmresponder/platform_config.hpp
index 578751b..770a2df 100644
--- a/libpldmresponder/platform_config.hpp
+++ b/libpldmresponder/platform_config.hpp
@@ -53,9 +53,8 @@
      *  @param[in] dirNames - System names retrieved from remote application
      *  @return - The system type information
      */
-    std::optional<std::string>
-        getSysSpecificJsonDir(const fs::path& dirPath,
-                              const std::vector<std::string>& dirNames);
+    std::optional<std::string> getSysSpecificJsonDir(
+        const fs::path& dirPath, const std::vector<std::string>& dirNames);
 
     /** @brief system type/model */
     std::string systemType;
diff --git a/libpldmresponder/platform_numeric_effecter.hpp b/libpldmresponder/platform_numeric_effecter.hpp
index 86f72c9..afb24fe 100644
--- a/libpldmresponder/platform_numeric_effecter.hpp
+++ b/libpldmresponder/platform_numeric_effecter.hpp
@@ -184,10 +184,9 @@
  *  @return std::pair<int, std::optional<PropertyValue>> - rc:Success or
  *          failure, PropertyValue: The value to be set
  */
-std::pair<int, std::optional<pldm::utils::PropertyValue>>
-    convertToDbusValue(const pldm_numeric_effecter_value_pdr* pdr,
-                       uint8_t effecterDataSize, uint8_t* effecterValue,
-                       std::string propertyType)
+std::pair<int, std::optional<pldm::utils::PropertyValue>> convertToDbusValue(
+    const pldm_numeric_effecter_value_pdr* pdr, uint8_t effecterDataSize,
+    uint8_t* effecterValue, std::string propertyType)
 {
     if (effecterDataSize == PLDM_EFFECTER_DATA_SIZE_UINT8)
     {
@@ -245,11 +244,10 @@
  * terms of PLDM completion codes if at least one state fails to be set
  */
 template <class DBusInterface, class Handler>
-int setNumericEffecterValueHandler(const DBusInterface& dBusIntf,
-                                   Handler& handler, uint16_t effecterId,
-                                   uint8_t effecterDataSize,
-                                   uint8_t* effecterValue,
-                                   size_t effecterValueLength)
+int setNumericEffecterValueHandler(
+    const DBusInterface& dBusIntf, Handler& handler, uint16_t effecterId,
+    uint8_t effecterDataSize, uint8_t* effecterValue,
+    size_t effecterValueLength)
 {
     constexpr auto effecterValueArrayLength = 4;
     pldm_numeric_effecter_value_pdr* pdr = nullptr;
@@ -302,8 +300,8 @@
 
     try
     {
-        const auto& [dbusMappings,
-                     dbusValMaps] = handler.getDbusObjMaps(effecterId);
+        const auto& [dbusMappings, dbusValMaps] =
+            handler.getDbusObjMaps(effecterId);
         pldm::utils::DBusMapping dbusMapping{
             dbusMappings[0].objectPath, dbusMappings[0].interface,
             dbusMappings[0].propertyName, dbusMappings[0].propertyType};
@@ -432,12 +430,10 @@
  *
  *  @return PLDM_SUCCESS/PLDM_ERROR
  */
-int getNumericEffecterValueHandler(const std::string& propertyType,
-                                   pldm::utils::PropertyValue propertyValue,
-                                   uint8_t effecterDataSize,
-                                   pldm_msg* responsePtr,
-                                   size_t responsePayloadLength,
-                                   uint8_t instanceId)
+int getNumericEffecterValueHandler(
+    const std::string& propertyType, pldm::utils::PropertyValue propertyValue,
+    uint8_t effecterDataSize, pldm_msg* responsePtr,
+    size_t responsePayloadLength, uint8_t instanceId)
 {
     if (propertyType == "uint8_t")
     {
@@ -537,8 +533,8 @@
     pldm::utils::DBusMapping dbusMapping{};
     try
     {
-        const auto& [dbusMappings,
-                     dbusValMaps] = handler.getDbusObjMaps(effecterId);
+        const auto& [dbusMappings, dbusValMaps] =
+            handler.getDbusObjMaps(effecterId);
         if (dbusMappings.size() > 0)
         {
             dbusMapping = {
diff --git a/libpldmresponder/platform_state_effecter.hpp b/libpldmresponder/platform_state_effecter.hpp
index 106cbc1..c6f7432 100644
--- a/libpldmresponder/platform_state_effecter.hpp
+++ b/libpldmresponder/platform_state_effecter.hpp
@@ -97,8 +97,8 @@
     int rc = PLDM_SUCCESS;
     try
     {
-        const auto& [dbusMappings,
-                     dbusValMaps] = handler.getDbusObjMaps(effecterId);
+        const auto& [dbusMappings, dbusValMaps] =
+            handler.getDbusObjMaps(effecterId);
         if (dbusMappings.empty() || dbusValMaps.empty())
         {
             error("DbusMappings for effecter ID '{EFFECTER_ID}' is missing",
diff --git a/libpldmresponder/test/libpldmresponder_base_test.cpp b/libpldmresponder/test/libpldmresponder_base_test.cpp
index 0387209..4656882 100644
--- a/libpldmresponder/test/libpldmresponder_base_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_base_test.cpp
@@ -82,8 +82,8 @@
     uint8_t retFlag = PLDM_START_AND_END;
     ver32_t version = {0x00, 0xF0, 0xF0, 0xF1};
 
-    auto rc = encode_get_version_req(0, transferHandle, flag, pldmType,
-                                     request);
+    auto rc =
+        encode_get_version_req(0, transferHandle, flag, pldmType, request);
 
     ASSERT_EQ(0, rc);
 
@@ -113,8 +113,8 @@
     uint32_t transferHandle = 0x0;
     uint8_t flag = PLDM_GET_FIRSTPART;
 
-    auto rc = encode_get_version_req(0, transferHandle, flag, pldmType,
-                                     request);
+    auto rc =
+        encode_get_version_req(0, transferHandle, flag, pldmType, request);
 
     ASSERT_EQ(0, rc);
 
diff --git a/libpldmresponder/test/libpldmresponder_bios_config_test.cpp b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
index ea29015..9b4f74e 100644
--- a/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
@@ -98,25 +98,26 @@
     EXPECT_TRUE(attrTable);
     EXPECT_TRUE(attrValueTable);
 
-    std::set<std::string> expectedStrings = {"HMCManagedState",
-                                             "On",
-                                             "Off",
-                                             "FWBootSide",
-                                             "Perm",
-                                             "Temp",
-                                             "InbandCodeUpdate",
-                                             "Allowed",
-                                             "Allowed",
-                                             "NotAllowed",
-                                             "CodeUpdatePolicy",
-                                             "Concurrent",
-                                             "Disruptive",
-                                             "VDD_AVSBUS_RAIL",
-                                             "SBE_IMAGE_MINIMUM_VALID_ECS",
-                                             "INTEGER_INVALID_CASE",
-                                             "str_example1",
-                                             "str_example2",
-                                             "str_example3"};
+    std::set<std::string> expectedStrings = {
+        "HMCManagedState",
+        "On",
+        "Off",
+        "FWBootSide",
+        "Perm",
+        "Temp",
+        "InbandCodeUpdate",
+        "Allowed",
+        "Allowed",
+        "NotAllowed",
+        "CodeUpdatePolicy",
+        "Concurrent",
+        "Disruptive",
+        "VDD_AVSBUS_RAIL",
+        "SBE_IMAGE_MINIMUM_VALID_ECS",
+        "INTEGER_INVALID_CASE",
+        "str_example1",
+        "str_example2",
+        "str_example3"};
     std::set<std::string> strings;
     for (auto entry : BIOSTableIter<PLDM_BIOS_STRING_TABLE>(
              stringTable->data(), stringTable->size()))
@@ -206,8 +207,8 @@
              attrValueTable->data(), attrValueTable->size()))
     {
         auto header = table::attribute_value::decodeHeader(entry);
-        auto attrEntry = table::attribute::findByHandle(*attrTable,
-                                                        header.attrHandle);
+        auto attrEntry =
+            table::attribute::findByHandle(*attrTable, header.attrHandle);
         auto attrHeader = table::attribute::decodeHeader(attrEntry);
         auto attrName = biosStringTable.findString(attrHeader.stringHandle);
         auto jsonEntry = findJsonEntry(attrName);
@@ -368,9 +369,8 @@
     EXPECT_EQ(rc, PLDM_SUCCESS);
 
     auto attrValueTable = biosConfig.getBIOSTable(PLDM_BIOS_ATTR_VAL_TABLE);
-    auto findEntry =
-        [&attrValueTable](
-            uint16_t handle) -> const pldm_bios_attr_val_table_entry* {
+    auto findEntry = [&attrValueTable](uint16_t handle)
+        -> const pldm_bios_attr_val_table_entry* {
         for (auto entry : BIOSTableIter<PLDM_BIOS_ATTR_VAL_TABLE>(
                  attrValueTable->data(), attrValueTable->size()))
         {
diff --git a/libpldmresponder/test/libpldmresponder_fru_test.cpp b/libpldmresponder/test/libpldmresponder_fru_test.cpp
index d654fca..f4a1202 100644
--- a/libpldmresponder/test/libpldmresponder_fru_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_fru_test.cpp
@@ -134,8 +134,8 @@
     mockedFruHandler.updateAssociationTree(
         objects, "/xyz/openbmc_project/inventory/system/chassis/motherboard");
 
-    pldm_entity_node* node = pldm_entity_association_tree_find(entityTree.get(),
-                                                               &systemEntity);
+    pldm_entity_node* node =
+        pldm_entity_association_tree_find(entityTree.get(), &systemEntity);
     EXPECT_TRUE(node != NULL);
 
     node = pldm_entity_association_tree_find(entityTree.get(), &chassisEntity);
@@ -143,8 +143,8 @@
     test_pldm_entity_node* test_node = (test_pldm_entity_node*)node;
     EXPECT_TRUE((test_node->parent).entity_type == systemEntity.entity_type);
 
-    node = pldm_entity_association_tree_find(entityTree.get(),
-                                             &motherboardEntity);
+    node =
+        pldm_entity_association_tree_find(entityTree.get(), &motherboardEntity);
     ASSERT_TRUE(node != NULL);
     test_node = (test_pldm_entity_node*)node;
     EXPECT_TRUE((test_node->parent).entity_type == chassisEntity.entity_type);
diff --git a/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp b/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
index 6ef74b7..87ee867 100644
--- a/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
@@ -69,8 +69,8 @@
     bf1.byte = 2;
     ASSERT_EQ(states->states[0].byte, bf1.byte);
 
-    const auto& [dbusMappings1,
-                 dbusValMaps1] = handler.getDbusObjMaps(pdr->effecter_id);
+    const auto& [dbusMappings1, dbusValMaps1] =
+        handler.getDbusObjMaps(pdr->effecter_id);
     ASSERT_EQ(dbusMappings1[0].objectPath, "/foo/bar");
 
     // Check second PDR
@@ -109,8 +109,8 @@
     ASSERT_EQ(states->states[0].byte, bf2[0].byte);
     ASSERT_EQ(states->states[1].byte, bf2[1].byte);
 
-    const auto& [dbusMappings2,
-                 dbusValMaps2] = handler.getDbusObjMaps(pdr->effecter_id);
+    const auto& [dbusMappings2, dbusValMaps2] =
+        handler.getDbusObjMaps(pdr->effecter_id);
     ASSERT_EQ(dbusMappings2[0].objectPath, "/foo/bar");
     ASSERT_EQ(dbusMappings2[1].objectPath, "/foo/bar");
 
@@ -157,8 +157,8 @@
     EXPECT_EQ(pdr->effecter_id, 3);
     EXPECT_EQ(pdr->effecter_data_size, 4);
 
-    const auto& [dbusMappings,
-                 dbusValMaps] = handler.getDbusObjMaps(pdr->effecter_id);
+    const auto& [dbusMappings, dbusValMaps] =
+        handler.getDbusObjMaps(pdr->effecter_id);
     EXPECT_EQ(dbusMappings[0].objectPath, "/foo/bar");
     EXPECT_EQ(dbusMappings[0].interface, "xyz.openbmc_project.Foo.Bar");
     EXPECT_EQ(dbusMappings[0].propertyName, "propertyName");
diff --git a/libpldmresponder/test/libpldmresponder_platform_test.cpp b/libpldmresponder/test/libpldmresponder_platform_test.cpp
index 63e26e2..d3606f5 100644
--- a/libpldmresponder/test/libpldmresponder_platform_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_platform_test.cpp
@@ -307,15 +307,13 @@
         MockdBusHandler, Handler>(mockedUtils, handler, 0x1, stateField);
     ASSERT_EQ(rc, PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE);
 
-    rc = platform_state_effecter::setStateEffecterStatesHandler<MockdBusHandler,
-                                                                Handler>(
-        mockedUtils, handler, 0x9, stateField);
+    rc = platform_state_effecter::setStateEffecterStatesHandler<
+        MockdBusHandler, Handler>(mockedUtils, handler, 0x9, stateField);
     ASSERT_EQ(rc, PLDM_PLATFORM_INVALID_EFFECTER_ID);
 
     stateField.push_back({PLDM_REQUEST_SET, 4});
-    rc = platform_state_effecter::setStateEffecterStatesHandler<MockdBusHandler,
-                                                                Handler>(
-        mockedUtils, handler, 0x1, stateField);
+    rc = platform_state_effecter::setStateEffecterStatesHandler<
+        MockdBusHandler, Handler>(mockedUtils, handler, 0x1, stateField);
     ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
 
     pldm_pdr_destroy(inPDRRepo);
@@ -444,18 +442,17 @@
                                        StrEq("xyz.openbmc_project.Foo.Bar")))
         .WillOnce(Return(PropertyValue(static_cast<uint64_t>(effecterValue))));
 
-    auto rc = platform_numeric_effecter::getNumericEffecterData<MockdBusHandler,
-                                                                Handler>(
-        mockedUtils, handler, effecterId, effecterDataSize, propertyType,
-        dbusValue);
+    auto rc = platform_numeric_effecter::getNumericEffecterData<
+        MockdBusHandler, Handler>(mockedUtils, handler, effecterId,
+                                  effecterDataSize, propertyType, dbusValue);
 
     ASSERT_EQ(rc, 0);
 
-    size_t responsePayloadLength = sizeof(completionCode) +
-                                   sizeof(effecterDataSize) +
-                                   sizeof(effecterOperationalState) +
-                                   getEffecterDataSize(effecterDataSize) +
-                                   getEffecterDataSize(effecterDataSize);
+    size_t responsePayloadLength =
+        sizeof(completionCode) + sizeof(effecterDataSize) +
+        sizeof(effecterOperationalState) +
+        getEffecterDataSize(effecterDataSize) +
+        getEffecterDataSize(effecterDataSize);
 
     Response response(responsePayloadLength + sizeof(pldm_msg_hdr));
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
@@ -511,10 +508,9 @@
     pldm::utils::PropertyValue dbusValue;
     std::string propertyType;
 
-    auto rc = platform_numeric_effecter::getNumericEffecterData<MockdBusHandler,
-                                                                Handler>(
-        mockedUtils, handler, effecterId, effecterDataSize, propertyType,
-        dbusValue);
+    auto rc = platform_numeric_effecter::getNumericEffecterData<
+        MockdBusHandler, Handler>(mockedUtils, handler, effecterId,
+                                  effecterDataSize, propertyType, dbusValue);
 
     ASSERT_EQ(rc, 128);
 
@@ -526,15 +522,15 @@
 {
     // Sample state sensor with SensorID - 1, EntityType - Processor Module(67)
     // State Set ID - Operational Running Status(11), Supported States - 3,4
-    std::vector<uint8_t> sample1PDR{0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00,
-                                    0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00,
-                                    0x43, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
-                                    0x00, 0x01, 0x0b, 0x00, 0x01, 0x18};
+    std::vector<uint8_t> sample1PDR{
+        0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x17,
+        0x00, 0x00, 0x00, 0x01, 0x00, 0x43, 0x00, 0x01, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x01, 0x18};
 
-    const auto& [terminusHandle1, sensorID1,
-                 sensorInfo1] = parseStateSensorPDR(sample1PDR);
-    const auto& [containerID1, entityType1,
-                 entityInstance1] = std::get<0>(sensorInfo1);
+    const auto& [terminusHandle1, sensorID1, sensorInfo1] =
+        parseStateSensorPDR(sample1PDR);
+    const auto& [containerID1, entityType1, entityInstance1] =
+        std::get<0>(sensorInfo1);
     const auto& states1 = std::get<1>(sensorInfo1);
     CompositeSensorStates statesCmp1{{3u, 4u}};
 
@@ -547,15 +543,15 @@
 
     // Sample state sensor with SensorID - 2, EntityType - System Firmware(31)
     // State Set ID - Availability(2), Supported States - 3,4,9,10,11,13
-    std::vector<uint8_t> sample2PDR{0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00,
-                                    0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00,
-                                    0x1F, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
-                                    0x00, 0x01, 0x02, 0x00, 0x02, 0x18, 0x2E};
+    std::vector<uint8_t> sample2PDR{
+        0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x17, 0x00,
+        0x00, 0x00, 0x02, 0x00, 0x1F, 0x00, 0x01, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x01, 0x02, 0x00, 0x02, 0x18, 0x2E};
 
-    const auto& [terminusHandle2, sensorID2,
-                 sensorInfo2] = parseStateSensorPDR(sample2PDR);
-    const auto& [containerID2, entityType2,
-                 entityInstance2] = std::get<0>(sensorInfo2);
+    const auto& [terminusHandle2, sensorID2, sensorInfo2] =
+        parseStateSensorPDR(sample2PDR);
+    const auto& [containerID2, entityType2, entityInstance2] =
+        std::get<0>(sensorInfo2);
     const auto& states2 = std::get<1>(sensorInfo2);
     CompositeSensorStates statesCmp2{{3u, 4u, 9u, 10u, 11u, 13u}};
 
@@ -575,10 +571,10 @@
         0x00, 0x03, 0x00, 0x21, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
         0x02, 0x21, 0x00, 0x01, 0x06, 0x0F, 0x00, 0x01, 0x1E};
 
-    const auto& [terminusHandle3, sensorID3,
-                 sensorInfo3] = parseStateSensorPDR(sample3PDR);
-    const auto& [containerID3, entityType3,
-                 entityInstance3] = std::get<0>(sensorInfo3);
+    const auto& [terminusHandle3, sensorID3, sensorInfo3] =
+        parseStateSensorPDR(sample3PDR);
+    const auto& [containerID3, entityType3, entityInstance3] =
+        std::get<0>(sensorInfo3);
     const auto& states3 = std::get<1>(sensorInfo3);
     CompositeSensorStates statesCmp3{{1u, 2u}, {1u, 2u, 3u, 4u}};
 
diff --git a/libpldmresponder/test/libpldmresponder_systemspecific_bios_test.cpp b/libpldmresponder/test/libpldmresponder_systemspecific_bios_test.cpp
index 0c7cc8c..9b7fe8a 100644
--- a/libpldmresponder/test/libpldmresponder_systemspecific_bios_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_systemspecific_bios_test.cpp
@@ -105,25 +105,26 @@
     EXPECT_TRUE(attrTable);
     EXPECT_TRUE(attrValueTable);
 
-    std::set<std::string> expectedStrings = {"HMCManagedState",
-                                             "On",
-                                             "Off",
-                                             "FWBootSide",
-                                             "Perm",
-                                             "Temp",
-                                             "InbandCodeUpdate",
-                                             "Allowed",
-                                             "Allowed",
-                                             "NotAllowed",
-                                             "CodeUpdatePolicy",
-                                             "Concurrent",
-                                             "Disruptive",
-                                             "VDD_AVSBUS_RAIL",
-                                             "SBE_IMAGE_MINIMUM_VALID_ECS",
-                                             "INTEGER_INVALID_CASE",
-                                             "str_example1",
-                                             "str_example2",
-                                             "str_example3"};
+    std::set<std::string> expectedStrings = {
+        "HMCManagedState",
+        "On",
+        "Off",
+        "FWBootSide",
+        "Perm",
+        "Temp",
+        "InbandCodeUpdate",
+        "Allowed",
+        "Allowed",
+        "NotAllowed",
+        "CodeUpdatePolicy",
+        "Concurrent",
+        "Disruptive",
+        "VDD_AVSBUS_RAIL",
+        "SBE_IMAGE_MINIMUM_VALID_ECS",
+        "INTEGER_INVALID_CASE",
+        "str_example1",
+        "str_example2",
+        "str_example3"};
     std::set<std::string> strings;
     for (auto entry : BIOSTableIter<PLDM_BIOS_STRING_TABLE>(
              stringTable->data(), stringTable->size()))
@@ -213,8 +214,8 @@
              attrValueTable->data(), attrValueTable->size()))
     {
         auto header = table::attribute_value::decodeHeader(entry);
-        auto attrEntry = table::attribute::findByHandle(*attrTable,
-                                                        header.attrHandle);
+        auto attrEntry =
+            table::attribute::findByHandle(*attrTable, header.attrHandle);
         auto attrHeader = table::attribute::decodeHeader(attrEntry);
         auto attrName = biosStringTable.findString(attrHeader.stringHandle);
         auto jsonEntry = findJsonEntry(attrName);
@@ -453,9 +454,8 @@
     EXPECT_EQ(rc, PLDM_SUCCESS);
 
     auto attrValueTable = biosConfig.getBIOSTable(PLDM_BIOS_ATTR_VAL_TABLE);
-    auto findEntry =
-        [&attrValueTable](
-            uint16_t handle) -> const pldm_bios_attr_val_table_entry* {
+    auto findEntry = [&attrValueTable](uint16_t handle)
+        -> const pldm_bios_attr_val_table_entry* {
         for (auto entry : BIOSTableIter<PLDM_BIOS_ATTR_VAL_TABLE>(
                  attrValueTable->data(), attrValueTable->size()))
         {
diff --git a/oem/ibm/host-bmc/host_lamp_test.cpp b/oem/ibm/host-bmc/host_lamp_test.cpp
index 57f9610..e7485d8 100644
--- a/oem/ibm/host-bmc/host_lamp_test.cpp
+++ b/oem/ibm/host-bmc/host_lamp_test.cpp
@@ -111,9 +111,9 @@
     constexpr uint8_t effecterCount = 1;
     auto instanceId = instanceIdDb.next(mctp_eid);
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) + sizeof(effecterID) +
-                                    sizeof(effecterCount) +
-                                    sizeof(set_effecter_state_field));
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + sizeof(effecterID) + sizeof(effecterCount) +
+        sizeof(set_effecter_state_field));
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     set_effecter_state_field stateField{PLDM_REQUEST_SET,
                                         PLDM_STATE_SET_IDENTIFY_STATE_ASSERTED};
@@ -127,8 +127,9 @@
         return rc;
     }
 
-    auto setStateEffecterStatesResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto setStateEffecterStatesResponseHandler = [](mctp_eid_t /*eid*/,
+                                                    const pldm_msg* response,
+                                                    size_t respMsgLen) {
         if (!response || !respMsgLen)
         {
             error(
diff --git a/oem/ibm/host-bmc/host_lamp_test.hpp b/oem/ibm/host-bmc/host_lamp_test.hpp
index 67e5593..f5b1294 100644
--- a/oem/ibm/host-bmc/host_lamp_test.hpp
+++ b/oem/ibm/host-bmc/host_lamp_test.hpp
@@ -55,9 +55,8 @@
                  uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
                  pldm_pdr* repo,
                  pldm::requester::Handler<pldm::requester::Request>* handler) :
-        LEDGroupObj(bus, objPath.c_str()),
-        path(objPath), mctp_eid(mctp_eid), instanceIdDb(instanceIdDb),
-        pdrRepo(repo), handler(handler)
+        LEDGroupObj(bus, objPath.c_str()), path(objPath), mctp_eid(mctp_eid),
+        instanceIdDb(instanceIdDb), pdrRepo(repo), handler(handler)
     {}
 
     /** @brief Property SET Override function
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index 57b89ba..f223819 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -77,8 +77,8 @@
     pldm::utils::CustomFD xdmaFd(dmaFd);
 
     void* vgaMem;
-    vgaMem = mmap(nullptr, pageAlignedLength, PROT_READ, MAP_SHARED, xdmaFd(),
-                  0);
+    vgaMem =
+        mmap(nullptr, pageAlignedLength, PROT_READ, MAP_SHARED, xdmaFd(), 0);
     if (MAP_FAILED == vgaMem)
     {
         rc = -errno;
@@ -287,11 +287,10 @@
     }
 }
 
-void encodeGetFileResponseHandler(uint8_t instance_id, uint8_t completion_code,
-                                  uint32_t next_transfer_handle,
-                                  uint8_t transfer_flag,
-                                  const uint8_t* table_data, size_t table_size,
-                                  struct pldm_msg* msg)
+void encodeGetFileResponseHandler(
+    uint8_t instance_id, uint8_t completion_code, uint32_t next_transfer_handle,
+    uint8_t transfer_flag, const uint8_t* table_data, size_t table_size,
+    struct pldm_msg* msg)
 {
     int rc = encode_get_file_table_resp(instance_id, completion_code,
                                         next_transfer_handle, transfer_flag,
@@ -547,8 +546,8 @@
     uint8_t transferFlag = 0;
     uint8_t tableType = 0;
 
-    Response response(sizeof(pldm_msg_hdr) +
-                      PLDM_GET_FILE_TABLE_MIN_RESP_BYTES);
+    Response response(
+        sizeof(pldm_msg_hdr) + PLDM_GET_FILE_TABLE_MIN_RESP_BYTES);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
 
     if (payloadLength != PLDM_GET_FILE_TABLE_REQ_BYTES)
@@ -787,8 +786,8 @@
         return response;
     }
 
-    auto fileDataPos = reinterpret_cast<const char*>(request->payload) +
-                       fileDataOffset;
+    auto fileDataPos =
+        reinterpret_cast<const char*>(request->payload) + fileDataOffset;
 
     std::ofstream stream(value.fsPath,
                          std::ios::in | std::ios::out | std::ios::binary);
@@ -826,9 +825,9 @@
     uint32_t offset{};
     uint32_t length{};
     uint64_t address{};
-    auto rc = decode_rw_file_by_type_memory_req(request, payloadLength,
-                                                &fileType, &fileHandle, &offset,
-                                                &length, &address);
+    auto rc = decode_rw_file_by_type_memory_req(
+        request, payloadLength, &fileType, &fileHandle, &offset, &length,
+        &address);
     if (rc != PLDM_SUCCESS)
     {
         error(
@@ -1135,8 +1134,8 @@
 
     rc = handler->newFileAvailable(length);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
-    int responseCode = encode_new_file_resp(request->hdr.instance_id, rc,
-                                            responsePtr);
+    int responseCode =
+        encode_new_file_resp(request->hdr.instance_id, rc, responsePtr);
     if (responseCode != PLDM_SUCCESS)
     {
         error(
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp
index dff0085..eab731b 100644
--- a/oem/ibm/libpldmresponder/file_io.hpp
+++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -174,63 +174,63 @@
         handlers.emplace(
             PLDM_READ_FILE_INTO_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFileIntoMemory(request, payloadLength);
-        });
+                return this->readFileIntoMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE_FROM_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFileFromMemory(request, payloadLength);
-        });
+                return this->writeFileFromMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE_BY_TYPE_FROM_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFileByTypeFromMemory(request, payloadLength);
-        });
+                return this->writeFileByTypeFromMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_READ_FILE_BY_TYPE_INTO_MEMORY,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFileByTypeIntoMemory(request, payloadLength);
-        });
+                return this->readFileByTypeIntoMemory(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_READ_FILE_BY_TYPE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFileByType(request, payloadLength);
-        });
+                return this->readFileByType(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE_BY_TYPE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFileByType(request, payloadLength);
-        });
+                return this->writeFileByType(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_GET_FILE_TABLE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getFileTable(request, payloadLength);
-        });
+                return this->getFileTable(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_READ_FILE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->readFile(request, payloadLength);
-        });
+                return this->readFile(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_WRITE_FILE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->writeFile(request, payloadLength);
-        });
+                return this->writeFile(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_FILE_ACK,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->fileAck(request, payloadLength);
-        });
+                return this->fileAck(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_HOST_GET_ALERT_STATUS,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->getAlertStatus(request, payloadLength);
-        });
+                return this->getAlertStatus(request, payloadLength);
+            });
         handlers.emplace(
             PLDM_NEW_FILE_AVAILABLE,
             [this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
-            return this->newFileAvailable(request, payloadLength);
-        });
+                return this->newFileAvailable(request, payloadLength);
+            });
 
         resDumpMatcher = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
@@ -238,80 +238,84 @@
                 sdbusplus::bus::match::rules::argNpath(0, dumpObjPath),
             [this, hostSockFd, hostEid, instanceIdDb,
              handler](sdbusplus::message_t& msg) {
-            std::map<std::string,
-                     std::map<std::string, std::variant<std::string, uint32_t>>>
-                interfaces;
-            sdbusplus::message::object_path path;
-            msg.read(path, interfaces);
-            std::string vspstring;
-            std::string password;
+                std::map<
+                    std::string,
+                    std::map<std::string, std::variant<std::string, uint32_t>>>
+                    interfaces;
+                sdbusplus::message::object_path path;
+                msg.read(path, interfaces);
+                std::string vspstring;
+                std::string password;
 
-            for (const auto& interface : interfaces)
-            {
-                if (interface.first == resDumpEntry)
+                for (const auto& interface : interfaces)
                 {
-                    for (const auto& property : interface.second)
+                    if (interface.first == resDumpEntry)
                     {
-                        if (property.first == "VSPString")
+                        for (const auto& property : interface.second)
                         {
-                            vspstring = std::get<std::string>(property.second);
+                            if (property.first == "VSPString")
+                            {
+                                vspstring =
+                                    std::get<std::string>(property.second);
+                            }
+                            else if (property.first == "Password")
+                            {
+                                password =
+                                    std::get<std::string>(property.second);
+                            }
                         }
-                        else if (property.first == "Password")
-                        {
-                            password = std::get<std::string>(property.second);
-                        }
+                        dbusToFileHandlers
+                            .emplace_back(
+                                std::make_unique<pldm::requester::oem_ibm::
+                                                     DbusToFileHandler>(
+                                    hostSockFd, hostEid, instanceIdDb, path,
+                                    handler))
+                            ->processNewResourceDump(vspstring, password);
+                        break;
                     }
-                    dbusToFileHandlers
-                        .emplace_back(
-                            std::make_unique<
-                                pldm::requester::oem_ibm::DbusToFileHandler>(
-                                hostSockFd, hostEid, instanceIdDb, path,
-                                handler))
-                        ->processNewResourceDump(vspstring, password);
-                    break;
                 }
-            }
-        });
+            });
         vmiCertMatcher = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
             sdbusplus::bus::match::rules::interfacesAdded() +
                 sdbusplus::bus::match::rules::argNpath(0, certObjPath),
             [this, hostSockFd, hostEid, instanceIdDb,
              handler](sdbusplus::message_t& msg) {
-            std::map<std::string,
-                     std::map<std::string, std::variant<std::string, uint32_t>>>
-                interfaces;
-            sdbusplus::message::object_path path;
-            msg.read(path, interfaces);
-            std::string csr;
+                std::map<
+                    std::string,
+                    std::map<std::string, std::variant<std::string, uint32_t>>>
+                    interfaces;
+                sdbusplus::message::object_path path;
+                msg.read(path, interfaces);
+                std::string csr;
 
-            for (const auto& interface : interfaces)
-            {
-                if (interface.first == certAuthority)
+                for (const auto& interface : interfaces)
                 {
-                    for (const auto& property : interface.second)
+                    if (interface.first == certAuthority)
                     {
-                        if (property.first == "CSR")
+                        for (const auto& property : interface.second)
                         {
-                            csr = std::get<std::string>(property.second);
-                            auto fileHandle =
-                                sdbusplus::message::object_path(path)
-                                    .filename();
+                            if (property.first == "CSR")
+                            {
+                                csr = std::get<std::string>(property.second);
+                                auto fileHandle =
+                                    sdbusplus::message::object_path(path)
+                                        .filename();
 
-                            dbusToFileHandlers
-                                .emplace_back(
-                                    std::make_unique<pldm::requester::oem_ibm::
-                                                         DbusToFileHandler>(
+                                dbusToFileHandlers
+                                    .emplace_back(std::make_unique<
+                                                  pldm::requester::oem_ibm::
+                                                      DbusToFileHandler>(
                                         hostSockFd, hostEid, instanceIdDb, path,
                                         handler))
-                                ->newCsrFileAvailable(csr, fileHandle);
-                            break;
+                                    ->newCsrFileAvailable(csr, fileHandle);
+                                break;
+                            }
                         }
+                        break;
                     }
-                    break;
                 }
-            }
-        });
+            });
     }
 
     /** @brief Handler for readFileIntoMemory command
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.cpp b/oem/ibm/libpldmresponder/file_io_by_type.cpp
index 1a14555..bed64f1 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.cpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.cpp
@@ -47,8 +47,8 @@
         length -= dma::maxSize;
         address += dma::maxSize;
     }
-    auto rc = xdmaInterface.transferDataHost(fd, offset, length, address,
-                                             upstream);
+    auto rc =
+        xdmaInterface.transferDataHost(fd, offset, length, address, upstream);
     return rc < 0 ? PLDM_ERROR : PLDM_SUCCESS;
 }
 
@@ -58,8 +58,8 @@
     dma::DMA xdmaInterface;
     while (length > dma::maxSize)
     {
-        auto rc = xdmaInterface.transferHostDataToSocket(fd, dma::maxSize,
-                                                         address);
+        auto rc =
+            xdmaInterface.transferHostDataToSocket(fd, dma::maxSize, address);
         if (rc < 0)
         {
             return PLDM_ERROR;
@@ -123,8 +123,8 @@
     return transferFileData(fd(), upstream, offset, length, address);
 }
 
-std::unique_ptr<FileHandler> getHandlerByType(uint16_t fileType,
-                                              uint32_t fileHandle)
+std::unique_ptr<FileHandler>
+    getHandlerByType(uint16_t fileType, uint32_t fileHandle)
 {
     switch (fileType)
     {
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.hpp b/oem/ibm/libpldmresponder/file_io_by_type.hpp
index c9056e9..cf4a82c 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.hpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.hpp
@@ -130,7 +130,7 @@
  *  @param[in] fileHandle - file handle
  */
 
-std::unique_ptr<FileHandler> getHandlerByType(uint16_t fileType,
-                                              uint32_t fileHandle);
+std::unique_ptr<FileHandler>
+    getHandlerByType(uint16_t fileType, uint32_t fileHandle);
 } // namespace responder
 } // namespace pldm
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.cpp b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
index 00d9f0b..402a003 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
@@ -163,9 +163,9 @@
             }
             PropertyValue valueStatus{
                 "xyz.openbmc_project.Certs.Entry.State.Complete"};
-            DBusMapping dbusMappingStatus{certObjPath +
-                                              std::to_string(fileHandle),
-                                          certEntryIntf, "Status", "string"};
+            DBusMapping dbusMappingStatus{
+                certObjPath + std::to_string(fileHandle), certEntryIntf,
+                "Status", "string"};
             try
             {
                 info(
@@ -231,8 +231,8 @@
     }
     else if (certType == PLDM_FILE_TYPE_ROOT_CERT)
     {
-        fileFd = open((filePath + "RootCert").c_str(), flags,
-                      S_IRUSR | S_IWUSR);
+        fileFd =
+            open((filePath + "RootCert").c_str(), flags, S_IRUSR | S_IWUSR);
     }
     if (fileFd == -1)
     {
@@ -245,11 +245,9 @@
     return PLDM_SUCCESS;
 }
 
-int CertHandler::newFileAvailableWithMetaData(uint64_t length,
-                                              uint32_t metaDataValue1,
-                                              uint32_t /*metaDataValue2*/,
-                                              uint32_t /*metaDataValue3*/,
-                                              uint32_t /*metaDataValue4*/)
+int CertHandler::newFileAvailableWithMetaData(
+    uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/,
+    uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/)
 {
     fs::create_directories(certFilePath);
     fs::permissions(certFilePath,
@@ -297,8 +295,8 @@
     }
     else if (certType == PLDM_FILE_TYPE_ROOT_CERT)
     {
-        fileFd = open((filePath + "RootCert").c_str(), flags,
-                      S_IRUSR | S_IWUSR);
+        fileFd =
+            open((filePath + "RootCert").c_str(), flags, S_IRUSR | S_IWUSR);
     }
     if (fileFd == -1)
     {
@@ -311,11 +309,10 @@
     return PLDM_SUCCESS;
 }
 
-int CertHandler::fileAckWithMetaData(uint8_t fileStatus,
-                                     uint32_t /*metaDataValue1*/,
-                                     uint32_t /*metaDataValue2*/,
-                                     uint32_t /*metaDataValue3*/,
-                                     uint32_t /*metaDataValue4*/)
+int CertHandler::fileAckWithMetaData(
+    uint8_t fileStatus, uint32_t /*metaDataValue1*/,
+    uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+    uint32_t /*metaDataValue4*/)
 {
     if (certType == PLDM_FILE_TYPE_CERT_SIGNING_REQUEST)
     {
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.hpp b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
index 75f0e69..8613cd5 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
@@ -47,17 +47,14 @@
 
     virtual int newFileAvailable(uint64_t length);
 
-    virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
-                                    uint32_t /*metaDataValue1*/,
-                                    uint32_t /*metaDataValue2*/,
-                                    uint32_t /*metaDataValue3*/,
-                                    uint32_t /*metaDataValue4*/);
+    virtual int fileAckWithMetaData(
+        uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/);
 
-    virtual int newFileAvailableWithMetaData(uint64_t length,
-                                             uint32_t metaDataValue1,
-                                             uint32_t /*metaDataValue2*/,
-                                             uint32_t /*metaDataValue3*/,
-                                             uint32_t /*metaDataValue4*/);
+    virtual int newFileAvailableWithMetaData(
+        uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/,
+        uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/);
 
     /** @brief CertHandler destructor
      */
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index 40739d6..2abd726 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -122,8 +122,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(notifyObjPath,
-                                                             dumpInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(notifyObjPath, dumpInterface);
         using namespace sdbusplus::xyz::openbmc_project::Dump::server;
         auto method = bus.new_method_call(service.c_str(), notifyObjPath,
                                           dumpInterface, "Notify");
diff --git a/oem/ibm/libpldmresponder/file_io_type_lid.hpp b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
index da95907..cb0e697 100644
--- a/oem/ibm/libpldmresponder/file_io_type_lid.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
@@ -38,8 +38,8 @@
         std::stringstream stream;
         stream << std::hex << fileHandle;
         auto lidName = stream.str() + ".lid";
-        std::string patchDir = permSide ? LID_ALTERNATE_PATCH_DIR
-                                        : LID_RUNNING_PATCH_DIR;
+        std::string patchDir =
+            permSide ? LID_ALTERNATE_PATCH_DIR : LID_RUNNING_PATCH_DIR;
         auto patch = fs::path(patchDir) / lidName;
         if (fs::is_regular_file(patch))
         {
diff --git a/oem/ibm/libpldmresponder/file_io_type_pcie.cpp b/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
index 5aad55a..0c165aa 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
@@ -206,8 +206,8 @@
     };
 
     // memory map the topology file into pldm memory
-    void* fileInMemory = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE,
-                              topologyFd(), 0);
+    void* fileInMemory =
+        mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, topologyFd(), 0);
     if (MAP_FAILED == fileInMemory)
     {
         error("mmap on topology file failed with error {RC}", "RC", -errno);
@@ -354,9 +354,9 @@
              static_cast<int>(slotLocCodeCompartSize)));
         std::string slotLocationCode(slotLocation.begin(), slotLocation.end());
 
-        uint8_t* suffixData = reinterpret_cast<uint8_t*>(slotData) +
-                              slotLocationDataMemberSize +
-                              slotData->slotLocCodesCmnPrtSize;
+        uint8_t* suffixData =
+            reinterpret_cast<uint8_t*>(slotData) + slotLocationDataMemberSize +
+            slotData->slotLocCodesCmnPrtSize;
         if (!suffixData)
         {
             error("slot location suffix data is nullptr");
@@ -390,8 +390,8 @@
 
                 slotSuffixLocationCode = slotSuffLocationCode;
             }
-            std::string slotFullLocationCode = slotLocationCode +
-                                               slotSuffixLocationCode;
+            std::string slotFullLocationCode =
+                slotLocationCode + slotSuffixLocationCode;
             slotFinaLocationCode.push_back(slotFullLocationCode);
 
             // move the pointer to next slot
@@ -399,14 +399,14 @@
         }
 
         // store the information into a map
-        topologyInformation[linkId] =
-            std::make_tuple(linkStateMap[linkStatus], type, linkSpeed,
-                            linkWidth[width], pcieHostBridgeLocationCode,
-                            std::make_pair(localTopPortLocationCode,
-                                           localBottomPortLocationCode),
-                            std::make_pair(remoteTopPortLocationCode,
-                                           remoteBottomPortLocationCode),
-                            slotFinaLocationCode, parentLinkId);
+        topologyInformation[linkId] = std::make_tuple(
+            linkStateMap[linkStatus], type, linkSpeed, linkWidth[width],
+            pcieHostBridgeLocationCode,
+            std::make_pair(localTopPortLocationCode,
+                           localBottomPortLocationCode),
+            std::make_pair(remoteTopPortLocationCode,
+                           remoteBottomPortLocationCode),
+            slotFinaLocationCode, parentLinkId);
 
         // move the pointer to next link
         singleEntryData = reinterpret_cast<struct pcieLinkEntry*>(
@@ -447,8 +447,8 @@
         munmap(fileInMemory, sb.st_size);
     };
 
-    void* fileInMemory = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE,
-                              cableInfoFd(), 0);
+    void* fileInMemory =
+        mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, cableInfoFd(), 0);
 
     if (MAP_FAILED == fileInMemory)
     {
@@ -494,9 +494,9 @@
                 htobe16(cableData->ioEnclosurePortLocationCodeOffset),
             cableData->ioEnclosurePortLocationCodeSize);
 
-        std::string cablePartNum(cableDataPtr +
-                                     htobe16(cableData->cablePartNumberOffset),
-                                 cableData->cablePartNumberSize);
+        std::string cablePartNum(
+            cableDataPtr + htobe16(cableData->cablePartNumberOffset),
+            cableData->cablePartNumberSize);
 
         // cache the data into a map
         cableInformation[cable] = std::make_tuple(
diff --git a/oem/ibm/libpldmresponder/file_io_type_pcie.hpp b/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
index e6a918f..89bd2a6 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
@@ -169,20 +169,18 @@
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
 
-    virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
-                                    uint32_t /*metaDataValue1*/,
-                                    uint32_t /*metaDataValue2*/,
-                                    uint32_t /*metaDataValue3*/,
-                                    uint32_t /*metaDataValue4*/)
+    virtual int fileAckWithMetaData(
+        uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
 
-    virtual int newFileAvailableWithMetaData(uint64_t /*length*/,
-                                             uint32_t /*metaDataValue1*/,
-                                             uint32_t /*metaDataValue2*/,
-                                             uint32_t /*metaDataValue3*/,
-                                             uint32_t /*metaDataValue4*/)
+    virtual int newFileAvailableWithMetaData(
+        uint64_t /*length*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
diff --git a/oem/ibm/libpldmresponder/file_io_type_pel.cpp b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
index d33479f..685bff2 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
@@ -101,8 +101,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                             logInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         auto method = bus.new_method_call(service.c_str(), logObjPath,
                                           logInterface, "GetPEL");
         method.append(fileHandle);
@@ -132,8 +132,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                             logInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         auto method = bus.new_method_call(service.c_str(), logObjPath,
                                           logInterface, "GetPEL");
         method.append(fileHandle);
@@ -229,8 +229,8 @@
     {
         try
         {
-            service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                            logInterface);
+            service =
+                pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         }
         catch (const sdbusplus::exception_t& e)
         {
@@ -308,8 +308,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(logObjPath,
-                                                             logInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(logObjPath, logInterface);
         using namespace sdbusplus::xyz::openbmc_project::Logging::server;
         std::map<std::string, std::string> addlData{};
         auto severity =
diff --git a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
index 9c567e5..f6d9db3 100644
--- a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
@@ -27,8 +27,8 @@
 
     try
     {
-        auto service = pldm::utils::DBusHandler().getService(RawObjectPath,
-                                                             RawInterface);
+        auto service =
+            pldm::utils::DBusHandler().getService(RawObjectPath, RawInterface);
         auto method = bus.new_method_call(service.c_str(), RawObjectPath,
                                           FreedesktopInterface, SetMethod);
         method.append(RawInterface, RawProperty,
diff --git a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
index 4ae11ac..fede599 100644
--- a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
@@ -31,9 +31,9 @@
         auto& bus = pldm::utils::DBusHandler::getBus();
         auto service = pldm::utils::DBusHandler().getService(keywrdObjPath,
                                                              keywrdInterface);
-        auto method = bus.new_method_call(service.c_str(), keywrdObjPath,
-                                          "org.freedesktop.DBus.Properties",
-                                          "Get");
+        auto method =
+            bus.new_method_call(service.c_str(), keywrdObjPath,
+                                "org.freedesktop.DBus.Properties", "Get");
         method.append(keywrdInterface, keywrdPropName);
         auto reply = bus.call(method, dbusTimeout);
         reply.read(keywrd);
diff --git a/oem/ibm/libpldmresponder/file_io_type_vpd.hpp b/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
index 370bb08..b06c6a1 100644
--- a/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
@@ -48,19 +48,17 @@
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
-    virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
-                                    uint32_t /*metaDataValue1*/,
-                                    uint32_t /*metaDataValue2*/,
-                                    uint32_t /*metaDataValue3*/,
-                                    uint32_t /*metaDataValue4*/)
+    virtual int fileAckWithMetaData(
+        uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
-    virtual int newFileAvailableWithMetaData(uint64_t /*length*/,
-                                             uint32_t /*metaDataValue1*/,
-                                             uint32_t /*metaDataValue2*/,
-                                             uint32_t /*metaDataValue3*/,
-                                             uint32_t /*metaDataValue4*/)
+    virtual int newFileAvailableWithMetaData(
+        uint64_t /*length*/, uint32_t /*metaDataValue1*/,
+        uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+        uint32_t /*metaDataValue4*/)
     {
         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
     }
diff --git a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
index 89b9f41..fe53b7a 100644
--- a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
@@ -62,12 +62,12 @@
                     return PLDM_ERROR_INVALID_DATA;
                 }
 
-                auto vendorId = std::format("0x{:04x}",
-                                            htole16(pcieData->vendorId));
-                auto deviceId = std::format("0x{:04x}",
-                                            htole16(pcieData->deviceId));
-                auto revisionId = std::format("0x{:02x}",
-                                              htole16(pcieData->revisionId));
+                auto vendorId =
+                    std::format("0x{:04x}", htole16(pcieData->vendorId));
+                auto deviceId =
+                    std::format("0x{:04x}", htole16(pcieData->deviceId));
+                auto revisionId =
+                    std::format("0x{:02x}", htole16(pcieData->revisionId));
 
                 std::string classCode = "0x";
                 for (const auto& ele : pcieData->classCode)
@@ -77,8 +77,8 @@
 
                 auto subSystemVendorId = std::format(
                     "0x{:04x}", htole16(pcieData->subSystemVendorId));
-                auto subSystemId = std::format("0x{:04x}",
-                                               htole16(pcieData->subSystemId));
+                auto subSystemId =
+                    std::format("0x{:04x}", htole16(pcieData->subSystemId));
 
                 updateDBusProperty(fruRSI, entityAssociationMap, vendorId,
                                    deviceId, revisionId, classCode,
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index 71b6ec3..d3ea1a8 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -172,8 +172,8 @@
 
         runningVersion = std::get<std::vector<std::string>>(paths)[0];
 
-        auto method1 = bus.new_method_call(mapperService, activeObjPath,
-                                           propIntf, "Get");
+        auto method1 =
+            bus.new_method_call(mapperService, activeObjPath, propIntf, "Get");
         method1.append("xyz.openbmc_project.Association", "endpoints");
 
         auto reply1 = bus.call(method1, dbusTimeout);
@@ -201,117 +201,127 @@
             pldm::utils::DBusHandler::getBus(),
             propertiesChanged(runningVersion, redundancyIntf),
             [this](sdbusplus::message_t& msg) {
-        DbusChangedProps props;
-        std::string iface;
-        msg.read(iface, props);
-        processPriorityChangeNotification(props);
-    }));
+                DbusChangedProps props;
+                std::string iface;
+                msg.read(iface, props);
+                processPriorityChangeNotification(props);
+            }));
     fwUpdateMatcher.push_back(std::make_unique<sdbusplus::bus::match_t>(
         pldm::utils::DBusHandler::getBus(),
         "interface='org.freedesktop.DBus.ObjectManager',type='signal',"
         "member='InterfacesAdded',path='/xyz/openbmc_project/software'",
         [this](sdbusplus::message_t& msg) {
-        DBusInterfaceAdded interfaces;
-        sdbusplus::message::object_path path;
-        msg.read(path, interfaces);
+            DBusInterfaceAdded interfaces;
+            sdbusplus::message::object_path path;
+            msg.read(path, interfaces);
 
-        for (auto& interface : interfaces)
-        {
-            if (interface.first == "xyz.openbmc_project.Software.Activation")
+            for (auto& interface : interfaces)
             {
-                auto imageInterface = "xyz.openbmc_project.Software.Activation";
-                auto imageObjPath = path.str.c_str();
-
-                try
+                if (interface.first ==
+                    "xyz.openbmc_project.Software.Activation")
                 {
-                    auto propVal = dBusIntf->getDbusPropertyVariant(
-                        imageObjPath, "Activation", imageInterface);
-                    const auto& imageProp = std::get<std::string>(propVal);
-                    if (imageProp == "xyz.openbmc_project.Software."
-                                     "Activation.Activations.Ready" &&
-                        isCodeUpdateInProgress())
+                    auto imageInterface =
+                        "xyz.openbmc_project.Software.Activation";
+                    auto imageObjPath = path.str.c_str();
+
+                    try
                     {
-                        newImageId = path.str;
-                        if (!imageActivationMatch)
+                        auto propVal = dBusIntf->getDbusPropertyVariant(
+                            imageObjPath, "Activation", imageInterface);
+                        const auto& imageProp = std::get<std::string>(propVal);
+                        if (imageProp == "xyz.openbmc_project.Software."
+                                         "Activation.Activations.Ready" &&
+                            isCodeUpdateInProgress())
                         {
-                            imageActivationMatch =
-                                std::make_unique<sdbusplus::bus::match_t>(
+                            newImageId = path.str;
+                            if (!imageActivationMatch)
+                            {
+                                imageActivationMatch = std::make_unique<
+                                    sdbusplus::bus::match_t>(
                                     pldm::utils::DBusHandler::getBus(),
                                     propertiesChanged(newImageId,
                                                       "xyz.openbmc_project."
                                                       "Software.Activation"),
                                     [this](sdbusplus::message_t& msg) {
-                                DbusChangedProps props;
-                                std::string iface;
-                                msg.read(iface, props);
-                                const auto itr = props.find("Activation");
-                                if (itr != props.end())
-                                {
-                                    PropertyValue value = itr->second;
-                                    auto propVal = std::get<std::string>(value);
-                                    if (propVal ==
-                                        "xyz.openbmc_project.Software."
-                                        "Activation.Activations.Active")
-                                    {
-                                        CodeUpdateState state =
-                                            CodeUpdateState::END;
-                                        setCodeUpdateProgress(false);
-                                        auto sensorId =
-                                            getFirmwareUpdateSensor();
-                                        sendStateSensorEvent(
-                                            sensorId, PLDM_STATE_SENSOR_STATE,
-                                            0, uint8_t(state),
-                                            uint8_t(CodeUpdateState::START));
-                                        newImageId.clear();
-                                    }
-                                    else if (propVal == "xyz.openbmc_project."
-                                                        "Software.Activation."
-                                                        "Activations.Failed" ||
-                                             propVal == "xyz.openbmc_"
-                                                        "project.Software."
-                                                        "Activation."
-                                                        "Activations."
-                                                        "Invalid")
-                                    {
-                                        CodeUpdateState state =
-                                            CodeUpdateState::FAIL;
-                                        setCodeUpdateProgress(false);
-                                        auto sensorId =
-                                            getFirmwareUpdateSensor();
-                                        sendStateSensorEvent(
-                                            sensorId, PLDM_STATE_SENSOR_STATE,
-                                            0, uint8_t(state),
-                                            uint8_t(CodeUpdateState::START));
-                                        newImageId.clear();
-                                    }
-                                }
-                            });
+                                        DbusChangedProps props;
+                                        std::string iface;
+                                        msg.read(iface, props);
+                                        const auto itr =
+                                            props.find("Activation");
+                                        if (itr != props.end())
+                                        {
+                                            PropertyValue value = itr->second;
+                                            auto propVal =
+                                                std::get<std::string>(value);
+                                            if (propVal ==
+                                                "xyz.openbmc_project.Software."
+                                                "Activation.Activations.Active")
+                                            {
+                                                CodeUpdateState state =
+                                                    CodeUpdateState::END;
+                                                setCodeUpdateProgress(false);
+                                                auto sensorId =
+                                                    getFirmwareUpdateSensor();
+                                                sendStateSensorEvent(
+                                                    sensorId,
+                                                    PLDM_STATE_SENSOR_STATE, 0,
+                                                    uint8_t(state),
+                                                    uint8_t(CodeUpdateState::
+                                                                START));
+                                                newImageId.clear();
+                                            }
+                                            else if (propVal ==
+                                                         "xyz.openbmc_project."
+                                                         "Software.Activation."
+                                                         "Activations.Failed" ||
+                                                     propVal ==
+                                                         "xyz.openbmc_"
+                                                         "project.Software."
+                                                         "Activation."
+                                                         "Activations."
+                                                         "Invalid")
+                                            {
+                                                CodeUpdateState state =
+                                                    CodeUpdateState::FAIL;
+                                                setCodeUpdateProgress(false);
+                                                auto sensorId =
+                                                    getFirmwareUpdateSensor();
+                                                sendStateSensorEvent(
+                                                    sensorId,
+                                                    PLDM_STATE_SENSOR_STATE, 0,
+                                                    uint8_t(state),
+                                                    uint8_t(CodeUpdateState::
+                                                                START));
+                                                newImageId.clear();
+                                            }
+                                        }
+                                    });
+                            }
+                            auto rc = setRequestedActivation();
+                            if (rc != PLDM_SUCCESS)
+                            {
+                                error("Could not set Requested Activation");
+                                CodeUpdateState state = CodeUpdateState::FAIL;
+                                setCodeUpdateProgress(false);
+                                auto sensorId = getFirmwareUpdateSensor();
+                                sendStateSensorEvent(
+                                    sensorId, PLDM_STATE_SENSOR_STATE, 0,
+                                    uint8_t(state),
+                                    uint8_t(CodeUpdateState::START));
+                            }
+                            break;
                         }
-                        auto rc = setRequestedActivation();
-                        if (rc != PLDM_SUCCESS)
-                        {
-                            error("Could not set Requested Activation");
-                            CodeUpdateState state = CodeUpdateState::FAIL;
-                            setCodeUpdateProgress(false);
-                            auto sensorId = getFirmwareUpdateSensor();
-                            sendStateSensorEvent(
-                                sensorId, PLDM_STATE_SENSOR_STATE, 0,
-                                uint8_t(state),
-                                uint8_t(CodeUpdateState::START));
-                        }
-                        break;
+                    }
+                    catch (const sdbusplus::exception_t& e)
+                    {
+                        error(
+                            "Failed to get activation status for interface '{INTERFACE}' and object path '{PATH}', error - {ERROR}",
+                            "ERROR", e, "INTERFACE", imageInterface, "PATH",
+                            imageObjPath);
                     }
                 }
-                catch (const sdbusplus::exception_t& e)
-                {
-                    error(
-                        "Failed to get activation status for interface '{INTERFACE}' and object path '{PATH}', error - {ERROR}",
-                        "ERROR", e, "INTERFACE", imageInterface, "PATH",
-                        imageObjPath);
-                }
             }
-        }
-    }));
+        }));
 }
 
 void CodeUpdate::processPriorityChangeNotification(
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index b7c437a..6a39328 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -312,8 +312,9 @@
         }
         std::cout << tempStream.str() << std::endl;
     }
-    auto oemPlatformEventMessageResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto oemPlatformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+                                                     const pldm_msg* response,
+                                                     size_t respMsgLen) {
         uint8_t completionCode{};
         uint8_t status{};
         auto rc = decode_platform_event_message_resp(response, respMsgLen,
@@ -369,9 +370,9 @@
     eventClass->event_state = eventState;
     eventClass->previous_event_state = prevEventState;
     auto instanceId = instanceIdDb.next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
-                                    sensorEventDataVec.size());
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+        sensorEventDataVec.size());
     auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
                              instanceId);
     if (rc != PLDM_SUCCESS)
@@ -477,51 +478,52 @@
         propertiesChanged("/xyz/openbmc_project/state/chassis0",
                           "xyz.openbmc_project.State.Chassis"),
         [this](sdbusplus::message_t& msg) {
-        DbusChangedProps props{};
-        std::string intf;
-        msg.read(intf, props);
-        const auto itr = props.find("CurrentPowerState");
-        if (itr != props.end())
-        {
-            PropertyValue value = itr->second;
-            auto propVal = std::get<std::string>(value);
-            if (propVal == "xyz.openbmc_project.State.Chassis.PowerState.Off")
+            DbusChangedProps props{};
+            std::string intf;
+            msg.read(intf, props);
+            const auto itr = props.find("CurrentPowerState");
+            if (itr != props.end())
             {
-                pldm::utils::DBusMapping dbusMapping{
-                    "/xyz/openbmc_project/control/host0/"
-                    "power_restore_policy/one_time",
-                    "xyz.openbmc_project.Control.Power.RestorePolicy",
-                    "PowerRestorePolicy", "string"};
-                value = "xyz.openbmc_project.Control.Power.RestorePolicy."
-                        "Policy.AlwaysOn";
-                try
+                PropertyValue value = itr->second;
+                auto propVal = std::get<std::string>(value);
+                if (propVal ==
+                    "xyz.openbmc_project.State.Chassis.PowerState.Off")
                 {
-                    dBusIntf->setDbusProperty(dbusMapping, value);
-                }
-                catch (const std::exception& e)
-                {
-                    error(
-                        "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
-                        "ERROR", e);
-                }
-                dbusMapping = pldm::utils::DBusMapping{
-                    "/xyz/openbmc_project/state/bmc0",
-                    "xyz.openbmc_project.State.BMC", "RequestedBMCTransition",
-                    "string"};
-                value = "xyz.openbmc_project.State.BMC.Transition.Reboot";
-                try
-                {
-                    dBusIntf->setDbusProperty(dbusMapping, value);
-                }
-                catch (const std::exception& e)
-                {
-                    error(
-                        "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
-                        "ERROR", e);
+                    pldm::utils::DBusMapping dbusMapping{
+                        "/xyz/openbmc_project/control/host0/"
+                        "power_restore_policy/one_time",
+                        "xyz.openbmc_project.Control.Power.RestorePolicy",
+                        "PowerRestorePolicy", "string"};
+                    value = "xyz.openbmc_project.Control.Power.RestorePolicy."
+                            "Policy.AlwaysOn";
+                    try
+                    {
+                        dBusIntf->setDbusProperty(dbusMapping, value);
+                    }
+                    catch (const std::exception& e)
+                    {
+                        error(
+                            "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
+                            "ERROR", e);
+                    }
+                    dbusMapping = pldm::utils::DBusMapping{
+                        "/xyz/openbmc_project/state/bmc0",
+                        "xyz.openbmc_project.State.BMC",
+                        "RequestedBMCTransition", "string"};
+                    value = "xyz.openbmc_project.State.BMC.Transition.Reboot";
+                    try
+                    {
+                        dBusIntf->setDbusProperty(dbusMapping, value);
+                    }
+                    catch (const std::exception& e)
+                    {
+                        error(
+                            "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
+                            "ERROR", e);
+                    }
                 }
             }
-        }
-    });
+        });
 }
 
 void pldm::responder::oem_ibm_platform::Handler::checkAndDisableWatchDog()
@@ -587,9 +589,9 @@
 void pldm::responder::oem_ibm_platform::Handler::disableWatchDogTimer()
 {
     setEventReceiverCnt = 0;
-    pldm::utils::DBusMapping dbusMapping{"/xyz/openbmc_project/watchdog/host0",
-                                         "xyz.openbmc_project.State.Watchdog",
-                                         "Enabled", "bool"};
+    pldm::utils::DBusMapping dbusMapping{
+        "/xyz/openbmc_project/watchdog/host0",
+        "xyz.openbmc_project.State.Watchdog", "Enabled", "bool"};
     bool wdStatus = watchDogRunning();
 
     if (!wdStatus)
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index 8c164da..b5749c3 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -47,10 +47,9 @@
             uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
             sdeventplus::Event& event,
             pldm::requester::Handler<pldm::requester::Request>* handler) :
-        oem_platform::Handler(dBusIntf),
-        codeUpdate(codeUpdate), platformHandler(nullptr), mctp_fd(mctp_fd),
-        mctp_eid(mctp_eid), instanceIdDb(instanceIdDb), event(event),
-        handler(handler),
+        oem_platform::Handler(dBusIntf), codeUpdate(codeUpdate),
+        platformHandler(nullptr), mctp_fd(mctp_fd), mctp_eid(mctp_eid),
+        instanceIdDb(instanceIdDb), event(event), handler(handler),
         timer(event, std::bind(std::mem_fn(&Handler::setSurvTimer), this,
                                HYPERVISOR_TID, false)),
         hostTransitioningToOff(true)
@@ -64,83 +63,84 @@
             propertiesChanged("/xyz/openbmc_project/state/host0",
                               "xyz.openbmc_project.State.Host"),
             [this](sdbusplus::message_t& msg) {
-            pldm::utils::DbusChangedProps props{};
-            std::string intf;
-            msg.read(intf, props);
-            const auto itr = props.find("CurrentHostState");
-            if (itr != props.end())
-            {
-                pldm::utils::PropertyValue value = itr->second;
-                auto propVal = std::get<std::string>(value);
-                if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
+                pldm::utils::DbusChangedProps props{};
+                std::string intf;
+                msg.read(intf, props);
+                const auto itr = props.find("CurrentHostState");
+                if (itr != props.end())
                 {
-                    hostOff = true;
-                    setEventReceiverCnt = 0;
-                    disableWatchDogTimer();
-                    startStopTimer(false);
+                    pldm::utils::PropertyValue value = itr->second;
+                    auto propVal = std::get<std::string>(value);
+                    if (propVal ==
+                        "xyz.openbmc_project.State.Host.HostState.Off")
+                    {
+                        hostOff = true;
+                        setEventReceiverCnt = 0;
+                        disableWatchDogTimer();
+                        startStopTimer(false);
+                    }
+                    else if (propVal ==
+                             "xyz.openbmc_project.State.Host.HostState.Running")
+                    {
+                        hostOff = false;
+                        hostTransitioningToOff = false;
+                    }
+                    else if (
+                        propVal ==
+                        "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
+                    {
+                        hostTransitioningToOff = true;
+                    }
                 }
-                else if (propVal ==
-                         "xyz.openbmc_project.State.Host.HostState.Running")
-                {
-                    hostOff = false;
-                    hostTransitioningToOff = false;
-                }
-                else if (
-                    propVal ==
-                    "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
-                {
-                    hostTransitioningToOff = true;
-                }
-            }
-        });
+            });
 
         powerStateOffMatch = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
             propertiesChanged("/xyz/openbmc_project/state/chassis0",
                               "xyz.openbmc_project.State.Chassis"),
             [](sdbusplus::message_t& msg) {
-            pldm::utils::DbusChangedProps props{};
-            std::string intf;
-            msg.read(intf, props);
-            const auto itr = props.find("CurrentPowerState");
-            if (itr != props.end())
-            {
-                pldm::utils::PropertyValue value = itr->second;
-                auto propVal = std::get<std::string>(value);
-                if (propVal ==
-                    "xyz.openbmc_project.State.Chassis.PowerState.Off")
+                pldm::utils::DbusChangedProps props{};
+                std::string intf;
+                msg.read(intf, props);
+                const auto itr = props.find("CurrentPowerState");
+                if (itr != props.end())
                 {
-                    static constexpr auto searchpath =
-                        "/xyz/openbmc_project/inventory/system/chassis/motherboard";
-                    int depth = 0;
-                    std::vector<std::string> powerInterface = {
-                        "xyz.openbmc_project.State.Decorator.PowerState"};
-                    pldm::utils::GetSubTreeResponse response =
-                        pldm::utils::DBusHandler().getSubtree(searchpath, depth,
-                                                              powerInterface);
-                    for (const auto& [objPath, serviceMap] : response)
+                    pldm::utils::PropertyValue value = itr->second;
+                    auto propVal = std::get<std::string>(value);
+                    if (propVal ==
+                        "xyz.openbmc_project.State.Chassis.PowerState.Off")
                     {
-                        pldm::utils::DBusMapping dbusMapping{
-                            objPath,
-                            "xyz.openbmc_project.State.Decorator.PowerState",
-                            "PowerState", "string"};
-                        value =
-                            "xyz.openbmc_project.State.Decorator.PowerState.State.Off";
-                        try
+                        static constexpr auto searchpath =
+                            "/xyz/openbmc_project/inventory/system/chassis/motherboard";
+                        int depth = 0;
+                        std::vector<std::string> powerInterface = {
+                            "xyz.openbmc_project.State.Decorator.PowerState"};
+                        pldm::utils::GetSubTreeResponse response =
+                            pldm::utils::DBusHandler().getSubtree(
+                                searchpath, depth, powerInterface);
+                        for (const auto& [objPath, serviceMap] : response)
                         {
-                            pldm::utils::DBusHandler().setDbusProperty(
-                                dbusMapping, value);
-                        }
-                        catch (const std::exception& e)
-                        {
-                            error(
-                                "Unable to set the slot power state to Off error - {ERROR}",
-                                "ERROR", e);
+                            pldm::utils::DBusMapping dbusMapping{
+                                objPath,
+                                "xyz.openbmc_project.State.Decorator.PowerState",
+                                "PowerState", "string"};
+                            value =
+                                "xyz.openbmc_project.State.Decorator.PowerState.State.Off";
+                            try
+                            {
+                                pldm::utils::DBusHandler().setDbusProperty(
+                                    dbusMapping, value);
+                            }
+                            catch (const std::exception& e)
+                            {
+                                error(
+                                    "Unable to set the slot power state to Off error - {ERROR}",
+                                    "ERROR", e);
+                            }
                         }
                     }
                 }
-            }
-        });
+            });
     }
 
     int getOemStateSensorReadingsHandler(
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
index da9e4d3..47c1e53 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
@@ -83,8 +83,9 @@
         return rc;
     }
 
-    auto platformEventMessageResponseHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+                                                  const pldm_msg* response,
+                                                  size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error("Failed to receive response for platform event message");
diff --git a/oem/ibm/libpldmresponder/utils.cpp b/oem/ibm/libpldmresponder/utils.cpp
index 59d418c..9fec1a1 100644
--- a/oem/ibm/libpldmresponder/utils.cpp
+++ b/oem/ibm/libpldmresponder/utils.cpp
@@ -30,8 +30,8 @@
     struct sockaddr_un addr;
     memset(&addr, 0, sizeof(addr));
     addr.sun_family = AF_UNIX;
-    size_t interfaceLength = strnlen(socketInterface.c_str(),
-                                     sizeof(addr.sun_path));
+    size_t interfaceLength =
+        strnlen(socketInterface.c_str(), sizeof(addr.sun_path));
     if (interfaceLength == sizeof(addr.sun_path))
     {
         error("Setup unix socket path '{PATH}' is too long '{LENGTH}'", "PATH",
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index 30c344d..47ddf2c 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -26,9 +26,8 @@
     int /* mctp_fd */, uint8_t mctp_eid, pldm::InstanceIdDb* instanceIdDb,
     sdbusplus::message::object_path resDumpCurrentObjPath,
     pldm::requester::Handler<pldm::requester::Request>* handler) :
-    mctp_eid(mctp_eid),
-    instanceIdDb(instanceIdDb), resDumpCurrentObjPath(resDumpCurrentObjPath),
-    handler(handler)
+    mctp_eid(mctp_eid), instanceIdDb(instanceIdDb),
+    resDumpCurrentObjPath(resDumpCurrentObjPath), handler(handler)
 {}
 
 void DbusToFileHandler::sendNewFileAvailableCmd(uint64_t fileSize)
@@ -42,15 +41,15 @@
         return;
     }
     auto instanceId = instanceIdDb->next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_NEW_FILE_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_NEW_FILE_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     // Need to revisit this logic at the time of multiple resource dump support
     uint32_t fileHandle = 1;
 
-    auto rc = encode_new_file_req(instanceId,
-                                  PLDM_FILE_TYPE_RESOURCE_DUMP_PARMS,
-                                  fileHandle, fileSize, request);
+    auto rc =
+        encode_new_file_req(instanceId, PLDM_FILE_TYPE_RESOURCE_DUMP_PARMS,
+                            fileHandle, fileSize, request);
     if (rc != PLDM_SUCCESS)
     {
         instanceIdDb->free(mctp_eid, instanceId);
@@ -243,9 +242,8 @@
                                PLDM_FILE_TYPE_CERT_SIGNING_REQUEST);
 }
 
-void DbusToFileHandler::newFileAvailableSendToHost(const uint32_t fileSize,
-                                                   const uint32_t fileHandle,
-                                                   const uint16_t type)
+void DbusToFileHandler::newFileAvailableSendToHost(
+    const uint32_t fileSize, const uint32_t fileHandle, const uint16_t type)
 {
     if (instanceIdDb == NULL)
     {
@@ -255,12 +253,12 @@
         return;
     }
     auto instanceId = instanceIdDb->next(mctp_eid);
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_NEW_FILE_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_NEW_FILE_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
-    auto rc = encode_new_file_req(instanceId, type, fileHandle, fileSize,
-                                  request);
+    auto rc =
+        encode_new_file_req(instanceId, type, fileHandle, fileSize, request);
     if (rc != PLDM_SUCCESS)
     {
         instanceIdDb->free(mctp_eid, instanceId);
@@ -268,8 +266,9 @@
               "RC", rc);
         return;
     }
-    auto newFileAvailableRespHandler =
-        [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+    auto newFileAvailableRespHandler = [](mctp_eid_t /*eid*/,
+                                          const pldm_msg* response,
+                                          size_t respMsgLen) {
         if (response == nullptr || !respMsgLen)
         {
             error(
diff --git a/oem/ibm/test/libpldmresponder_fileio_test.cpp b/oem/ibm/test/libpldmresponder_fileio_test.cpp
index 2ca1016..36c6e74 100644
--- a/oem/ibm/test/libpldmresponder_fileio_test.cpp
+++ b/oem/ibm/test/libpldmresponder_fileio_test.cpp
@@ -620,8 +620,8 @@
         requestMsg{};
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_read_file_req*>(requestMsg.data() +
-                                                         sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_read_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     request->file_handle = fileHandle;
     request->offset = offset;
@@ -668,8 +668,8 @@
         requestMsg{};
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_read_file_req*>(requestMsg.data() +
-                                                         sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_read_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     request->file_handle = fileHandle;
     request->offset = offset;
@@ -706,8 +706,8 @@
     stream.read(buffer.data(), (fileSize - request->offset));
 
     responseMsg = handler.readFile(requestMsgPtr, payload_length);
-    response = reinterpret_cast<pldm_read_file_resp*>(responseMsg.data() +
-                                                      sizeof(pldm_msg_hdr));
+    response = reinterpret_cast<pldm_read_file_resp*>(
+        responseMsg.data() + sizeof(pldm_msg_hdr));
     ASSERT_EQ(response->completion_code, PLDM_SUCCESS);
     ASSERT_EQ(response->length, (fileSize - request->offset));
     ASSERT_EQ(0, memcmp(response->file_data, buffer.data(),
@@ -724,12 +724,12 @@
     uint8_t host_eid = 0;
     int hostSocketFd = 0;
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_WRITE_FILE_REQ_BYTES + length);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES + length);
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_write_file_req*>(requestMsg.data() +
-                                                          sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_write_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     using namespace pldm::filetable;
     // Initialise the file table with 2 valid file handles 0 & 1.
@@ -773,12 +773,12 @@
     uint8_t host_eid = 0;
     int hostSocketFd = 0;
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_WRITE_FILE_REQ_BYTES + length);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES + length);
     auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
-    auto request = reinterpret_cast<pldm_write_file_req*>(requestMsg.data() +
-                                                          sizeof(pldm_msg_hdr));
+    auto request = reinterpret_cast<pldm_write_file_req*>(
+        requestMsg.data() + sizeof(pldm_msg_hdr));
 
     using namespace pldm::filetable;
     // Initialise the file table with 2 valid file handles 0 & 1.
diff --git a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
index 21b6914..a8199f5 100644
--- a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
+++ b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
@@ -159,12 +159,12 @@
     opStateSensorEventData->present_op_state = uint8_t(CodeUpdateState::START);
     opStateSensorEventData->previous_op_state = uint8_t(CodeUpdateState::END);
 
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
-                                    sensorEventDataVec.size());
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+        sensorEventDataVec.size());
 
-    auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
-                             0x1);
+    auto rc =
+        encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg, 0x1);
 
     EXPECT_EQ(rc, PLDM_SUCCESS);
 }
@@ -174,8 +174,8 @@
     std::vector<uint8_t> requestMsg;
     std::vector<uint8_t> sensorEventDataVec{};
 
-    auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
-                             0x1);
+    auto rc =
+        encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg, 0x1);
 
     EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
 }
@@ -210,9 +210,9 @@
     std::unique_ptr<CodeUpdate> mockCodeUpdate =
         std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
     std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
-        std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
-                                                 mockCodeUpdate.get(), 0x1, 0x9,
-                                                 instanceIdDb, event);
+        std::make_unique<MockOemPlatformHandler>(
+            mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+            event);
     Repo inRepo(inPDRRepo);
 
     mockoemPlatformHandler->buildOEMPDR(inRepo);
@@ -316,9 +316,9 @@
     std::unique_ptr<CodeUpdate> mockCodeUpdate =
         std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
     std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
-        std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
-                                                 mockCodeUpdate.get(), 0x1, 0x9,
-                                                 instanceIdDb, event);
+        std::make_unique<MockOemPlatformHandler>(
+            mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+            event);
     Repo inRepo(inPDRRepo);
     mockoemPlatformHandler->buildOEMPDR(inRepo);
     ASSERT_EQ(inRepo.empty(), false);
@@ -415,9 +415,9 @@
     std::unique_ptr<CodeUpdate> mockCodeUpdate =
         std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
     std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
-        std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
-                                                 mockCodeUpdate.get(), 0x1, 0x9,
-                                                 instanceIdDb, event);
+        std::make_unique<MockOemPlatformHandler>(
+            mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+            event);
     std::string dbuspath = "/inventory/system1/chassis1/motherboard1/dcm0";
     mockoemPlatformHandler->updateOemDbusPaths(dbuspath);
     EXPECT_EQ(dbuspath, "/inventory/system/chassis/motherboard/dcm0");
@@ -504,8 +504,8 @@
     std::vector<std::string> cpuInterface = {"xyz.openbmc_project.Foo.Bar"};
     auto oemMockedUtils =
         std::make_unique<MockOemUtilsHandler>(&mockedDbusUtils);
-    int coreCount = oemMockedUtils->setCoreCount(entityAssociations,
-                                                 entityMaps);
+    int coreCount =
+        oemMockedUtils->setCoreCount(entityAssociations, entityMaps);
     EXPECT_EQ(coreCount, 2);
     pldm_entity_association_tree_destroy(tree);
 }
diff --git a/platform-mc/numeric_sensor.cpp b/platform-mc/numeric_sensor.cpp
index be7ece3..ad563fd 100644
--- a/platform-mc/numeric_sensor.cpp
+++ b/platform-mc/numeric_sensor.cpp
@@ -19,8 +19,7 @@
                              std::shared_ptr<pldm_numeric_sensor_value_pdr> pdr,
                              std::string& sensorName,
                              std::string& associationPath) :
-    tid(tid),
-    sensorName(sensorName), isPriority(false)
+    tid(tid), sensorName(sensorName), isPriority(false)
 {
     if (!pdr)
     {
@@ -294,8 +293,8 @@
 
     try
     {
-        availabilityIntf = std::make_unique<AvailabilityIntf>(bus,
-                                                              path.c_str());
+        availabilityIntf =
+            std::make_unique<AvailabilityIntf>(bus, path.c_str());
     }
     catch (const sdbusplus::exception_t& e)
     {
@@ -363,8 +362,7 @@
     const pldm_tid_t tid, const bool sensorDisabled,
     std::shared_ptr<pldm_compact_numeric_sensor_pdr> pdr,
     std::string& sensorName, std::string& associationPath) :
-    tid(tid),
-    sensorName(sensorName), isPriority(false)
+    tid(tid), sensorName(sensorName), isPriority(false)
 {
     if (!pdr)
     {
@@ -504,8 +502,8 @@
 
     try
     {
-        availabilityIntf = std::make_unique<AvailabilityIntf>(bus,
-                                                              path.c_str());
+        availabilityIntf =
+            std::make_unique<AvailabilityIntf>(bus, path.c_str());
     }
     catch (const sdbusplus::exception_t& e)
     {
diff --git a/platform-mc/numeric_sensor.hpp b/platform-mc/numeric_sensor.hpp
index 315787d..770a286 100644
--- a/platform-mc/numeric_sensor.hpp
+++ b/platform-mc/numeric_sensor.hpp
@@ -52,7 +52,7 @@
                   std::shared_ptr<pldm_compact_numeric_sensor_pdr> pdr,
                   std::string& sensorName, std::string& associationPath);
 
-    ~NumericSensor(){};
+    ~NumericSensor() {};
 
     /** @brief ConversionFormula is used to convert raw value to the unit
      * specified in PDR
diff --git a/platform-mc/platform_manager.cpp b/platform-mc/platform_manager.cpp
index 21e4bcf..f6ffcc5 100644
--- a/platform-mc/platform_manager.cpp
+++ b/platform-mc/platform_manager.cpp
@@ -53,9 +53,9 @@
     if (terminus->doesSupportCommand(PLDM_PLATFORM,
                                      PLDM_GET_PDR_REPOSITORY_INFO))
     {
-        auto rc = co_await getPDRRepositoryInfo(tid, repositoryState,
-                                                recordCount, repositorySize,
-                                                largestRecordSize);
+        auto rc =
+            co_await getPDRRepositoryInfo(tid, repositoryState, recordCount,
+                                          repositorySize, largestRecordSize);
         if (rc)
         {
             lg2::error(
@@ -64,8 +64,8 @@
         }
         else
         {
-            recordCount = std::min(recordCount + 1,
-                                   std::numeric_limits<uint32_t>::max());
+            recordCount =
+                std::min(recordCount + 1, std::numeric_limits<uint32_t>::max());
             largestRecordSize = std::min(largestRecordSize + 1,
                                          std::numeric_limits<uint32_t>::max());
         }
@@ -90,10 +90,10 @@
 
     do
     {
-        auto rc = co_await getPDR(tid, recordHndl, 0, PLDM_GET_FIRSTPART,
-                                  recvBufSize, 0, nextRecordHndl,
-                                  nextDataTransferHndl, transferFlag,
-                                  responseCnt, recvBuf, transferCrc);
+        auto rc =
+            co_await getPDR(tid, recordHndl, 0, PLDM_GET_FIRSTPART, recvBufSize,
+                            0, nextRecordHndl, nextDataTransferHndl,
+                            transferFlag, responseCnt, recvBuf, transferCrc);
 
         if (rc)
         {
@@ -121,11 +121,11 @@
                                              recvBuf.begin() + responseCnt);
             do
             {
-                rc = co_await getPDR(tid, recordHndl, nextDataTransferHndl,
-                                     PLDM_GET_NEXTPART, recvBufSize,
-                                     recordChgNum, nextRecordHndl,
-                                     nextDataTransferHndl, transferFlag,
-                                     responseCnt, recvBuf, transferCrc);
+                rc = co_await getPDR(
+                    tid, recordHndl, nextDataTransferHndl, PLDM_GET_NEXTPART,
+                    recvBufSize, recordChgNum, nextRecordHndl,
+                    nextDataTransferHndl, transferFlag, responseCnt, recvBuf,
+                    transferCrc);
                 if (rc)
                 {
                     lg2::error(
diff --git a/platform-mc/platform_manager.hpp b/platform-mc/platform_manager.hpp
index 8187ca1..8d6e7b4 100644
--- a/platform-mc/platform_manager.hpp
+++ b/platform-mc/platform_manager.hpp
@@ -31,8 +31,7 @@
 
     explicit PlatformManager(TerminusManager& terminusManager,
                              TerminiMapper& termini) :
-        terminusManager(terminusManager),
-        termini(termini)
+        terminusManager(terminusManager), termini(termini)
     {}
 
     /** @brief Initialize terminus which supports PLDM Type 2
@@ -83,11 +82,9 @@
      * *
      *  @return coroutine return_value - PLDM completion code
      */
-    exec::task<int> getPDRRepositoryInfo(const pldm_tid_t tid,
-                                         uint8_t& repositoryState,
-                                         uint32_t& recordCount,
-                                         uint32_t& repositorySize,
-                                         uint32_t& largestRecordSize);
+    exec::task<int> getPDRRepositoryInfo(
+        const pldm_tid_t tid, uint8_t& repositoryState, uint32_t& recordCount,
+        uint32_t& repositorySize, uint32_t& largestRecordSize);
 
     /** reference of TerminusManager for sending PLDM request to terminus*/
     TerminusManager& terminusManager;
diff --git a/platform-mc/terminus.cpp b/platform-mc/terminus.cpp
index 004158a..7b94bda 100644
--- a/platform-mc/terminus.cpp
+++ b/platform-mc/terminus.cpp
@@ -58,16 +58,17 @@
     auto it = std::find_if(
         entityAuxiliaryNamesTbl.begin(), entityAuxiliaryNamesTbl.end(),
         [](const std::shared_ptr<EntityAuxiliaryNames>& entityAuxiliaryNames) {
-        const auto& [key, entityNames] = *entityAuxiliaryNames;
-        /**
-         * There is only one Overal system container entity in one terminus.
-         * The entity auxiliary name PDR of that terminus with the that type of
-         * containerID will include terminus name.
-         **/
-        return (entityAuxiliaryNames &&
+            const auto& [key, entityNames] = *entityAuxiliaryNames;
+            /**
+             * There is only one Overal system container entity in one terminus.
+             * The entity auxiliary name PDR of that terminus with the that type
+             *of containerID will include terminus name.
+             **/
+            return (
+                entityAuxiliaryNames &&
                 key.containerId == PLDM_PLATFORM_ENTITY_SYSTEM_CONTAINER_ID &&
                 entityNames.size());
-    });
+        });
 
     if (it != entityAuxiliaryNamesTbl.end())
     {
@@ -234,9 +235,10 @@
         sensorAuxiliaryNamesTbl.begin(), sensorAuxiliaryNamesTbl.end(),
         [id](
             const std::shared_ptr<SensorAuxiliaryNames>& sensorAuxiliaryNames) {
-        const auto& [sensorId, sensorCnt, sensorNames] = *sensorAuxiliaryNames;
-        return sensorId == id;
-    });
+            const auto& [sensorId, sensorCnt, sensorNames] =
+                *sensorAuxiliaryNames;
+            return sensorId == id;
+        });
 
     if (it != sensorAuxiliaryNamesTbl.end())
     {
@@ -307,8 +309,8 @@
                         PLDM_PDR_ENTITY_AUXILIARY_NAME_PDR_MIN_LENGTH;
     auto names_size = pdrData.size() - names_offset;
 
-    size_t decodedPdrSize = sizeof(struct pldm_entity_auxiliary_names_pdr) +
-                            names_size;
+    size_t decodedPdrSize =
+        sizeof(struct pldm_entity_auxiliary_names_pdr) + names_size;
     auto vPdr = std::vector<char>(decodedPdrSize);
     auto decodedPdr =
         reinterpret_cast<struct pldm_entity_auxiliary_names_pdr*>(vPdr.data());
@@ -387,16 +389,16 @@
             "TID", tid);
         return;
     }
-    std::string sensorName = terminusName + "_" + "Sensor_" +
-                             std::to_string(pdr->sensor_id);
+    std::string sensorName =
+        terminusName + "_" + "Sensor_" + std::to_string(pdr->sensor_id);
 
     if (pdr->sensor_auxiliary_names_pdr)
     {
         auto sensorAuxiliaryNames = getSensorAuxiliaryNames(sensorId);
         if (sensorAuxiliaryNames)
         {
-            const auto& [sensorId, sensorCnt,
-                         sensorNames] = *sensorAuxiliaryNames;
+            const auto& [sensorId, sensorCnt, sensorNames] =
+                *sensorAuxiliaryNames;
             if (sensorCnt == 1)
             {
                 for (const auto& [languageTag, name] : sensorNames[0])
@@ -500,8 +502,8 @@
             "TID", tid);
         return;
     }
-    std::string sensorName = terminusName + "_" + "Sensor_" +
-                             std::to_string(pdr->sensor_id);
+    std::string sensorName =
+        terminusName + "_" + "Sensor_" + std::to_string(pdr->sensor_id);
 
     auto sensorAuxiliaryNames = getSensorAuxiliaryNames(sensorId);
     if (sensorAuxiliaryNames)
diff --git a/platform-mc/terminus.hpp b/platform-mc/terminus.hpp
index 8a39b2e..a819ad7 100644
--- a/platform-mc/terminus.hpp
+++ b/platform-mc/terminus.hpp
@@ -93,8 +93,8 @@
      */
     bool setSupportedCommands(const std::vector<uint8_t>& cmds)
     {
-        const size_t expectedSize = PLDM_MAX_TYPES *
-                                    (PLDM_MAX_CMDS_PER_TYPE / 8);
+        const size_t expectedSize =
+            PLDM_MAX_TYPES * (PLDM_MAX_CMDS_PER_TYPE / 8);
         if (cmds.empty() || cmds.size() != expectedSize)
         {
             lg2::error(
diff --git a/platform-mc/terminus_manager.cpp b/platform-mc/terminus_manager.cpp
index 93fdb09..7567d89 100644
--- a/platform-mc/terminus_manager.cpp
+++ b/platform-mc/terminus_manager.cpp
@@ -42,9 +42,9 @@
 
     auto mctpInfoTableIt = std::find_if(
         mctpInfoTable.begin(), mctpInfoTable.end(), [&mctpInfo](auto& v) {
-        return (std::get<0>(v.second) == std::get<0>(mctpInfo)) &&
-               (std::get<3>(v.second) == std::get<3>(mctpInfo));
-    });
+            return (std::get<0>(v.second) == std::get<0>(mctpInfo)) &&
+                   (std::get<3>(v.second) == std::get<3>(mctpInfo));
+        });
     if (mctpInfoTableIt == mctpInfoTable.end())
     {
         return std::nullopt;
@@ -86,9 +86,9 @@
 
     auto mctpInfoTableIt = std::find_if(
         mctpInfoTable.begin(), mctpInfoTable.end(), [&mctpInfo](auto& v) {
-        return (std::get<0>(v.second) == std::get<0>(mctpInfo)) &&
-               (std::get<3>(v.second) == std::get<3>(mctpInfo));
-    });
+            return (std::get<0>(v.second) == std::get<0>(mctpInfo)) &&
+                   (std::get<3>(v.second) == std::get<3>(mctpInfo));
+        });
     if (mctpInfoTableIt != mctpInfoTable.end())
     {
         return mctpInfoTableIt->first;
@@ -147,14 +147,15 @@
 TerminiMapper::iterator
     TerminusManager::findTerminusPtr(const MctpInfo& mctpInfo)
 {
-    auto foundIter = std::find_if(termini.begin(), termini.end(),
-                                  [&](const auto& terminusPair) {
-        auto terminusMctpInfo = toMctpInfo(terminusPair.first);
-        return (
-            terminusMctpInfo &&
-            (std::get<0>(terminusMctpInfo.value()) == std::get<0>(mctpInfo)) &&
-            (std::get<3>(terminusMctpInfo.value()) == std::get<3>(mctpInfo)));
-    });
+    auto foundIter = std::find_if(
+        termini.begin(), termini.end(), [&](const auto& terminusPair) {
+            auto terminusMctpInfo = toMctpInfo(terminusPair.first);
+            return (terminusMctpInfo &&
+                    (std::get<0>(terminusMctpInfo.value()) ==
+                     std::get<0>(mctpInfo)) &&
+                    (std::get<3>(terminusMctpInfo.value()) ==
+                     std::get<3>(mctpInfo)));
+        });
 
     return foundIter;
 }
@@ -359,10 +360,9 @@
     co_return PLDM_SUCCESS;
 }
 
-exec::task<int>
-    TerminusManager::sendRecvPldmMsgOverMctp(mctp_eid_t eid, Request& request,
-                                             const pldm_msg** responseMsg,
-                                             size_t* responseLen)
+exec::task<int> TerminusManager::sendRecvPldmMsgOverMctp(
+    mctp_eid_t eid, Request& request, const pldm_msg** responseMsg,
+    size_t* responseLen)
 {
     int rc = 0;
     try
@@ -471,8 +471,8 @@
     co_return responseMsg->payload[0];
 }
 
-exec::task<int> TerminusManager::getPLDMTypes(pldm_tid_t tid,
-                                              uint64_t& supportedTypes)
+exec::task<int>
+    TerminusManager::getPLDMTypes(pldm_tid_t tid, uint64_t& supportedTypes)
 {
     Request request(sizeof(pldm_msg_hdr));
     auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
@@ -498,8 +498,8 @@
 
     uint8_t completionCode = 0;
     bitfield8_t* types = reinterpret_cast<bitfield8_t*>(&supportedTypes);
-    rc = decode_get_types_resp(responseMsg, responseLen, &completionCode,
-                               types);
+    rc =
+        decode_get_types_resp(responseMsg, responseLen, &completionCode, types);
     if (rc)
     {
         lg2::error(
@@ -569,10 +569,9 @@
     co_return completionCode;
 }
 
-exec::task<int> TerminusManager::sendRecvPldmMsg(pldm_tid_t tid,
-                                                 Request& request,
-                                                 const pldm_msg** responseMsg,
-                                                 size_t* responseLen)
+exec::task<int> TerminusManager::sendRecvPldmMsg(
+    pldm_tid_t tid, Request& request, const pldm_msg** responseMsg,
+    size_t* responseLen)
 {
     /**
      * Size of tidPool is `std::numeric_limits<pldm_tid_t>::max() + 1`
diff --git a/platform-mc/terminus_manager.hpp b/platform-mc/terminus_manager.hpp
index 249fdff..d485de5 100644
--- a/platform-mc/terminus_manager.hpp
+++ b/platform-mc/terminus_manager.hpp
@@ -55,8 +55,7 @@
                              RequesterHandler& handler,
                              pldm::InstanceIdDb& instanceIdDb,
                              TerminiMapper& termini, Manager* manager) :
-        handler(handler),
-        instanceIdDb(instanceIdDb), termini(termini),
+        handler(handler), instanceIdDb(instanceIdDb), termini(termini),
         tidPool(tidPoolSize, false), manager(manager)
     {
         // DSP0240 v1.1.0 table-8, special value: 0,0xFF = reserved
@@ -100,10 +99,9 @@
      *  @param[out] responseLen - length of response PLDM message
      *  @return coroutine return_value - PLDM completion code
      */
-    virtual exec::task<int>
-        sendRecvPldmMsgOverMctp(mctp_eid_t eid, Request& request,
-                                const pldm_msg** responseMsg,
-                                size_t* responseLen);
+    virtual exec::task<int> sendRecvPldmMsgOverMctp(
+        mctp_eid_t eid, Request& request, const pldm_msg** responseMsg,
+        size_t* responseLen);
 
     /** @brief member functions to map/unmap tid
      */
@@ -135,8 +133,8 @@
      *
      *  @return tid - Terminus tid
      */
-    std::optional<pldm_tid_t> storeTerminusInfo(const MctpInfo& mctpInfo,
-                                                pldm_tid_t tid);
+    std::optional<pldm_tid_t>
+        storeTerminusInfo(const MctpInfo& mctpInfo, pldm_tid_t tid);
 
     /** @brief Member functions to remove the TID from the transportLayer and
      *         mctpInfo table
diff --git a/platform-mc/test/mock_terminus_manager.hpp b/platform-mc/test/mock_terminus_manager.hpp
index eb06734..4e56a83 100644
--- a/platform-mc/test/mock_terminus_manager.hpp
+++ b/platform-mc/test/mock_terminus_manager.hpp
@@ -20,10 +20,9 @@
         TerminusManager(event, handler, instanceIdDb, termini, manager)
     {}
 
-    exec::task<int> sendRecvPldmMsgOverMctp(mctp_eid_t /*eid*/,
-                                            Request& /*request*/,
-                                            const pldm_msg** responseMsg,
-                                            size_t* responseLen) override
+    exec::task<int> sendRecvPldmMsgOverMctp(
+        mctp_eid_t /*eid*/, Request& /*request*/, const pldm_msg** responseMsg,
+        size_t* responseLen) override
     {
         if (responseMsgs.empty() || responseMsg == nullptr ||
             responseLen == nullptr)
diff --git a/platform-mc/test/terminus_manager_test.cpp b/platform-mc/test/terminus_manager_test.cpp
index 464ef71..432ba21 100644
--- a/platform-mc/test/terminus_manager_test.cpp
+++ b/platform-mc/test/terminus_manager_test.cpp
@@ -266,9 +266,9 @@
         reinterpret_cast<pldm_msg*>(setTidResp0.data()), sizeof(setTidResp0));
     EXPECT_EQ(rc, PLDM_SUCCESS);
 
-    uint8_t supportedType1Byte = (1 << (PLDM_BASE % 8)) +
-                                 (1 << (PLDM_PLATFORM % 8)) +
-                                 (1 << (PLDM_BIOS % 8)) + (1 << (PLDM_FRU % 8));
+    uint8_t supportedType1Byte =
+        (1 << (PLDM_BASE % 8)) + (1 << (PLDM_PLATFORM % 8)) +
+        (1 << (PLDM_BIOS % 8)) + (1 << (PLDM_FRU % 8));
     std::array<uint8_t, sizeof(pldm_msg_hdr) + getPldmTypesRespLen>
         getPldmTypesResp0{0x00, 0x02, 0x04, 0x00, supportedType1Byte,
                           0x00, 0x00, 0x00, 0x00, 0x00,
@@ -334,11 +334,11 @@
             (1 << (PLDM_GET_PLDM_TYPES % 8)) +
             (1 << (PLDM_GET_PLDM_COMMANDS % 8));
     std::array<uint8_t, sizeof(pldm_msg_hdr) + getPldmCommandRespLen>
-        getPldmCommandBaseResp0{0x00, 0x02, 0x05, 0x00, byte0, 0x00, 0x00, 0x00,
-                                0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00,
-                                0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00,
-                                0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00,
-                                0x00, 0x00, 0x00, 0x00};
+        getPldmCommandBaseResp0{
+            0x00, 0x02, 0x05, 0x00, byte0, 0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00};
     rc = mockTerminusManager.enqueueResponse(
         reinterpret_cast<pldm_msg*>(getPldmCommandBaseResp0.data()),
         sizeof(getPldmCommandBaseResp0));
@@ -391,11 +391,11 @@
     byte1 = (0 << (PLDM_GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE % 8)) +
             (1 << (PLDM_GET_DATE_TIME % 8)) + (1 << (PLDM_SET_DATE_TIME % 8));
     std::array<uint8_t, sizeof(pldm_msg_hdr) + getPldmCommandRespLen>
-        getPldmCommandBiosResp0{0x00, 0x02, 0x05, 0x00, byte0, byte1, 0x00,
-                                0x00, 0x00, 0x00, 0x00, 0x00,  0x00,  0x00,
-                                0x00, 0x00, 0x00, 0x00, 0x00,  0x00,  0x00,
-                                0x00, 0x00, 0x00, 0x00, 0x00,  0x00,  0x00,
-                                0x00, 0x00, 0x00, 0x00, 0x00,  0x00,  0x00};
+        getPldmCommandBiosResp0{
+            0x00, 0x02, 0x05, 0x00, byte0, byte1, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00,  0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00,  0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00,  0x00, 0x00};
     rc = mockTerminusManager.enqueueResponse(
         reinterpret_cast<pldm_msg*>(getPldmCommandBiosResp0.data()),
         sizeof(getPldmCommandBiosResp0));
@@ -411,11 +411,11 @@
     /* byte0 command from 8 to 15 */
     byte1 = 0;
     std::array<uint8_t, sizeof(pldm_msg_hdr) + getPldmCommandRespLen>
-        getPldmCommandFruResp0{0x00, 0x02, 0x05, 0x00, byte0, 0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00};
+        getPldmCommandFruResp0{
+            0x00, 0x02, 0x05, 0x00, byte0, 0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00};
     rc = mockTerminusManager.enqueueResponse(
         reinterpret_cast<pldm_msg*>(getPldmCommandFruResp0.data()),
         sizeof(getPldmCommandFruResp0));
diff --git a/platform-mc/test/terminus_test.cpp b/platform-mc/test/terminus_test.cpp
index e4f00f9..0baa8b7 100644
--- a/platform-mc/test/terminus_test.cpp
+++ b/platform-mc/test/terminus_test.cpp
@@ -8,8 +8,8 @@
 TEST(TerminusTest, supportedTypeTest)
 {
     auto t1 = pldm::platform_mc::Terminus(1, 1 << PLDM_BASE);
-    auto t2 = pldm::platform_mc::Terminus(2,
-                                          1 << PLDM_BASE | 1 << PLDM_PLATFORM);
+    auto t2 =
+        pldm::platform_mc::Terminus(2, 1 << PLDM_BASE | 1 << PLDM_PLATFORM);
 
     EXPECT_EQ(true, t1.doesSupportType(PLDM_BASE));
     EXPECT_EQ(false, t1.doesSupportType(PLDM_PLATFORM));
@@ -27,8 +27,8 @@
 
 TEST(TerminusTest, parseSensorAuxiliaryNamesPDRTest)
 {
-    auto t1 = pldm::platform_mc::Terminus(1,
-                                          1 << PLDM_BASE | 1 << PLDM_PLATFORM);
+    auto t1 =
+        pldm::platform_mc::Terminus(1, 1 << PLDM_BASE | 1 << PLDM_PLATFORM);
     std::vector<uint8_t> pdr1{
         0x0,
         0x0,
@@ -110,8 +110,8 @@
 
 TEST(TerminusTest, parseSensorAuxiliaryMultiNamesPDRTest)
 {
-    auto t1 = pldm::platform_mc::Terminus(1,
-                                          1 << PLDM_BASE | 1 << PLDM_PLATFORM);
+    auto t1 =
+        pldm::platform_mc::Terminus(1, 1 << PLDM_BASE | 1 << PLDM_PLATFORM);
     std::vector<uint8_t> pdr1{
         0x0,
         0x0,
@@ -229,8 +229,8 @@
 
 TEST(TerminusTest, parseSensorAuxiliaryNamesMultiSensorsPDRTest)
 {
-    auto t1 = pldm::platform_mc::Terminus(1,
-                                          1 << PLDM_BASE | 1 << PLDM_PLATFORM);
+    auto t1 =
+        pldm::platform_mc::Terminus(1, 1 << PLDM_BASE | 1 << PLDM_PLATFORM);
     std::vector<uint8_t> pdr1{
         0x0,
         0x0,
@@ -350,8 +350,8 @@
 
 TEST(TerminusTest, parsePDRTestNoSensorPDR)
 {
-    auto t1 = pldm::platform_mc::Terminus(1,
-                                          1 << PLDM_BASE | 1 << PLDM_PLATFORM);
+    auto t1 =
+        pldm::platform_mc::Terminus(1, 1 << PLDM_BASE | 1 << PLDM_PLATFORM);
     std::vector<uint8_t> pdr1{
         0x1, 0x0, 0x0,
         0x0,                             // record handle
diff --git a/pldmd/dbus_impl_pdr.cpp b/pldmd/dbus_impl_pdr.cpp
index 231f64d..ac39d9d 100644
--- a/pldmd/dbus_impl_pdr.cpp
+++ b/pldmd/dbus_impl_pdr.cpp
@@ -13,12 +13,11 @@
 namespace dbus_api
 {
 
-std::vector<std::vector<uint8_t>> Pdr::findStateEffecterPDR(uint8_t tid,
-                                                            uint16_t entityID,
-                                                            uint16_t stateSetId)
+std::vector<std::vector<uint8_t>> Pdr::findStateEffecterPDR(
+    uint8_t tid, uint16_t entityID, uint16_t stateSetId)
 {
-    auto pdrs = pldm::utils::findStateEffecterPDR(tid, entityID, stateSetId,
-                                                  pdrRepo);
+    auto pdrs =
+        pldm::utils::findStateEffecterPDR(tid, entityID, stateSetId, pdrRepo);
 
     if (pdrs.empty())
     {
@@ -31,8 +30,8 @@
 std::vector<std::vector<uint8_t>>
     Pdr::findStateSensorPDR(uint8_t tid, uint16_t entityID, uint16_t stateSetId)
 {
-    auto pdrs = pldm::utils::findStateSensorPDR(tid, entityID, stateSetId,
-                                                pdrRepo);
+    auto pdrs =
+        pldm::utils::findStateSensorPDR(tid, entityID, stateSetId, pdrRepo);
     if (pdrs.empty())
     {
         throw ResourceNotFound();
diff --git a/pldmd/dbus_impl_pdr.hpp b/pldmd/dbus_impl_pdr.hpp
index b4614dd..39f411b 100644
--- a/pldmd/dbus_impl_pdr.hpp
+++ b/pldmd/dbus_impl_pdr.hpp
@@ -39,25 +39,23 @@
      *  @param[in] repo - pointer to BMC's primary PDR repo
      */
     Pdr(sdbusplus::bus_t& bus, const std::string& path, const pldm_pdr* repo) :
-        PdrIntf(bus, path.c_str()), pdrRepo(repo){};
+        PdrIntf(bus, path.c_str()), pdrRepo(repo) {};
 
     /** @brief Implementation for PdrIntf.FindStateEffecterPDR
      *  @param[in] tid - PLDM terminus ID.
      *  @param[in] entityID - entity that can be associated with PLDM State set.
      *  @param[in] stateSetId - value that identifies PLDM State set.
      */
-    std::vector<std::vector<uint8_t>>
-        findStateEffecterPDR(uint8_t tid, uint16_t entityID,
-                             uint16_t stateSetId) override;
+    std::vector<std::vector<uint8_t>> findStateEffecterPDR(
+        uint8_t tid, uint16_t entityID, uint16_t stateSetId) override;
 
     /** @brief Implementation for PdrIntf.FindStateSensorPDR
      *  @param[in] tid - PLDM terminus ID.
      *  @param[in] entityID - entity that can be associated with PLDM State set.
      *  @param[in] stateSetId - value that identifies PLDM State set.
      */
-    std::vector<std::vector<uint8_t>>
-        findStateSensorPDR(uint8_t tid, uint16_t entityID,
-                           uint16_t stateSetId) override;
+    std::vector<std::vector<uint8_t>> findStateSensorPDR(
+        uint8_t tid, uint16_t entityID, uint16_t stateSetId) override;
 
   private:
     /** @brief pointer to BMC's primary PDR repo */
diff --git a/pldmd/dbus_impl_requester.hpp b/pldmd/dbus_impl_requester.hpp
index 84e861b..1f1cc96 100644
--- a/pldmd/dbus_impl_requester.hpp
+++ b/pldmd/dbus_impl_requester.hpp
@@ -42,8 +42,7 @@
      */
     Requester(sdbusplus::bus_t& bus, const std::string& path,
               InstanceIdDb& db) :
-        RequesterIntf(bus, path.c_str()),
-        pldmInstanceIdDb(db){};
+        RequesterIntf(bus, path.c_str()), pldmInstanceIdDb(db) {};
 
     /** @brief Implementation for RequesterIntf.GetInstanceId */
     uint8_t getInstanceId(uint8_t eid) override
diff --git a/pldmd/handler.hpp b/pldmd/handler.hpp
index b742519..b677e47 100644
--- a/pldmd/handler.hpp
+++ b/pldmd/handler.hpp
@@ -49,9 +49,9 @@
     {
         Response response(sizeof(pldm_msg), 0);
         auto ptr = reinterpret_cast<pldm_msg*>(response.data());
-        auto rc = encode_cc_only_resp(request->hdr.instance_id,
-                                      request->hdr.type, request->hdr.command,
-                                      cc, ptr);
+        auto rc =
+            encode_cc_only_resp(request->hdr.instance_id, request->hdr.type,
+                                request->hdr.command, cc, ptr);
         assert(rc == PLDM_SUCCESS);
         return response;
     }
diff --git a/pldmd/oem_ibm.hpp b/pldmd/oem_ibm.hpp
index 8063efb..67ad482 100644
--- a/pldmd/oem_ibm.hpp
+++ b/pldmd/oem_ibm.hpp
@@ -64,8 +64,7 @@
         responder::fru::Handler* fruHandler,
         responder::base::Handler* baseHandler,
         pldm::requester::Handler<pldm::requester::Request>* reqHandler) :
-        dBusIntf(dBusIntf),
-        mctp_fd(mctp_fd), mctp_eid(mctp_eid), repo(repo),
+        dBusIntf(dBusIntf), mctp_fd(mctp_fd), mctp_eid(mctp_eid), repo(repo),
         instanceIdDb(instanceIdDb), event(event), invoker(invoker),
         reqHandler(reqHandler)
     {
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index 39e1213..13d28f2 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -120,9 +120,9 @@
         {
             if (hdrFields.pldm_type != PLDM_FWUP)
             {
-                response = invoker.handle(tid, hdrFields.pldm_type,
-                                          hdrFields.command, request,
-                                          requestLen);
+                response =
+                    invoker.handle(tid, hdrFields.pldm_type, hdrFields.command,
+                                   request, requestLen);
             }
             else
             {
@@ -281,11 +281,11 @@
     auto baseHandler = std::make_unique<base::Handler>(event);
 
 #ifdef OEM_IBM
-    pldm::oem_ibm::OemIBM oemIBM(&dbusHandler, pldmTransport.getEventSource(),
-                                 hostEID, pdrRepo.get(), instanceIdDb, event,
-                                 invoker, hostPDRHandler.get(),
-                                 platformHandler.get(), fruHandler.get(),
-                                 baseHandler.get(), &reqHandler);
+    pldm::oem_ibm::OemIBM oemIBM(
+        &dbusHandler, pldmTransport.getEventSource(), hostEID, pdrRepo.get(),
+        instanceIdDb, event, invoker, hostPDRHandler.get(),
+        platformHandler.get(), fruHandler.get(), baseHandler.get(),
+        &reqHandler);
 #endif
 
     invoker.registerHandler(PLDM_BIOS, std::move(biosHandler));
diff --git a/pldmtool/oem/ibm/pldm_oem_ibm.cpp b/pldmtool/oem/ibm/pldm_oem_ibm.cpp
index b1da2a6..317dbfa 100644
--- a/pldmtool/oem/ibm/pldm_oem_ibm.cpp
+++ b/pldmtool/oem/ibm/pldm_oem_ibm.cpp
@@ -50,8 +50,8 @@
 
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_ALERT_STATUS_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_ALERT_STATUS_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
         auto rc = encode_get_alert_status_req(instanceId, versionId, request,
@@ -64,9 +64,9 @@
         uint8_t completionCode = 0;
         uint32_t rack_entry = 0;
         uint32_t pri_cec_node = 0;
-        auto rc = decode_get_alert_status_resp(responsePtr, payloadLength,
-                                               &completionCode, &rack_entry,
-                                               &pri_cec_node);
+        auto rc = decode_get_alert_status_resp(
+            responsePtr, payloadLength, &completionCode, &rack_entry,
+            &pri_cec_node);
 
         if (rc != PLDM_SUCCESS || completionCode != PLDM_SUCCESS)
         {
@@ -111,8 +111,8 @@
     void parseResponseMsg(pldm_msg*, size_t) override {}
     void exec() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_FILE_TABLE_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_FILE_TABLE_REQ_BYTES);
 
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
@@ -152,8 +152,8 @@
             return;
         }
 
-        auto tableData = reinterpret_cast<uint8_t*>((responsePtr->payload) +
-                                                    table_data_start_offset);
+        auto tableData = reinterpret_cast<uint8_t*>(
+            (responsePtr->payload) + table_data_start_offset);
         printFileAttrTable(tableData, fileTableDataLength);
     }
 
@@ -208,8 +208,8 @@
     commands.push_back(std::make_unique<GetAlertStatus>(
         "oem_ibm", "getAlertStatus", getAlertStatus));
 
-    auto getFileTable = oem_ibm->add_subcommand("GetFileTable",
-                                                "get file table");
+    auto getFileTable =
+        oem_ibm->add_subcommand("GetFileTable", "get file table");
 
     commands.push_back(std::make_unique<GetFileTable>("oem_ibm", "getFileTable",
                                                       getFileTable));
diff --git a/pldmtool/pldm_base_cmd.cpp b/pldmtool/pldm_base_cmd.cpp
index 9d6449a..5d02a7f 100644
--- a/pldmtool/pldm_base_cmd.cpp
+++ b/pldmtool/pldm_base_cmd.cpp
@@ -162,8 +162,8 @@
     }
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_VERSION_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_VERSION_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
         auto rc = encode_get_version_req(instanceId, 0, PLDM_GET_FIRSTPART,
@@ -176,9 +176,9 @@
         uint8_t cc = 0, transferFlag = 0;
         uint32_t transferHandle = 0;
         ver32_t version;
-        auto rc = decode_get_version_resp(responsePtr, payloadLength, &cc,
-                                          &transferHandle, &transferFlag,
-                                          &version);
+        auto rc =
+            decode_get_version_resp(responsePtr, payloadLength, &cc,
+                                    &transferHandle, &transferFlag, &version);
         if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
         {
             std::cerr << "Response Message Error: "
@@ -252,8 +252,7 @@
     GetPLDMCommands& operator=(GetPLDMCommands&&) = delete;
 
     explicit GetPLDMCommands(const char* type, const char* name,
-                             CLI::App* app) :
-        CommandInterface(type, name, app)
+                             CLI::App* app) : CommandInterface(type, name, app)
     {
         app->add_option("-t,--type", pldmType, "pldm supported type")
             ->required()
@@ -266,8 +265,8 @@
 
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_COMMANDS_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
         ver32_t version{0xFF, 0xFF, 0xFF, 0xFF};
         if (inputVersion.size() != 0)
@@ -285,8 +284,8 @@
                 version.alpha = inputVersion[0];
             }
         }
-        auto rc = encode_get_commands_req(instanceId, pldmType, version,
-                                          request);
+        auto rc =
+            encode_get_commands_req(instanceId, pldmType, version, request);
         return {rc, requestMsg};
     }
 
@@ -367,13 +366,13 @@
     auto base = app.add_subcommand("base", "base type command");
     base->require_subcommand(1);
 
-    auto getPLDMTypes = base->add_subcommand("GetPLDMTypes",
-                                             "get pldm supported types");
+    auto getPLDMTypes =
+        base->add_subcommand("GetPLDMTypes", "get pldm supported types");
     commands.push_back(
         std::make_unique<GetPLDMTypes>("base", "GetPLDMTypes", getPLDMTypes));
 
-    auto getPLDMVersion = base->add_subcommand("GetPLDMVersion",
-                                               "get version of a certain type");
+    auto getPLDMVersion =
+        base->add_subcommand("GetPLDMVersion", "get version of a certain type");
     commands.push_back(std::make_unique<GetPLDMVersion>(
         "base", "GetPLDMVersion", getPLDMVersion));
 
diff --git a/pldmtool/pldm_bios_cmd.cpp b/pldmtool/pldm_bios_cmd.cpp
index 1510617..160afd7 100644
--- a/pldmtool/pldm_bios_cmd.cpp
+++ b/pldmtool/pldm_bios_cmd.cpp
@@ -60,9 +60,9 @@
 
         uint8_t seconds, minutes, hours, day, month;
         uint16_t year;
-        auto rc = decode_get_date_time_resp(responsePtr, payloadLength, &cc,
-                                            &seconds, &minutes, &hours, &day,
-                                            &month, &year);
+        auto rc =
+            decode_get_date_time_resp(responsePtr, payloadLength, &cc, &seconds,
+                                      &minutes, &hours, &day, &month, &year);
         if (rc != PLDM_SUCCESS || cc != PLDM_SUCCESS)
         {
             std::cerr << "Response Message Error: "
@@ -110,8 +110,8 @@
 
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        sizeof(struct pldm_set_date_time_req));
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + sizeof(struct pldm_set_date_time_req));
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
         uint16_t year = 0;
         uint8_t month = 0;
@@ -195,8 +195,8 @@
 
     std::optional<Table> getBIOSTable(pldm_bios_table_types tableType)
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_BIOS_TABLE_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_BIOS_TABLE_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
         auto rc = encode_get_bios_table_req(instanceId, 0, PLDM_GET_FIRSTPART,
@@ -266,9 +266,9 @@
         return nullptr;
     }
 
-    std::optional<uint16_t> findAttrHandleByName(const std::string& name,
-                                                 const Table& attrTable,
-                                                 const Table& stringTable)
+    std::optional<uint16_t>
+        findAttrHandleByName(const std::string& name, const Table& attrTable,
+                             const Table& stringTable)
     {
         auto attribute = findAttrEntryByName(name, attrTable, stringTable);
         if (attribute == nullptr)
@@ -334,8 +334,8 @@
             return displayString;
         }
         uint8_t pvNum;
-        int rc = pldm_bios_table_attr_entry_enum_decode_pv_num(attrEntry,
-                                                               &pvNum);
+        int rc =
+            pldm_bios_table_attr_entry_enum_decode_pv_num(attrEntry, &pvNum);
         if (rc != PLDM_SUCCESS)
         {
             return displayString;
@@ -628,9 +628,9 @@
                         entry, defString.data(), defString.size());
 
                     std::stringstream stringtype;
-                    stringtype << "0x" << std::hex << std::setw(2)
-                               << std::setfill('0') << (int)strType << std::dec
-                               << std::setw(0);
+                    stringtype
+                        << "0x" << std::hex << std::setw(2) << std::setfill('0')
+                        << (int)strType << std::dec << std::setw(0);
                     attrdata["StringType"] = stringtype.str();
                     attrdata["MinimumStringLength"] = (int)min;
                     attrdata["MaximumStringLength"] = (int)max;
@@ -640,8 +640,8 @@
                 }
                 case PLDM_BIOS_PASSWORD:
                 case PLDM_BIOS_PASSWORD_READ_ONLY:
-                    std::cout << "Password attribute: Not Supported"
-                              << std::endl;
+                    std::cout
+                        << "Password attribute: Not Supported" << std::endl;
             }
             output.emplace_back(std::move(attrdata));
         }
@@ -682,9 +682,8 @@
     GetBIOSAttributeCurrentValueByHandle&
         operator=(GetBIOSAttributeCurrentValueByHandle&&) = delete;
 
-    explicit GetBIOSAttributeCurrentValueByHandle(const char* type,
-                                                  const char* name,
-                                                  CLI::App* app) :
+    explicit GetBIOSAttributeCurrentValueByHandle(
+        const char* type, const char* name, CLI::App* app) :
         GetBIOSTableHandler(type, name, app)
     {
         app->add_option("-a, --attribute", attrName, "pldm BIOS attribute name")
@@ -796,8 +795,8 @@
             return;
         }
 
-        auto attrEntry = findAttrEntryByName(attrName, *attrTable,
-                                             *stringTable);
+        auto attrEntry =
+            findAttrEntryByName(attrName, *attrTable, *stringTable);
         if (attrEntry == nullptr)
         {
             std::cout << "Could not find attribute :" << attrName << std::endl;
@@ -963,8 +962,8 @@
     commands.push_back(
         std::make_unique<GetDateTime>("bios", "GetDateTime", getDateTime));
 
-    auto setDateTime = bios->add_subcommand("SetDateTime",
-                                            "set host date time");
+    auto setDateTime =
+        bios->add_subcommand("SetDateTime", "set host date time");
     commands.push_back(
         std::make_unique<SetDateTime>("bios", "setDateTime", setDateTime));
 
diff --git a/pldmtool/pldm_cmd_helper.cpp b/pldmtool/pldm_cmd_helper.cpp
index afd49dd..1de5b8d 100644
--- a/pldmtool/pldm_cmd_helper.cpp
+++ b/pldmtool/pldm_cmd_helper.cpp
@@ -73,9 +73,9 @@
         void* responseMessage = nullptr;
         size_t responseMessageSize{};
 
-        rc = pldmTransport.sendRecvMsg(tid, requestMsg.data(),
-                                       requestMsg.size(), responseMessage,
-                                       responseMessageSize);
+        rc =
+            pldmTransport.sendRecvMsg(tid, requestMsg.data(), requestMsg.size(),
+                                      responseMessage, responseMessageSize);
         if (rc)
         {
             std::cerr << "[" << unsigned(retry) << "] pldm_send_recv error rc "
diff --git a/pldmtool/pldm_cmd_helper.hpp b/pldmtool/pldm_cmd_helper.hpp
index a59bb66..e668974 100644
--- a/pldmtool/pldm_cmd_helper.hpp
+++ b/pldmtool/pldm_cmd_helper.hpp
@@ -78,9 +78,8 @@
   public:
     explicit CommandInterface(const char* type, const char* name,
                               CLI::App* app) :
-        pldmType(type),
-        commandName(name), mctp_eid(PLDM_ENTITY_ID), pldmVerbose(false),
-        instanceId(0)
+        pldmType(type), commandName(name), mctp_eid(PLDM_ENTITY_ID),
+        pldmVerbose(false), instanceId(0)
     {
         app->add_option("-m,--mctp_eid", mctp_eid, "MCTP endpoint ID");
         app->add_flag("-v, --verbose", pldmVerbose);
diff --git a/pldmtool/pldm_fru_cmd.cpp b/pldmtool/pldm_fru_cmd.cpp
index 6d57656..b67d1bd 100644
--- a/pldmtool/pldm_fru_cmd.cpp
+++ b/pldmtool/pldm_fru_cmd.cpp
@@ -100,8 +100,8 @@
                 reinterpret_cast<const pldm_fru_record_data_format*>(p);
             output["FRU Record Set Identifier"] =
                 (int)le16toh(record->record_set_id);
-            output["FRU Record Type"] = typeToString(fruRecordTypes,
-                                                     record->record_type);
+            output["FRU Record Type"] =
+                typeToString(fruRecordTypes, record->record_type);
             output["Number of FRU fields"] = (int)record->num_fru_fields;
             output["Encoding Type for FRU fields"] =
                 typeToString(fruEncodingType, record->encoding_type);
@@ -124,22 +124,22 @@
                                            fruGeneralFieldTypes.end());
                     if (tlv->type == PLDM_FRU_FIELD_TYPE_IANA)
                     {
-                        fruFieldValue = fruFieldParserU32(tlv->value,
-                                                          tlv->length);
+                        fruFieldValue =
+                            fruFieldParserU32(tlv->value, tlv->length);
                     }
                     else if (tlv->type == PLDM_FRU_FIELD_TYPE_MANUFAC_DATE)
                     {
-                        fruFieldValue = fruFieldParserTimestamp(tlv->value,
-                                                                tlv->length);
+                        fruFieldValue =
+                            fruFieldParserTimestamp(tlv->value, tlv->length);
                     }
                     else
                     {
-                        fruFieldValue = fruFieldValuestring(tlv->value,
-                                                            tlv->length);
+                        fruFieldValue =
+                            fruFieldValuestring(tlv->value, tlv->length);
                     }
 
-                    frudata["FRU Field Type"] = typeToString(FruFieldTypeMap,
-                                                             tlv->type);
+                    frudata["FRU Field Type"] =
+                        typeToString(FruFieldTypeMap, tlv->type);
                     frudata["FRU Field Length"] = (int)(tlv->length);
                     frudata["FRU Field Value"] = fruFieldValue;
                     frufielddata.emplace_back(frudata);
@@ -149,8 +149,8 @@
 #ifdef OEM_IBM
                     if (tlv->type == PLDM_OEM_FRU_FIELD_TYPE_RT)
                     {
-                        auto oemIPZValue = fruFieldValuestring(tlv->value,
-                                                               tlv->length);
+                        auto oemIPZValue =
+                            fruFieldValuestring(tlv->value, tlv->length);
 
                         if (populateMaps.contains(oemIPZValue))
                         {
@@ -167,21 +167,21 @@
                     }
                     if (tlv->type == PLDM_OEM_FRU_FIELD_TYPE_IANA)
                     {
-                        fruFieldValue = fruFieldParserU32(tlv->value,
-                                                          tlv->length);
+                        fruFieldValue =
+                            fruFieldParserU32(tlv->value, tlv->length);
                     }
                     else if (tlv->type != 2)
                     {
-                        fruFieldValue = fruFieldIPZParser(tlv->value,
-                                                          tlv->length);
+                        fruFieldValue =
+                            fruFieldIPZParser(tlv->value, tlv->length);
                     }
                     else
                     {
-                        fruFieldValue = fruFieldValuestring(tlv->value,
-                                                            tlv->length);
+                        fruFieldValue =
+                            fruFieldValuestring(tlv->value, tlv->length);
                     }
-                    frudata["FRU Field Type"] = typeToString(FruFieldTypeMap,
-                                                             tlv->type);
+                    frudata["FRU Field Type"] =
+                        typeToString(FruFieldTypeMap, tlv->type);
                     frudata["FRU Field Length"] = (int)(tlv->length);
                     frudata["FRU Field Value"] = fruFieldValue;
                     frufielddata.emplace_back(frudata);
@@ -412,8 +412,8 @@
     using CommandInterface::CommandInterface;
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
         auto rc = encode_get_fru_record_table_req(
@@ -456,13 +456,13 @@
     commands.push_back(std::make_unique<GetFruRecordTableMetadata>(
         "fru", "GetFruRecordTableMetadata", getFruRecordTableMetadata));
 
-    auto getFRURecordByOption = fru->add_subcommand("GetFRURecordByOption",
-                                                    "get FRU Record By Option");
+    auto getFRURecordByOption =
+        fru->add_subcommand("GetFRURecordByOption", "get FRU Record By Option");
     commands.push_back(std::make_unique<GetFRURecordByOption>(
         "fru", "GetFRURecordByOption", getFRURecordByOption));
 
-    auto getFruRecordTable = fru->add_subcommand("GetFruRecordTable",
-                                                 "get FRU Record Table");
+    auto getFruRecordTable =
+        fru->add_subcommand("GetFruRecordTable", "get FRU Record Table");
     commands.push_back(std::make_unique<GetFruRecordTable>(
         "fru", "GetFruRecordTable", getFruRecordTable));
 }
diff --git a/pldmtool/pldm_fw_update_cmd.cpp b/pldmtool/pldm_fw_update_cmd.cpp
index 25ab259..cfd4608 100644
--- a/pldmtool/pldm_fw_update_cmd.cpp
+++ b/pldmtool/pldm_fw_update_cmd.cpp
@@ -86,8 +86,8 @@
 
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_STATUS_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_STATUS_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
         auto rc = encode_get_status_req(instanceId, request,
                                         PLDM_GET_STATUS_REQ_BYTES);
@@ -176,8 +176,8 @@
 
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
         auto rc = encode_get_firmware_parameters_req(
             instanceId, PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES, request);
@@ -397,9 +397,9 @@
 
             compParamPtr += sizeof(pldm_component_parameter_entry) +
                             activeCompVerStr.length + pendingCompVerStr.length;
-            compParamTableLen -= sizeof(pldm_component_parameter_entry) +
-                                 activeCompVerStr.length +
-                                 pendingCompVerStr.length;
+            compParamTableLen -=
+                sizeof(pldm_component_parameter_entry) +
+                activeCompVerStr.length + pendingCompVerStr.length;
             compDataEntries.push_back(compData);
         }
         data["ComponentParameterEntries"] = compDataEntries;
@@ -493,9 +493,9 @@
             }
         }
         // Entry is not present, add type and value to json response
-        ordered_json descriptor =
-            ordered_json::object({{"Type", descriptorName.at(descriptorType)},
-                                  {"Value", ordered_json::array()}});
+        ordered_json descriptor = ordered_json::object(
+            {{"Type", descriptorName.at(descriptorType)},
+             {"Value", ordered_json::array()}});
         if (descriptorType != PLDM_FWUP_VENDOR_DEFINED)
         {
             descriptor["Value"].emplace_back(descDataStream.str());
@@ -517,8 +517,8 @@
 }
 std::pair<int, std::vector<uint8_t>> QueryDeviceIdentifiers::createRequestMsg()
 {
-    std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                    PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES);
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES);
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     auto rc = encode_query_device_identifiers_req(
         instanceId, PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES, request);
@@ -613,8 +613,8 @@
 
 void registerCommand(CLI::App& app)
 {
-    auto fwUpdate = app.add_subcommand("fw_update",
-                                       "firmware update type commands");
+    auto fwUpdate =
+        app.add_subcommand("fw_update", "firmware update type commands");
     fwUpdate->require_subcommand(1);
 
     auto getStatus = fwUpdate->add_subcommand("GetStatus", "Status of the FD");
diff --git a/pldmtool/pldm_platform_cmd.cpp b/pldmtool/pldm_platform_cmd.cpp
index b952534..6a07a38 100644
--- a/pldmtool/pldm_platform_cmd.cpp
+++ b/pldmtool/pldm_platform_cmd.cpp
@@ -100,14 +100,15 @@
             "eg: The recordHandle value for the PDR to be retrieved and 0 "
             "means get first PDR in the repository.");
         pdrRecType = "";
-        pdrOptionGroup->add_option("-t, --type", pdrRecType,
-                                   "retrieve all PDRs of the requested type\n"
-                                   "supported types:\n"
-                                   "[terminusLocator, stateSensor, "
-                                   "numericEffecter, stateEffecter, "
-                                   "compactNumericSensor, sensorauxname, "
-                                   "efffecterAuxName, numericsensor, "
-                                   "EntityAssociation, fruRecord, ... ]");
+        pdrOptionGroup->add_option(
+            "-t, --type", pdrRecType,
+            "retrieve all PDRs of the requested type\n"
+            "supported types:\n"
+            "[terminusLocator, stateSensor, "
+            "numericEffecter, stateEffecter, "
+            "compactNumericSensor, sensorauxname, "
+            "efffecterAuxName, numericsensor, "
+            "EntityAssociation, fruRecord, ... ]");
 
         getPDRGroupOption = pdrOptionGroup->add_option(
             "-i, --terminusID", pdrTerminus,
@@ -190,8 +191,8 @@
                 }
 
                 // check for circular references.
-                auto result = recordsSeen.emplace(recordHandle,
-                                                  prevRecordHandle);
+                auto result =
+                    recordsSeen.emplace(recordHandle, prevRecordHandle);
                 if (!result.second && !nextPartRequired)
                 {
                     std::cerr
@@ -223,8 +224,8 @@
 
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_PDR_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_PDR_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
         auto rc = encode_get_pdr_req(
@@ -718,9 +719,8 @@
         }
     }
 
-    std::vector<std::string>
-        getStateSetPossibleStateNames(uint16_t stateId,
-                                      const std::vector<uint8_t>& value)
+    std::vector<std::string> getStateSetPossibleStateNames(
+        uint16_t stateId, const std::vector<uint8_t>& value)
     {
         std::vector<std::string> data{};
 
@@ -957,12 +957,12 @@
             ptr += sizeof(uint8_t);
             for (auto j : std::views::iota(0, (int)nameStringCount))
             {
-                std::string nameLanguageTagKey = sPrefix + std::to_string(j) +
-                                                 "_nameLanguageTag" +
-                                                 std::to_string(i);
-                std::string entityAuxNameKey = sPrefix + std::to_string(j) +
-                                               "_entityAuxName" +
-                                               std::to_string(i);
+                std::string nameLanguageTagKey =
+                    sPrefix + std::to_string(j) + "_nameLanguageTag" +
+                    std::to_string(i);
+                std::string entityAuxNameKey =
+                    sPrefix + std::to_string(j) + "_entityAuxName" +
+                    std::to_string(i);
                 std::string nameLanguageTag(reinterpret_cast<const char*>(ptr),
                                             0, PLDM_STR_UTF_8_MAX_LEN);
                 ptr += nameLanguageTag.size() + sizeof(nullTerminator);
@@ -1122,8 +1122,8 @@
         output["containerID"] = pdr->container_id;
         output["effecterSemanticID"] = pdr->effecter_semantic_id;
         output["effecterInit"] = effecterInit[pdr->effecter_init];
-        output["effecterDescriptionPDR"] = (pdr->has_description_pdr ? true
-                                                                     : false);
+        output["effecterDescriptionPDR"] =
+            (pdr->has_description_pdr ? true : false);
         output["compositeEffecterCount"] =
             unsigned(pdr->composite_effecter_count);
 
@@ -1269,8 +1269,8 @@
                                ordered_json& output)
     {
         struct pldm_numeric_sensor_value_pdr pdr;
-        int rc = decode_numeric_sensor_pdr_data(data, (size_t)data_length,
-                                                &pdr);
+        int rc =
+            decode_numeric_sensor_pdr_data(data, (size_t)data_length, &pdr);
         if (rc != PLDM_SUCCESS)
         {
             std::cerr << "Failed to get numeric sensor PDR" << std::endl;
@@ -1617,8 +1617,7 @@
     static constexpr auto minEffecterCount = 1;
     static constexpr auto maxEffecterCount = 8;
     explicit SetStateEffecter(const char* type, const char* name,
-                              CLI::App* app) :
-        CommandInterface(type, name, app)
+                              CLI::App* app) : CommandInterface(type, name, app)
     {
         app->add_option(
                "-i, --id", effecterId,
@@ -1882,8 +1881,7 @@
     GetSensorReading& operator=(GetSensorReading&&) = delete;
 
     explicit GetSensorReading(const char* type, const char* name,
-                              CLI::App* app) :
-        CommandInterface(type, name, app)
+                              CLI::App* app) : CommandInterface(type, name, app)
     {
         app->add_option(
                "-i, --sensor_id", sensorId,
@@ -1897,12 +1895,12 @@
 
     std::pair<int, std::vector<uint8_t>> createRequestMsg() override
     {
-        std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
-                                        PLDM_GET_SENSOR_READING_REQ_BYTES);
+        std::vector<uint8_t> requestMsg(
+            sizeof(pldm_msg_hdr) + PLDM_GET_SENSOR_READING_REQ_BYTES);
         auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
-        auto rc = encode_get_sensor_reading_req(instanceId, sensorId, rearm,
-                                                request);
+        auto rc =
+            encode_get_sensor_reading_req(instanceId, sensorId, rearm, request);
 
         return {rc, requestMsg};
     }
@@ -1934,15 +1932,15 @@
         }
 
         ordered_json output;
-        output["sensorDataSize"] = getSensorState(sensorDataSize,
-                                                  &sensorDataSz);
+        output["sensorDataSize"] =
+            getSensorState(sensorDataSize, &sensorDataSz);
         output["sensorOperationalState"] =
             getSensorState(sensorOperationalState, &sensorOpState);
         output["sensorEventMessageEnable"] =
             getSensorState(sensorEventMessageEnable, &sensorEventMsgEnable);
         output["presentState"] = getSensorState(presentState, &sensorPresState);
-        output["previousState"] = getSensorState(previousState,
-                                                 &sensorPresState);
+        output["previousState"] =
+            getSensorState(previousState, &sensorPresState);
         output["eventState"] = getSensorState(eventState, &sensorPresState);
 
         switch (sensorDataSize)
@@ -2070,9 +2068,8 @@
         if (rc || resp.completion_code != PLDM_SUCCESS)
         {
             std::cerr << "Response Message Error: "
-                      << "rc=" << rc
-                      << ",cc=" << static_cast<int>(resp.completion_code)
-                      << std::endl;
+                      << "rc=" << rc << ",cc="
+                      << static_cast<int>(resp.completion_code) << std::endl;
             return;
         }
         ordered_json output;
@@ -2150,9 +2147,8 @@
         if (rc != PLDM_SUCCESS || completionCode != PLDM_SUCCESS)
         {
             std::cerr << "Response Message Error: "
-                      << "rc=" << rc
-                      << ",cc=" << static_cast<int>(completionCode)
-                      << std::endl;
+                      << "rc=" << rc << ",cc="
+                      << static_cast<int>(completionCode) << std::endl;
             return;
         }
 
@@ -2231,8 +2227,8 @@
     auto platform = app.add_subcommand("platform", "platform type command");
     platform->require_subcommand(1);
 
-    auto getPDR = platform->add_subcommand("GetPDR",
-                                           "get platform descriptor records");
+    auto getPDR =
+        platform->add_subcommand("GetPDR", "get platform descriptor records");
     commands.push_back(std::make_unique<GetPDR>("platform", "getPDR", getPDR));
 
     auto setStateEffecterStates = platform->add_subcommand(
diff --git a/pldmtool/pldmtool.cpp b/pldmtool/pldmtool.cpp
index ff898d0..cdd157a 100644
--- a/pldmtool/pldmtool.cpp
+++ b/pldmtool/pldmtool.cpp
@@ -55,8 +55,8 @@
 
 void registerCommand(CLI::App& app)
 {
-    auto raw = app.add_subcommand("raw",
-                                  "send a raw request and print response");
+    auto raw =
+        app.add_subcommand("raw", "send a raw request and print response");
     commands.push_back(std::make_unique<RawOp>("raw", "raw", raw));
 }
 
diff --git a/requester/handler.hpp b/requester/handler.hpp
index c665822..465e34f 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -146,9 +146,8 @@
         uint8_t numRetries = static_cast<uint8_t>(NUMBER_OF_REQUEST_RETRIES),
         std::chrono::milliseconds responseTimeOut =
             std::chrono::milliseconds(RESPONSE_TIME_OUT)) :
-        pldmTransport(pldmTransport),
-        event(event), instanceIdDb(instanceIdDb), verbose(verbose),
-        instanceIdExpiryInterval(instanceIdExpiryInterval),
+        pldmTransport(pldmTransport), event(event), instanceIdDb(instanceIdDb),
+        verbose(verbose), instanceIdExpiryInterval(instanceIdExpiryInterval),
         numRetries(numRetries), responseTimeOut(responseTimeOut)
     {}
 
@@ -475,8 +474,7 @@
     explicit SendRecvMsgOperation(Handler<RequestInterface>& handler,
                                   mctp_eid_t eid, pldm::Request&& request,
                                   R&& r) :
-        handler(handler),
-        request(std::move(request)), receiver(std::move(r))
+        handler(handler), request(std::move(request)), receiver(std::move(r))
     {
         auto requestMsg =
             reinterpret_cast<const pldm_msg*>(this->request.data());
@@ -611,8 +609,7 @@
 
     explicit SendRecvMsgSender(requester::Handler<RequestInterface>& handler,
                                mctp_eid_t eid, pldm::Request&& request) :
-        handler(handler),
-        eid(eid), request(std::move(request))
+        handler(handler), eid(eid), request(std::move(request))
     {}
 
     friend auto tag_invoke(stdexec::get_completion_signatures_t,
@@ -658,8 +655,8 @@
 {
     return SendRecvMsgSender(*this, eid, std::move(request)) |
            stdexec::then([](int rc, const pldm_msg* resp, size_t respLen) {
-        return std::make_tuple(rc, resp, respLen);
-    });
+               return std::make_tuple(rc, resp, respLen);
+           });
 }
 
 } // namespace requester
diff --git a/requester/mctp_endpoint_discovery.cpp b/requester/mctp_endpoint_discovery.cpp
index 2780281..d0122c9 100644
--- a/requester/mctp_endpoint_discovery.cpp
+++ b/requester/mctp_endpoint_discovery.cpp
@@ -24,10 +24,9 @@
 MctpDiscovery::MctpDiscovery(
     sdbusplus::bus_t& bus,
     std::initializer_list<MctpDiscoveryHandlerIntf*> list) :
-    bus(bus),
-    mctpEndpointAddedSignal(
-        bus, interfacesAdded(MCTPPath),
-        std::bind_front(&MctpDiscovery::discoverEndpoints, this)),
+    bus(bus), mctpEndpointAddedSignal(
+                  bus, interfacesAdded(MCTPPath),
+                  std::bind_front(&MctpDiscovery::discoverEndpoints, this)),
     mctpEndpointRemovedSignal(
         bus, interfacesRemoved(MCTPPath),
         std::bind_front(&MctpDiscovery::removeEndpoints, this)),
diff --git a/requester/request.hpp b/requester/request.hpp
index 0ba6172..7182c4b 100644
--- a/requester/request.hpp
+++ b/requester/request.hpp
@@ -48,8 +48,7 @@
     explicit RequestRetryTimer(sdeventplus::Event& event, uint8_t numRetries,
                                std::chrono::milliseconds timeout) :
 
-        event(event),
-        numRetries(numRetries), timeout(timeout),
+        event(event), numRetries(numRetries), timeout(timeout),
         timer(event.get(), std::bind_front(&RequestRetryTimer::callback, this))
     {}
 
diff --git a/requester/test/handler_test.cpp b/requester/test/handler_test.cpp
index f37040f..327817c 100644
--- a/requester/test/handler_test.cpp
+++ b/requester/test/handler_test.cpp
@@ -75,9 +75,9 @@
 
 TEST_F(HandlerTest, singleRequestResponseScenario)
 {
-    Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
-                                              instanceIdDb, false, seconds(1),
-                                              2, milliseconds(100));
+    Handler<NiceMock<MockRequest>> reqHandler(
+        pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+        milliseconds(100));
     pldm::Request request{};
     auto instanceId = instanceIdDb.next(eid);
     EXPECT_EQ(instanceId, 0);
@@ -96,9 +96,9 @@
 
 TEST_F(HandlerTest, singleRequestInstanceIdTimerExpired)
 {
-    Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
-                                              instanceIdDb, false, seconds(1),
-                                              2, milliseconds(100));
+    Handler<NiceMock<MockRequest>> reqHandler(
+        pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+        milliseconds(100));
     pldm::Request request{};
     auto instanceId = instanceIdDb.next(eid);
     EXPECT_EQ(instanceId, 0);
@@ -115,9 +115,9 @@
 
 TEST_F(HandlerTest, multipleRequestResponseScenario)
 {
-    Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
-                                              instanceIdDb, false, seconds(2),
-                                              2, milliseconds(100));
+    Handler<NiceMock<MockRequest>> reqHandler(
+        pldmTransport, event, instanceIdDb, false, seconds(2), 2,
+        milliseconds(100));
     pldm::Request request{};
     auto instanceId = instanceIdDb.next(eid);
     EXPECT_EQ(instanceId, 0);
@@ -156,39 +156,40 @@
 TEST_F(HandlerTest, singleRequestResponseScenarioUsingCoroutine)
 {
     exec::async_scope scope;
-    Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
-                                              instanceIdDb, false, seconds(1),
-                                              2, milliseconds(100));
+    Handler<NiceMock<MockRequest>> reqHandler(
+        pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+        milliseconds(100));
 
     auto instanceId = instanceIdDb.next(eid);
     EXPECT_EQ(instanceId, 0);
 
-    scope.spawn(stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
-        pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
-        const pldm_msg* responseMsg;
-        size_t responseLen;
-        int rc = PLDM_SUCCESS;
+    scope.spawn(
+        stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
+            pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
+            const pldm_msg* responseMsg;
+            size_t responseLen;
+            int rc = PLDM_SUCCESS;
 
-        auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
-        requestPtr->hdr.instance_id = instanceId;
+            auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
+            requestPtr->hdr.instance_id = instanceId;
 
-        try
-        {
-            std::tie(rc, responseMsg, responseLen) =
-                co_await reqHandler.sendRecvMsg(eid, std::move(request));
-        }
-        catch (...)
-        {
-            std::rethrow_exception(std::current_exception());
-        }
+            try
+            {
+                std::tie(rc, responseMsg, responseLen) =
+                    co_await reqHandler.sendRecvMsg(eid, std::move(request));
+            }
+            catch (...)
+            {
+                std::rethrow_exception(std::current_exception());
+            }
 
-        EXPECT_NE(responseLen, 0);
+            EXPECT_NE(responseLen, 0);
 
-        this->pldmResponseCallBack(eid, responseMsg, responseLen);
+            this->pldmResponseCallBack(eid, responseMsg, responseLen);
 
-        EXPECT_EQ(validResponse, true);
-    }),
-                exec::default_task_context<void>(exec::inline_scheduler{}));
+            EXPECT_EQ(validResponse, true);
+        }),
+        exec::default_task_context<void>(exec::inline_scheduler{}));
 
     pldm::Response mockResponse(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
     auto mockResponsePtr =
@@ -202,26 +203,27 @@
 TEST_F(HandlerTest, singleRequestCancellationScenarioUsingCoroutine)
 {
     exec::async_scope scope;
-    Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
-                                              instanceIdDb, false, seconds(1),
-                                              2, milliseconds(100));
+    Handler<NiceMock<MockRequest>> reqHandler(
+        pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+        milliseconds(100));
     auto instanceId = instanceIdDb.next(eid);
     EXPECT_EQ(instanceId, 0);
 
     bool stopped = false;
 
-    scope.spawn(stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
-        pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
-        pldm::Response response;
+    scope.spawn(
+        stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
+            pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
+            pldm::Response response;
 
-        auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
-        requestPtr->hdr.instance_id = instanceId;
+            auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
+            requestPtr->hdr.instance_id = instanceId;
 
-        co_await reqHandler.sendRecvMsg(eid, std::move(request));
+            co_await reqHandler.sendRecvMsg(eid, std::move(request));
 
-        EXPECT_TRUE(false); // unreachable
-    }) | stdexec::upon_stopped([&] { stopped = true; }),
-                exec::default_task_context<void>(exec::inline_scheduler{}));
+            EXPECT_TRUE(false); // unreachable
+        }) | stdexec::upon_stopped([&] { stopped = true; }),
+        exec::default_task_context<void>(exec::inline_scheduler{}));
 
     scope.request_stop();
 
@@ -234,9 +236,9 @@
 {
     struct _
     {
-        static exec::task<uint8_t> getTIDTask(Handler<MockRequest>& handler,
-                                              mctp_eid_t eid,
-                                              uint8_t instanceId, uint8_t& tid)
+        static exec::task<uint8_t>
+            getTIDTask(Handler<MockRequest>& handler, mctp_eid_t eid,
+                       uint8_t instanceId, uint8_t& tid)
         {
             pldm::Request request(sizeof(pldm_msg_hdr), 0);
             auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
@@ -268,12 +270,13 @@
     // Execute a coroutine to send getTID command. The coroutine is suspended
     // until reqHandler.handleResponse() is received.
     scope.spawn(stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
-        uint8_t respTid = 0;
+                    uint8_t respTid = 0;
 
-        co_await _::getTIDTask(reqHandler, eid, instanceId, respTid);
+                    co_await _::getTIDTask(reqHandler, eid, instanceId,
+                                           respTid);
 
-        EXPECT_EQ(expectedTid, respTid);
-    }),
+                    EXPECT_EQ(expectedTid, respTid);
+                }),
                 exec::default_task_context<void>(exec::inline_scheduler{}));
 
     pldm::Response mockResponse(sizeof(pldm_msg_hdr) + PLDM_GET_TID_RESP_BYTES,
diff --git a/requester/test/mctp_endpoint_discovery_test.cpp b/requester/test/mctp_endpoint_discovery_test.cpp
index df390a0..f955bc0 100644
--- a/requester/test/mctp_endpoint_discovery_test.cpp
+++ b/requester/test/mctp_endpoint_discovery_test.cpp
@@ -30,8 +30,8 @@
     EXPECT_CALL(manager2, handleMctpEndpoints(_)).Times(1);
 
     auto mctpDiscoveryHandler = std::make_unique<pldm::MctpDiscovery>(
-        bus, std::initializer_list<pldm::MctpDiscoveryHandlerIntf*>{&manager1,
-                                                                    &manager2});
+        bus, std::initializer_list<pldm::MctpDiscoveryHandlerIntf*>{
+                 &manager1, &manager2});
     mctpDiscoveryHandler = nullptr;
 }
 
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index d3c2284..1a5911b 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -39,8 +39,7 @@
 
 SoftPowerOff::SoftPowerOff(sdbusplus::bus_t& bus, sd_event* event,
                            pldm::InstanceIdDb& instanceIdDb) :
-    bus(bus),
-    timer(event), instanceIdDb(instanceIdDb)
+    bus(bus), timer(event), instanceIdDb(instanceIdDb)
 {
     auto jsonData = parseConfig();
 
@@ -154,8 +153,8 @@
 
 Json SoftPowerOff::parseConfig()
 {
-    fs::path softoffConfigJson(fs::path(SOFTOFF_CONFIG_JSON) /
-                               "softoff_config.json");
+    fs::path softoffConfigJson(
+        fs::path(SOFTOFF_CONFIG_JSON) / "softoff_config.json");
 
     if (!fs::exists(softoffConfigJson) || fs::is_empty(softoffConfigJson))
     {
@@ -256,8 +255,8 @@
                 sensorOffset = offset;
                 break;
             }
-            possibleStatesStart += possibleStateSize + sizeof(setId) +
-                                   sizeof(possibleStateSize);
+            possibleStatesStart +=
+                possibleStateSize + sizeof(setId) + sizeof(possibleStateSize);
         }
     }
     catch (const sdbusplus::exception_t& e)
@@ -281,9 +280,9 @@
     // TODO: fix mapping to work around OpenBMC ecosystem deficiencies
     pldm_tid_t pldmTID = static_cast<pldm_tid_t>(mctpEID);
 
-    std::array<uint8_t, sizeof(pldm_msg_hdr) + sizeof(effecterID) +
-                            sizeof(effecterCount) +
-                            sizeof(set_effecter_state_field)>
+    std::array<uint8_t,
+               sizeof(pldm_msg_hdr) + sizeof(effecterID) +
+                   sizeof(effecterCount) + sizeof(set_effecter_state_field)>
         requestMsg{};
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     set_effecter_state_field stateField{
@@ -316,8 +315,8 @@
                std::chrono::seconds{1}, std::move(timerCallback));
 
     // Add a callback to handle EPOLLIN on fd
-    auto callback = [=, &pldmTransport, this](IO& io, int fd,
-                                              uint32_t revents) mutable {
+    auto callback = [=, &pldmTransport,
+                     this](IO& io, int fd, uint32_t revents) mutable {
         if (fd != pldmTransport.getEventSource())
         {
             return;
@@ -341,8 +340,8 @@
             return;
         }
 
-        std::unique_ptr<void, decltype(std::free)*> responseMsgPtr{responseMsg,
-                                                                   std::free};
+        std::unique_ptr<void, decltype(std::free)*> responseMsgPtr{
+            responseMsg, std::free};
 
         // We've got the response meant for the PLDM request msg that was
         // sent out
diff --git a/utilities/requester/set_state_effecter.cpp b/utilities/requester/set_state_effecter.cpp
index 3287c4b..3774054 100644
--- a/utilities/requester/set_state_effecter.cpp
+++ b/utilities/requester/set_state_effecter.cpp
@@ -22,9 +22,9 @@
 
     // Encode PLDM Request message
     uint8_t effecterCount = 1;
-    std::array<uint8_t, sizeof(pldm_msg_hdr) + sizeof(effecterId) +
-                            sizeof(effecterCount) +
-                            sizeof(set_effecter_state_field)>
+    std::array<uint8_t,
+               sizeof(pldm_msg_hdr) + sizeof(effecterId) +
+                   sizeof(effecterCount) + sizeof(set_effecter_state_field)>
         requestMsg{};
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     set_effecter_state_field stateField{PLDM_REQUEST_SET, state};
diff --git a/utilities/requester/set_state_effecter_async.cpp b/utilities/requester/set_state_effecter_async.cpp
index f11f5e4..6420328 100644
--- a/utilities/requester/set_state_effecter_async.cpp
+++ b/utilities/requester/set_state_effecter_async.cpp
@@ -29,9 +29,9 @@
 
     // Encode PLDM Request message
     uint8_t effecterCount = 1;
-    std::array<uint8_t, sizeof(pldm_msg_hdr) + sizeof(effecterId) +
-                            sizeof(effecterCount) +
-                            sizeof(set_effecter_state_field)>
+    std::array<uint8_t,
+               sizeof(pldm_msg_hdr) + sizeof(effecterId) +
+                   sizeof(effecterCount) + sizeof(set_effecter_state_field)>
         requestMsg{};
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
     set_effecter_state_field stateField{PLDM_REQUEST_SET, state};
@@ -49,8 +49,8 @@
 
     // Create event loop and add a callback to handle EPOLLIN on fd
     auto event = Event::get_default();
-    auto callback = [=, &pldmTransport](IO& io, int fd,
-                                        uint32_t revents) mutable {
+    auto callback = [=,
+                     &pldmTransport](IO& io, int fd, uint32_t revents) mutable {
         if (!(revents & EPOLLIN))
         {
             return;
