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
  *
