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/ext_interface.cpp b/ext_interface.cpp
index 2dec009..fec4535 100644
--- a/ext_interface.cpp
+++ b/ext_interface.cpp
@@ -61,8 +61,8 @@
 {
     auto bus = sdbusplus::bus::new_default();
 
-    auto rebootSvc = getService(bus, REBOOTCOUNTER_INTERFACE,
-                                REBOOTCOUNTER_PATH);
+    auto rebootSvc =
+        getService(bus, REBOOTCOUNTER_INTERFACE, REBOOTCOUNTER_PATH);
 
     auto method = bus.new_method_call(rebootSvc.c_str(), REBOOTCOUNTER_PATH,
                                       "org.freedesktop.DBus.Properties", "Get");
diff --git a/extensions/phal/create_pel.cpp b/extensions/phal/create_pel.cpp
index d3810ef..a61c080 100644
--- a/extensions/phal/create_pel.cpp
+++ b/extensions/phal/create_pel.cpp
@@ -104,11 +104,11 @@
                             static_cast<uint8_t>(0xCA),
                             static_cast<uint8_t>(0x01), ffdcFile.getFileFD()));
 
-        std::string service = util::getService(bus, loggingObjectPath,
-                                               loggingInterface);
-        auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
-                                          loggingInterface,
-                                          "CreateWithFFDCFiles");
+        std::string service =
+            util::getService(bus, loggingObjectPath, loggingInterface);
+        auto method =
+            bus.new_method_call(service.c_str(), loggingObjectPath,
+                                loggingInterface, "CreateWithFFDCFiles");
         auto level =
             sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
                 severity);
@@ -204,11 +204,11 @@
 
     try
     {
-        std::string service = util::getService(bus, loggingObjectPath,
-                                               opLoggingInterface);
-        auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
-                                          opLoggingInterface,
-                                          "CreatePELWithFFDCFiles");
+        std::string service =
+            util::getService(bus, loggingObjectPath, opLoggingInterface);
+        auto method =
+            bus.new_method_call(service.c_str(), loggingObjectPath,
+                                opLoggingInterface, "CreatePELWithFFDCFiles");
         auto level =
             sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
                 severity);
@@ -224,11 +224,11 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        log<level::ERR>(std::format("D-Bus call exception",
-                                    "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
-                                    loggingObjectPath, loggingInterface,
-                                    e.what())
-                            .c_str());
+        log<level::ERR>(
+            std::format("D-Bus call exception",
+                        "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
+                        loggingObjectPath, loggingInterface, e.what())
+                .c_str());
         throw std::runtime_error(
             "Error in invoking D-Bus logging create interface");
     }
@@ -253,8 +253,8 @@
 
     try
     {
-        std::string service = util::getService(bus, loggingObjectPath,
-                                               loggingInterface);
+        std::string service =
+            util::getService(bus, loggingObjectPath, loggingInterface);
         auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
                                           loggingInterface, "Create");
         auto level =
@@ -265,11 +265,11 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        log<level::ERR>(std::format("sdbusplus D-Bus call exception",
-                                    "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
-                                    loggingObjectPath, loggingInterface,
-                                    e.what())
-                            .c_str());
+        log<level::ERR>(
+            std::format("sdbusplus D-Bus call exception",
+                        "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
+                        loggingObjectPath, loggingInterface, e.what())
+                .c_str());
         ;
 
         throw std::runtime_error(
diff --git a/extensions/phal/dump_utils.cpp b/extensions/phal/dump_utils.cpp
index dff3470..6d2a666 100644
--- a/extensions/phal/dump_utils.cpp
+++ b/extensions/phal/dump_utils.cpp
@@ -75,8 +75,8 @@
             sdbusplus::bus::match::rules::propertiesChanged(
                 path.c_str(), matchInterface.c_str()),
             [&](auto& msg) {
-        return dumpStatusChanged(msg, path, inProgress);
-    });
+                return dumpStatusChanged(msg, path, inProgress);
+            });
 
     // wait for dump status to be completed (complete == true)
     // or until timeout interval
@@ -117,8 +117,8 @@
     try
     {
         std::string service = util::getService(bus, path, interface);
-        auto method = bus.new_method_call(service.c_str(), path, interface,
-                                          function);
+        auto method =
+            bus.new_method_call(service.c_str(), path, interface, function);
 
         // dbus call arguments
         std::map<std::string, std::variant<std::string, uint64_t>> createParams;
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index e249595..8677b6a 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -325,8 +325,8 @@
     for_each(
         traceLog.begin(), traceLog.end(),
         [&pelAdditionalData](std::pair<std::string, std::string>& ele) -> void {
-        pelAdditionalData.emplace_back(ele.first, ele.second);
-    });
+            pelAdditionalData.emplace_back(ele.first, ele.second);
+        });
     openpower::pel::createErrorPEL(
         "org.open_power.PHAL.Error.NonFunctionalBootProc", jsonCalloutDataList,
         pelAdditionalData, Severity::Error);
@@ -370,11 +370,11 @@
                  ffdc->hwp_errorinfo.ffdcs_data.end(),
                  [&pelAdditionalData, &ffdc_prefix](
                      std::pair<std::string, std::string>& ele) -> void {
-            std::string keyWithPrefix(ffdc_prefix + "FFDC_");
-            keyWithPrefix.append(ele.first);
+                     std::string keyWithPrefix(ffdc_prefix + "FFDC_");
+                     keyWithPrefix.append(ele.first);
 
-            pelAdditionalData.emplace_back(keyWithPrefix, ele.second);
-        });
+                     pelAdditionalData.emplace_back(keyWithPrefix, ele.second);
+                 });
         // get clock position information
         auto clk_pos = 0xFF; // Invalid position.
         for (auto& hwCallout : ffdc->hwp_errorinfo.hwcallouts)
@@ -392,21 +392,22 @@
                  ffdc->hwp_errorinfo.cdg_targets.end(),
                  [&pelAdditionalData, &jsonCalloutDataList,
                   clk_pos](const CDG_Target& cdg_tgt) -> void {
-            json jsonCalloutData;
-            std::string pelPriority = "L";
-            jsonCalloutData["Priority"] = pelPriority; // Not used
-            jsonCalloutData["SymbolicFRU"] = "REFCLK" + std::to_string(clk_pos);
-            jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
-            jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
-            jsonCalloutDataList.emplace_back(jsonCalloutData);
-        });
+                     json jsonCalloutData;
+                     std::string pelPriority = "L";
+                     jsonCalloutData["Priority"] = pelPriority; // Not used
+                     jsonCalloutData["SymbolicFRU"] =
+                         "REFCLK" + std::to_string(clk_pos);
+                     jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
+                     jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
+                     jsonCalloutDataList.emplace_back(jsonCalloutData);
+                 });
 
         // Adding collected phal logs into PEL additional data
         for_each(traceLog.begin(), traceLog.end(),
                  [&pelAdditionalData](
                      std::pair<std::string, std::string>& ele) -> void {
-            pelAdditionalData.emplace_back(ele.first, ele.second);
-        });
+                     pelAdditionalData.emplace_back(ele.first, ele.second);
+                 });
 
         openpower::pel::createErrorPEL("org.open_power.PHAL.Error.SpareClock",
                                        jsonCalloutDataList, pelAdditionalData,
@@ -534,8 +535,8 @@
         for_each(traceLog.begin(), traceLog.end(),
                  [&pelAdditionalData](
                      std::pair<std::string, std::string>& ele) -> void {
-            pelAdditionalData.emplace_back(ele.first, ele.second);
-        });
+                     pelAdditionalData.emplace_back(ele.first, ele.second);
+                 });
 
         openpower::pel::createErrorPEL("org.open_power.PHAL.Error.Boot", {},
                                        pelAdditionalData,
@@ -586,38 +587,88 @@
                      ffdc->hwp_errorinfo.ffdcs_data.end(),
                      [&pelAdditionalData, &ffdc_prefix](
                          std::pair<std::string, std::string>& ele) -> void {
-                std::string keyWithPrefix(ffdc_prefix + "FFDC_");
-                keyWithPrefix.append(ele.first);
+                         std::string keyWithPrefix(ffdc_prefix + "FFDC_");
+                         keyWithPrefix.append(ele.first);
 
-                pelAdditionalData.emplace_back(keyWithPrefix, ele.second);
-            });
+                         pelAdditionalData.emplace_back(keyWithPrefix,
+                                                        ele.second);
+                     });
 
             // Adding hardware callout details
             int calloutCount = 0;
-            for_each(ffdc->hwp_errorinfo.hwcallouts.begin(),
-                     ffdc->hwp_errorinfo.hwcallouts.end(),
-                     [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
-                      &ffdc_prefix](const HWCallout& hwCallout) -> void {
-                calloutCount++;
-                std::stringstream keyPrefix;
-                keyPrefix << ffdc_prefix << "HW_CO_" << std::setfill('0')
-                          << std::setw(2) << calloutCount << "_";
+            for_each(
+                ffdc->hwp_errorinfo.hwcallouts.begin(),
+                ffdc->hwp_errorinfo.hwcallouts.end(),
+                [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
+                 &ffdc_prefix](const HWCallout& hwCallout) -> void {
+                    calloutCount++;
+                    std::stringstream keyPrefix;
+                    keyPrefix << ffdc_prefix << "HW_CO_" << std::setfill('0')
+                              << std::setw(2) << calloutCount << "_";
 
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("HW_ID"),
-                    hwCallout.hwid);
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("HW_ID"),
+                        hwCallout.hwid);
 
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("PRIORITY"),
-                    hwCallout.callout_priority);
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("PRIORITY"),
+                        hwCallout.callout_priority);
 
-                // Log target details only if entity path is
-                // available. For example target entity path will not
-                // be available for non-hwp clock failure.
-                if (!hwCallout.target_entity_path.empty())
-                {
+                    // Log target details only if entity path is
+                    // available. For example target entity path will not
+                    // be available for non-hwp clock failure.
+                    if (!hwCallout.target_entity_path.empty())
+                    {
+                        phal::TargetInfo targetInfo;
+                        phal::getTgtReqAttrsVal(hwCallout.target_entity_path,
+                                                targetInfo);
+
+                        std::string locationCode =
+                            std::string(targetInfo.locationCode);
+                        pelAdditionalData.emplace_back(
+                            std::string(keyPrefix.str()).append("LOC_CODE"),
+                            locationCode);
+
+                        std::string physPath =
+                            std::string(targetInfo.physDevPath);
+                        pelAdditionalData.emplace_back(
+                            std::string(keyPrefix.str()).append("PHYS_PATH"),
+                            physPath);
+                    }
+
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("CLK_POS"),
+                        std::to_string(hwCallout.clkPos));
+
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("CALLOUT_PLANAR"),
+                        (hwCallout.isPlanarCallout == true ? "true" : "false"));
+
+                    std::string pelPriority =
+                        getPelPriority(hwCallout.callout_priority);
+
+                    if (hwCallout.isPlanarCallout)
+                    {
+                        addPlanarCallout(jsonCalloutDataList, pelPriority);
+                    }
+                });
+
+            // Adding CDG (callout, deconfigure and guard) targets details
+            calloutCount = 0;
+            for_each(
+                ffdc->hwp_errorinfo.cdg_targets.begin(),
+                ffdc->hwp_errorinfo.cdg_targets.end(),
+                [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
+                 &ffdc_prefix](const CDG_Target& cdg_tgt) -> void {
+                    calloutCount++;
+                    std::stringstream keyPrefix;
+                    keyPrefix << ffdc_prefix << "CDG_TGT_" << std::setfill('0')
+                              << std::setw(2) << calloutCount << "_";
+
                     phal::TargetInfo targetInfo;
-                    phal::getTgtReqAttrsVal(hwCallout.target_entity_path,
+                    targetInfo.deconfigure = cdg_tgt.deconfigure;
+
+                    phal::getTgtReqAttrsVal(cdg_tgt.target_entity_path,
                                             targetInfo);
 
                     std::string locationCode =
@@ -625,93 +676,51 @@
                     pelAdditionalData.emplace_back(
                         std::string(keyPrefix.str()).append("LOC_CODE"),
                         locationCode);
-
                     std::string physPath = std::string(targetInfo.physDevPath);
                     pelAdditionalData.emplace_back(
                         std::string(keyPrefix.str()).append("PHYS_PATH"),
                         physPath);
-                }
 
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("CLK_POS"),
-                    std::to_string(hwCallout.clkPos));
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("CO_REQ"),
+                        (cdg_tgt.callout == true ? "true" : "false"));
 
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("CALLOUT_PLANAR"),
-                    (hwCallout.isPlanarCallout == true ? "true" : "false"));
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("CO_PRIORITY"),
+                        cdg_tgt.callout_priority);
 
-                std::string pelPriority =
-                    getPelPriority(hwCallout.callout_priority);
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("DECONF_REQ"),
+                        (cdg_tgt.deconfigure == true ? "true" : "false"));
 
-                if (hwCallout.isPlanarCallout)
-                {
-                    addPlanarCallout(jsonCalloutDataList, pelPriority);
-                }
-            });
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("GUARD_REQ"),
+                        (cdg_tgt.guard == true ? "true" : "false"));
 
-            // Adding CDG (callout, deconfigure and guard) targets details
-            calloutCount = 0;
-            for_each(ffdc->hwp_errorinfo.cdg_targets.begin(),
-                     ffdc->hwp_errorinfo.cdg_targets.end(),
-                     [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
-                      &ffdc_prefix](const CDG_Target& cdg_tgt) -> void {
-                calloutCount++;
-                std::stringstream keyPrefix;
-                keyPrefix << ffdc_prefix << "CDG_TGT_" << std::setfill('0')
-                          << std::setw(2) << calloutCount << "_";
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("GUARD_TYPE"),
+                        cdg_tgt.guard_type);
 
-                phal::TargetInfo targetInfo;
-                targetInfo.deconfigure = cdg_tgt.deconfigure;
+                    json jsonCalloutData;
+                    jsonCalloutData["LocationCode"] = locationCode;
+                    std::string pelPriority =
+                        getPelPriority(cdg_tgt.callout_priority);
+                    jsonCalloutData["Priority"] = pelPriority;
 
-                phal::getTgtReqAttrsVal(cdg_tgt.target_entity_path, targetInfo);
+                    if (targetInfo.mruId != 0)
+                    {
+                        jsonCalloutData["MRUs"] = json::array({
+                            {{"ID", targetInfo.mruId},
+                             {"Priority", pelPriority}},
+                        });
+                    }
+                    jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
+                    jsonCalloutData["Guarded"] = cdg_tgt.guard;
+                    jsonCalloutData["GuardType"] = cdg_tgt.guard_type;
+                    jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
 
-                std::string locationCode = std::string(targetInfo.locationCode);
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("LOC_CODE"),
-                    locationCode);
-                std::string physPath = std::string(targetInfo.physDevPath);
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("PHYS_PATH"), physPath);
-
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("CO_REQ"),
-                    (cdg_tgt.callout == true ? "true" : "false"));
-
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("CO_PRIORITY"),
-                    cdg_tgt.callout_priority);
-
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("DECONF_REQ"),
-                    (cdg_tgt.deconfigure == true ? "true" : "false"));
-
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("GUARD_REQ"),
-                    (cdg_tgt.guard == true ? "true" : "false"));
-
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("GUARD_TYPE"),
-                    cdg_tgt.guard_type);
-
-                json jsonCalloutData;
-                jsonCalloutData["LocationCode"] = locationCode;
-                std::string pelPriority =
-                    getPelPriority(cdg_tgt.callout_priority);
-                jsonCalloutData["Priority"] = pelPriority;
-
-                if (targetInfo.mruId != 0)
-                {
-                    jsonCalloutData["MRUs"] = json::array({
-                        {{"ID", targetInfo.mruId}, {"Priority", pelPriority}},
-                    });
-                }
-                jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
-                jsonCalloutData["Guarded"] = cdg_tgt.guard;
-                jsonCalloutData["GuardType"] = cdg_tgt.guard_type;
-                jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
-
-                jsonCalloutDataList.emplace_back(jsonCalloutData);
-            });
+                    jsonCalloutDataList.emplace_back(jsonCalloutData);
+                });
             // Adding procedure callout
             calloutCount = 0;
             for_each(
@@ -719,26 +728,26 @@
                 ffdc->hwp_errorinfo.procedures_callout.end(),
                 [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
                  &ffdc_prefix](const ProcedureCallout& procCallout) -> void {
-                calloutCount++;
-                std::stringstream keyPrefix;
-                keyPrefix << ffdc_prefix << "PROC_CO_" << std::setfill('0')
-                          << std::setw(2) << calloutCount << "_";
+                    calloutCount++;
+                    std::stringstream keyPrefix;
+                    keyPrefix << ffdc_prefix << "PROC_CO_" << std::setfill('0')
+                              << std::setw(2) << calloutCount << "_";
 
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("PRIORITY"),
-                    procCallout.callout_priority);
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("PRIORITY"),
+                        procCallout.callout_priority);
 
-                pelAdditionalData.emplace_back(
-                    std::string(keyPrefix.str()).append("MAINT_PROCEDURE"),
-                    procCallout.proc_callout);
+                    pelAdditionalData.emplace_back(
+                        std::string(keyPrefix.str()).append("MAINT_PROCEDURE"),
+                        procCallout.proc_callout);
 
-                json jsonCalloutData;
-                jsonCalloutData["Procedure"] = procCallout.proc_callout;
-                std::string pelPriority =
-                    getPelPriority(procCallout.callout_priority);
-                jsonCalloutData["Priority"] = pelPriority;
-                jsonCalloutDataList.emplace_back(jsonCalloutData);
-            });
+                    json jsonCalloutData;
+                    jsonCalloutData["Procedure"] = procCallout.proc_callout;
+                    std::string pelPriority =
+                        getPelPriority(procCallout.callout_priority);
+                    jsonCalloutData["Priority"] = pelPriority;
+                    jsonCalloutDataList.emplace_back(jsonCalloutData);
+                });
         }
         else if ((ffdc->ffdc_type != FFDC_TYPE_NONE) &&
                  (ffdc->ffdc_type != FFDC_TYPE_UNSUPPORTED))
@@ -754,8 +763,8 @@
         for_each(traceLog.begin(), traceLog.end(),
                  [&pelAdditionalData](
                      std::pair<std::string, std::string>& ele) -> void {
-            pelAdditionalData.emplace_back(ele.first, ele.second);
-        });
+                     pelAdditionalData.emplace_back(ele.first, ele.second);
+                 });
 
         // TODO: #ibm-openbmc/dev/issues/2595 : Once enabled this support,
         // callout details is not required to sort in H,M and L orders which
@@ -764,21 +773,24 @@
         // i.e High -> Medium -> Low.
         std::sort(jsonCalloutDataList.begin(), jsonCalloutDataList.end(),
                   [](const json& aEle, const json& bEle) -> bool {
-            // Considering b element having higher priority than a element
-            // or Both element will be same priorty (to keep same order
-            // which are given by phal when two callouts are having same
-            // priority)
-            if (((aEle["Priority"] == "M") && (bEle["Priority"] == "H")) ||
-                ((aEle["Priority"] == "L") &&
-                 ((bEle["Priority"] == "H") || (bEle["Priority"] == "M"))) ||
-                (aEle["Priority"] == bEle["Priority"]))
-            {
-                return false;
-            }
+                      // Considering b element having higher priority than a
+                      // element or Both element will be same priorty (to keep
+                      // same order which are given by phal when two callouts
+                      // are having same priority)
+                      if (((aEle["Priority"] == "M") &&
+                           (bEle["Priority"] == "H")) ||
+                          ((aEle["Priority"] == "L") &&
+                           ((bEle["Priority"] == "H") ||
+                            (bEle["Priority"] == "M"))) ||
+                          (aEle["Priority"] == bEle["Priority"]))
+                      {
+                          return false;
+                      }
 
-            // Considering a element having higher priority than b element
-            return true;
-        });
+                      // Considering a element having higher priority than b
+                      // element
+                      return true;
+                  });
         openpower::pel::createErrorPEL("org.open_power.PHAL.Error.Boot",
                                        jsonCalloutDataList, pelAdditionalData,
                                        Severity::Error);
@@ -861,8 +873,8 @@
     for_each(
         traceLog.begin(), traceLog.end(),
         [&pelAdditionalData](std::pair<std::string, std::string>& ele) -> void {
-        pelAdditionalData.emplace_back(ele.first, ele.second);
-    });
+            pelAdditionalData.emplace_back(ele.first, ele.second);
+        });
 
     // reset the trace log and counter
     reset();
@@ -925,8 +937,8 @@
     uint32_t index = pdbg_target_index(procTarget);
     pelAdditionalData.emplace_back("SRC6", std::to_string(index << 16));
     // Create SBE Error with FFDC data.
-    auto logId = createSbeErrorPEL(event, sbeError, pelAdditionalData,
-                                   procTarget);
+    auto logId =
+        createSbeErrorPEL(event, sbeError, pelAdditionalData, procTarget);
 
     if (dumpIsRequired)
     {
@@ -954,8 +966,8 @@
     for_each(
         traceLog.begin(), traceLog.end(),
         [&pelAdditionalData](std::pair<std::string, std::string>& ele) -> void {
-        pelAdditionalData.emplace_back(ele.first, ele.second);
-    });
+            pelAdditionalData.emplace_back(ele.first, ele.second);
+        });
 
     openpower::pel::createPEL("org.open_power.PHAL.Error.GuardPartitionAccess",
                               pelAdditionalData);
diff --git a/procedures/phal/reinit_devtree.cpp b/procedures/phal/reinit_devtree.cpp
index f0cf22e..5ad0385 100644
--- a/procedures/phal/reinit_devtree.cpp
+++ b/procedures/phal/reinit_devtree.cpp
@@ -165,9 +165,9 @@
             }
 
             // Step 1: export devtree data based on the reinit attribute list.
-            auto ret = dtree_cronus_export(CEC_DEVTREE_RW_PATH, CEC_INFODB_PATH,
-                                           DEVTREE_REINIT_ATTRS_LIST,
-                                           fpExport.get());
+            auto ret =
+                dtree_cronus_export(CEC_DEVTREE_RW_PATH, CEC_INFODB_PATH,
+                                    DEVTREE_REINIT_ATTRS_LIST, fpExport.get());
             if (ret)
             {
                 log<level::ERR>(
diff --git a/procedures/phal/start_host.cpp b/procedures/phal/start_host.cpp
index e6f01ec..51e46ab 100644
--- a/procedures/phal/start_host.cpp
+++ b/procedures/phal/start_host.cpp
@@ -180,10 +180,9 @@
  *
  * @return void
  */
-static void
-    createPELForHwIsolationSettingsErr(const std::string& procedureCode,
-                                       const std::string& priority,
-                                       const pel::FFDCData& additionalData)
+static void createPELForHwIsolationSettingsErr(
+    const std::string& procedureCode, const std::string& priority,
+    const pel::FFDCData& additionalData)
 {
     try
     {
diff --git a/targeting.cpp b/targeting.cpp
index e568bcd..6f5b9d2 100644
--- a/targeting.cpp
+++ b/targeting.cpp
@@ -62,8 +62,7 @@
 
 Targeting::Targeting(const std::string& fsiMasterDev,
                      const std::string& fsiSlaveDir) :
-    fsiMasterPath(fsiMasterDev),
-    fsiSlaveBasePath(fsiSlaveDir)
+    fsiMasterPath(fsiMasterDev), fsiSlaveBasePath(fsiSlaveDir)
 {
     std::regex exp{"fsi1/slave@([0-9]{2}):00", std::regex::extended};
 
diff --git a/temporary_file.cpp b/temporary_file.cpp
index 6352736..0dcf198 100644
--- a/temporary_file.cpp
+++ b/temporary_file.cpp
@@ -16,8 +16,8 @@
 TemporaryFile::TemporaryFile()
 {
     // Build template path required by mkstemp()
-    std::string templatePath = fs::temp_directory_path() /
-                               "openpower-proc-control-XXXXXX";
+    std::string templatePath =
+        fs::temp_directory_path() / "openpower-proc-control-XXXXXX";
 
     // Generate unique file name, create file, and open it.  The XXXXXX
     // characters are replaced by mkstemp() to make the file name unique.
