diff --git a/src/main.cpp b/src/main.cpp
index bea8a13..59a2d30 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -20,13 +20,13 @@
 
     signals.async_wait(
         [&ioc](const boost::system::error_code ec, const int& sig) {
-            if (ec)
-            {
-                throw std::runtime_error("Signal should not be canceled");
-            }
+        if (ec)
+        {
+            throw std::runtime_error("Signal should not be canceled");
+        }
 
-            ioc.stop();
-        });
+        ioc.stop();
+    });
 
     phosphor::logging::log<phosphor::logging::level::INFO>(
         "Telemetry starting");
diff --git a/src/metric.cpp b/src/metric.cpp
index f7a0642..222af3c 100644
--- a/src/metric.cpp
+++ b/src/metric.cpp
@@ -30,12 +30,12 @@
 
 void Metric::unregisterFromUpdates(interfaces::MetricListener& listener)
 {
-    listeners.erase(
-        std::remove_if(listeners.begin(), listeners.end(),
-                       [&listener](const interfaces::MetricListener& item) {
-                           return &item == &listener;
-                       }),
-        listeners.end());
+    listeners.erase(std::remove_if(
+                        listeners.begin(), listeners.end(),
+                        [&listener](const interfaces::MetricListener& item) {
+        return &item == &listener;
+                        }),
+                    listeners.end());
 }
 
 void Metric::initialize()
@@ -108,9 +108,10 @@
 metrics::CollectionData&
     Metric::findAssociatedData(const interfaces::Sensor& notifier)
 {
-    auto it = std::find_if(
-        sensors.begin(), sensors.end(),
-        [&notifier](const auto& sensor) { return sensor.get() == &notifier; });
+    auto it = std::find_if(sensors.begin(), sensors.end(),
+                           [&notifier](const auto& sensor) {
+        return sensor.get() == &notifier;
+    });
     auto index = std::distance(sensors.begin(), it);
     return *collectionAlgorithms.at(index);
 }
diff --git a/src/metrics/collection_data.cpp b/src/metrics/collection_data.cpp
index 7ab5354..3610cba 100644
--- a/src/metrics/collection_data.cpp
+++ b/src/metrics/collection_data.cpp
@@ -85,8 +85,8 @@
 
         if (timestamp > duration.t)
         {
-            readings.front().first =
-                std::max(readings.front().first, timestamp - duration.t);
+            readings.front().first = std::max(readings.front().first,
+                                              timestamp - duration.t);
         }
     }
 
@@ -139,9 +139,8 @@
         case CollectionTimeScope::interval:
             std::generate_n(std::back_inserter(result), size,
                             [cf = makeCollectionFunction(op), duration] {
-                                return std::make_unique<DataInterval>(cf,
-                                                                      duration);
-                            });
+                return std::make_unique<DataInterval>(cf, duration);
+            });
             break;
         case CollectionTimeScope::point:
             std::generate_n(std::back_inserter(result), size,
@@ -150,8 +149,8 @@
         case CollectionTimeScope::startup:
             std::generate_n(std::back_inserter(result), size,
                             [cf = makeCollectionFunction(op)] {
-                                return std::make_unique<DataStartup>(cf);
-                            });
+                return std::make_unique<DataStartup>(cf);
+            });
             break;
     }
 
diff --git a/src/metrics/collection_function.cpp b/src/metrics/collection_function.cpp
index 717bb68..7170936 100644
--- a/src/metrics/collection_function.cpp
+++ b/src/metrics/collection_function.cpp
@@ -14,10 +14,8 @@
         return std::min_element(
                    readings.begin(), readings.end(),
                    [](const auto& left, const auto& right) {
-                       return std::make_tuple(!std::isfinite(left.second),
-                                              left.second) <
-                              std::make_tuple(!std::isfinite(right.second),
-                                              right.second);
+            return std::make_tuple(!std::isfinite(left.second), left.second) <
+                   std::make_tuple(!std::isfinite(right.second), right.second);
                    })
             ->second;
     }
@@ -40,10 +38,8 @@
         return std::max_element(
                    readings.begin(), readings.end(),
                    [](const auto& left, const auto& right) {
-                       return std::make_tuple(std::isfinite(left.second),
-                                              left.second) <
-                              std::make_tuple(std::isfinite(right.second),
-                                              right.second);
+            return std::make_tuple(std::isfinite(left.second), left.second) <
+                   std::make_tuple(std::isfinite(right.second), right.second);
                    })
             ->second;
     }
diff --git a/src/numeric_threshold.cpp b/src/numeric_threshold.cpp
index 0b60dac..5980e23 100644
--- a/src/numeric_threshold.cpp
+++ b/src/numeric_threshold.cpp
@@ -57,10 +57,10 @@
         return;
     }
 
-    bool crossedDecreasing =
-        thresholdValue < prevValue && thresholdValue > value;
-    bool crossedIncreasing =
-        thresholdValue > prevValue && thresholdValue < value;
+    bool crossedDecreasing = thresholdValue < prevValue &&
+                             thresholdValue > value;
+    bool crossedIncreasing = thresholdValue > prevValue &&
+                             thresholdValue < value;
 
     if (!crossedDecreasing && !crossedIncreasing && thresholdValue == prevValue)
     {
diff --git a/src/report.cpp b/src/report.cpp
index 9e69b62..dbc1a9a 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -48,34 +48,34 @@
             return metric->dumpConfiguration();
         }));
 
-    readingParametersPastVersion =
-        utils::transform(readingParameters, [](const auto& item) {
-            const auto& [sensorData, operationType, id, collectionTimeScope,
-                         collectionDuration] = item;
+    readingParametersPastVersion = utils::transform(readingParameters,
+                                                    [](const auto& item) {
+        const auto& [sensorData, operationType, id, collectionTimeScope,
+                     collectionDuration] = item;
 
-            return ReadingParametersPastVersion::value_type(
-                std::get<0>(sensorData.front()), operationType, id,
-                std::get<1>(sensorData.front()));
-        });
+        return ReadingParametersPastVersion::value_type(
+            std::get<0>(sensorData.front()), operationType, id,
+            std::get<1>(sensorData.front()));
+    });
 
     reportActions.insert(ReportAction::logToMetricReportsCollection);
 
     deleteIface = objServer->add_unique_interface(
         getPath(), deleteIfaceName,
         [this, &ioc, &reportManager](auto& dbusIface) {
-            dbusIface.register_method("Delete", [this, &ioc, &reportManager] {
-                if (persistency)
-                {
-                    persistency = false;
+        dbusIface.register_method("Delete", [this, &ioc, &reportManager] {
+            if (persistency)
+            {
+                persistency = false;
 
-                    reportIface->signal_property("Persistency");
-                }
+                reportIface->signal_property("Persistency");
+            }
 
-                boost::asio::post(ioc, [this, &reportManager] {
-                    reportManager.removeReport(this);
-                });
+            boost::asio::post(ioc, [this, &reportManager] {
+                reportManager.removeReport(this);
             });
         });
+        });
 
     errorMessages = verify();
     state.set<ReportFlags::enabled, ReportFlags::valid>(enabledIn,
@@ -86,29 +86,29 @@
 
     messanger.on_receive<messages::TriggerPresenceChangedInd>(
         [this](const auto& msg) {
-            const auto oldSize = triggerIds.size();
+        const auto oldSize = triggerIds.size();
 
-            if (msg.presence == messages::Presence::Exist)
+        if (msg.presence == messages::Presence::Exist)
+        {
+            if (utils::contains(msg.reportIds, id))
             {
-                if (utils::contains(msg.reportIds, id))
-                {
-                    triggerIds.insert(msg.triggerId);
-                }
-                else if (!utils::contains(msg.reportIds, id))
-                {
-                    triggerIds.erase(msg.triggerId);
-                }
+                triggerIds.insert(msg.triggerId);
             }
-            else if (msg.presence == messages::Presence::Removed)
+            else if (!utils::contains(msg.reportIds, id))
             {
                 triggerIds.erase(msg.triggerId);
             }
+        }
+        else if (msg.presence == messages::Presence::Removed)
+        {
+            triggerIds.erase(msg.triggerId);
+        }
 
-            if (triggerIds.size() != oldSize)
-            {
-                reportIface->signal_property("Triggers");
-            }
-        });
+        if (triggerIds.size() != oldSize)
+        {
+            reportIface->signal_property("Triggers");
+        }
+    });
 
     messanger.on_receive<messages::UpdateReportInd>([this](const auto& msg) {
         if (utils::contains(msg.reportIds, id))
@@ -191,8 +191,8 @@
 
 void Report::setReadingBuffer(const ReportUpdates newReportUpdates)
 {
-    const auto newBufferSize =
-        deduceBufferSize(newReportUpdates, reportingType);
+    const auto newBufferSize = deduceBufferSize(newReportUpdates,
+                                                reportingType);
     if (readingsBuffer.size() != newBufferSize)
     {
         readingsBuffer.clearAndResize(newBufferSize);
@@ -211,73 +211,72 @@
 std::unique_ptr<sdbusplus::asio::dbus_interface>
     Report::makeReportInterface(const interfaces::ReportFactory& reportFactory)
 {
-    auto dbusIface =
-        objServer->add_unique_interface(getPath(), reportIfaceName);
+    auto dbusIface = objServer->add_unique_interface(getPath(),
+                                                     reportIfaceName);
     dbusIface->register_property_rw<bool>(
         "Enabled", sdbusplus::vtable::property_::emits_change,
         [this](bool newVal, auto& oldValue) {
-            if (newVal != state.get<ReportFlags::enabled>())
-            {
-                state.set<ReportFlags::enabled>(oldValue = newVal);
+        if (newVal != state.get<ReportFlags::enabled>())
+        {
+            state.set<ReportFlags::enabled>(oldValue = newVal);
 
-                persistency = storeConfiguration();
-            }
-            return 1;
+            persistency = storeConfiguration();
+        }
+        return 1;
         },
         [this](const auto&) { return state.get<ReportFlags::enabled>(); });
     dbusIface->register_property_r<
         std::vector<std::tuple<std::string, std::string>>>(
         "ErrorMessages", sdbusplus::vtable::property_::emits_change,
         [this](const auto&) {
-            return utils::transform(errorMessages, [](const auto& em) {
-                return std::tuple<std::string, std::string>(
-                    utils::enumToString(em.error), em.arg0);
-            });
+        return utils::transform(errorMessages, [](const auto& em) {
+            return std::tuple<std::string, std::string>(
+                utils::enumToString(em.error), em.arg0);
+        });
         });
     dbusIface->register_property_rw<uint64_t>(
         "Interval", sdbusplus::vtable::property_::emits_change,
         [this](uint64_t newVal, auto& oldVal) {
-            const Milliseconds newValT{newVal};
-            if (newValT < ReportManager::minInterval &&
-                newValT != Milliseconds{0})
+        const Milliseconds newValT{newVal};
+        if (newValT < ReportManager::minInterval && newValT != Milliseconds{0})
+        {
+            throw errors::InvalidArgument("Interval");
+        }
+
+        if (newValT != interval)
+        {
+            oldVal = newVal;
+            interval = newValT;
+
+            errorMessages = verify();
+            if (state.set<ReportFlags::valid>(errorMessages.empty()) ==
+                StateEvent::active)
             {
-                throw errors::InvalidArgument("Interval");
+                scheduleTimer();
             }
 
-            if (newValT != interval)
-            {
-                oldVal = newVal;
-                interval = newValT;
-
-                errorMessages = verify();
-                if (state.set<ReportFlags::valid>(errorMessages.empty()) ==
-                    StateEvent::active)
-                {
-                    scheduleTimer();
-                }
-
-                persistency = storeConfiguration();
-            }
-            return 1;
+            persistency = storeConfiguration();
+        }
+        return 1;
         },
         [this](const auto&) { return interval.count(); });
     dbusIface->register_property_rw<bool>(
         "Persistency", sdbusplus::vtable::property_::emits_change,
         [this](bool newVal, auto& oldVal) {
-            if (newVal == persistency)
-            {
-                return 1;
-            }
-            if (newVal)
-            {
-                persistency = oldVal = storeConfiguration();
-            }
-            else
-            {
-                reportStorage.remove(reportFileName());
-                persistency = oldVal = false;
-            }
+        if (newVal == persistency)
+        {
             return 1;
+        }
+        if (newVal)
+        {
+            persistency = oldVal = storeConfiguration();
+        }
+        else
+        {
+            reportStorage.remove(reportFileName());
+            persistency = oldVal = false;
+        }
+        return 1;
         },
         [this](const auto&) { return persistency; });
 
@@ -287,24 +286,24 @@
     dbusIface->register_property_rw<std::string>(
         "ReportingType", sdbusplus::vtable::property_::emits_change,
         [this](auto newVal, auto& oldVal) {
-            ReportingType tmp = utils::toReportingType(newVal);
-            if (tmp != reportingType)
+        ReportingType tmp = utils::toReportingType(newVal);
+        if (tmp != reportingType)
+        {
+            reportingType = tmp;
+            oldVal = std::move(newVal);
+
+            errorMessages = verify();
+            if (state.set<ReportFlags::valid>(errorMessages.empty()) ==
+                StateEvent::active)
             {
-                reportingType = tmp;
-                oldVal = std::move(newVal);
-
-                errorMessages = verify();
-                if (state.set<ReportFlags::valid>(errorMessages.empty()) ==
-                    StateEvent::active)
-                {
-                    scheduleTimer();
-                }
-
-                persistency = storeConfiguration();
-
-                setReadingBuffer(reportUpdates);
+                scheduleTimer();
             }
-            return 1;
+
+            persistency = storeConfiguration();
+
+            setReadingBuffer(reportUpdates);
+        }
+        return 1;
         },
         [this](const auto&) { return utils::enumToString(reportingType); });
     dbusIface->register_property_r(
@@ -315,60 +314,58 @@
         "ReadingParametersFutureVersion", readingParameters,
         sdbusplus::vtable::property_::emits_change,
         [this, &reportFactory](auto newVal, auto& oldVal) {
-            auto labeledMetricParams =
-                reportFactory.convertMetricParams(newVal);
-            ReportManager::verifyMetricParameters(labeledMetricParams);
-            reportFactory.updateMetrics(metrics,
-                                        state.get<ReportFlags::enabled>(),
-                                        labeledMetricParams);
-            readingParameters = toReadingParameters(
-                utils::transform(metrics, [](const auto& metric) {
-                    return metric->dumpConfiguration();
-                }));
-            metricCount = getMetricCount(metrics);
-            setReadingBuffer(reportUpdates);
-            persistency = storeConfiguration();
-            oldVal = std::move(newVal);
-            return 1;
+        auto labeledMetricParams = reportFactory.convertMetricParams(newVal);
+        ReportManager::verifyMetricParameters(labeledMetricParams);
+        reportFactory.updateMetrics(metrics, state.get<ReportFlags::enabled>(),
+                                    labeledMetricParams);
+        readingParameters = toReadingParameters(
+            utils::transform(metrics, [](const auto& metric) {
+                return metric->dumpConfiguration();
+            }));
+        metricCount = getMetricCount(metrics);
+        setReadingBuffer(reportUpdates);
+        persistency = storeConfiguration();
+        oldVal = std::move(newVal);
+        return 1;
         },
         [this](const auto&) { return readingParameters; });
-    dbusIface->register_property_r<bool>(
-        "EmitsReadingsUpdate", sdbusplus::vtable::property_::none,
-        [this](const auto&) {
-            return reportActions.contains(ReportAction::emitsReadingsUpdate);
-        });
+    dbusIface->register_property_r<bool>("EmitsReadingsUpdate",
+                                         sdbusplus::vtable::property_::none,
+                                         [this](const auto&) {
+        return reportActions.contains(ReportAction::emitsReadingsUpdate);
+    });
     dbusIface->register_property_r<std::string>(
         "Name", sdbusplus::vtable::property_::const_,
         [this](const auto&) { return name; });
-    dbusIface->register_property_r<bool>(
-        "LogToMetricReportsCollection", sdbusplus::vtable::property_::const_,
-        [this](const auto&) {
-            return reportActions.contains(
-                ReportAction::logToMetricReportsCollection);
-        });
+    dbusIface->register_property_r<bool>("LogToMetricReportsCollection",
+                                         sdbusplus::vtable::property_::const_,
+                                         [this](const auto&) {
+        return reportActions.contains(
+            ReportAction::logToMetricReportsCollection);
+    });
     dbusIface->register_property_rw<std::vector<std::string>>(
         "ReportActions", sdbusplus::vtable::property_::emits_change,
         [this](auto newVal, auto& oldVal) {
-            auto tmp = utils::transform<std::unordered_set>(
-                newVal, [](const auto& reportAction) {
-                    return utils::toReportAction(reportAction);
-                });
-            tmp.insert(ReportAction::logToMetricReportsCollection);
+        auto tmp = utils::transform<std::unordered_set>(
+            newVal, [](const auto& reportAction) {
+                return utils::toReportAction(reportAction);
+            });
+        tmp.insert(ReportAction::logToMetricReportsCollection);
 
-            if (tmp != reportActions)
-            {
-                reportActions = tmp;
-                persistency = storeConfiguration();
-                oldVal = std::move(newVal);
-            }
-            return 1;
+        if (tmp != reportActions)
+        {
+            reportActions = tmp;
+            persistency = storeConfiguration();
+            oldVal = std::move(newVal);
+        }
+        return 1;
         },
         [this](const auto&) {
-            return utils::transform<std::vector>(
-                reportActions, [](const auto reportAction) {
-                    return utils::enumToString(reportAction);
-                });
+        return utils::transform<std::vector>(reportActions,
+                                             [](const auto reportAction) {
+            return utils::enumToString(reportAction);
         });
+    });
     dbusIface->register_property_r<uint64_t>(
         "AppendLimit", sdbusplus::vtable::property_::emits_change,
         [this](const auto&) { return appendLimit; });
@@ -376,19 +373,19 @@
         "ReportUpdates", std::string(),
         sdbusplus::vtable::property_::emits_change,
         [this](auto newVal, auto& oldVal) {
-            setReportUpdates(utils::toReportUpdates(newVal));
-            oldVal = newVal;
-            return 1;
+        setReportUpdates(utils::toReportUpdates(newVal));
+        oldVal = newVal;
+        return 1;
         },
         [this](const auto&) { return utils::enumToString(reportUpdates); });
     dbusIface->register_property_r(
         "Triggers", std::vector<sdbusplus::message::object_path>{},
         sdbusplus::vtable::property_::emits_change, [this](const auto&) {
-            return utils::transform<std::vector>(
-                triggerIds, [](const auto& triggerId) {
-                    return utils::pathAppend(utils::constants::triggerDirPath,
-                                             triggerId);
-                });
+            return utils::transform<std::vector>(triggerIds,
+                                                 [](const auto& triggerId) {
+            return utils::pathAppend(utils::constants::triggerDirPath,
+                                     triggerId);
+            });
         });
     dbusIface->register_method("Update", [this] {
         if (reportingType == ReportingType::onRequest)
@@ -515,17 +512,17 @@
         data["Id"] = id;
         data["Name"] = name;
         data["ReportingType"] = utils::toUnderlying(reportingType);
-        data["ReportActions"] =
-            utils::transform(reportActions, [](const auto reportAction) {
-                return utils::toUnderlying(reportAction);
-            });
+        data["ReportActions"] = utils::transform(reportActions,
+                                                 [](const auto reportAction) {
+            return utils::toUnderlying(reportAction);
+        });
         data["Interval"] = interval.count();
         data["AppendLimit"] = appendLimit;
         data["ReportUpdates"] = utils::toUnderlying(reportUpdates);
-        data["ReadingParameters"] =
-            utils::transform(metrics, [](const auto& metric) {
-                return metric->dumpConfiguration();
-            });
+        data["ReadingParameters"] = utils::transform(metrics,
+                                                     [](const auto& metric) {
+            return metric->dumpConfiguration();
+        });
 
         if (shouldStoreMetricValues())
         {
diff --git a/src/report.hpp b/src/report.hpp
index d3c88ec..be22c4f 100644
--- a/src/report.hpp
+++ b/src/report.hpp
@@ -32,8 +32,7 @@
     class OnChangeContext
     {
       public:
-        OnChangeContext(Report& report) : report(report)
-        {}
+        OnChangeContext(Report& report) : report(report) {}
 
         ~OnChangeContext()
         {
diff --git a/src/report_factory.cpp b/src/report_factory.cpp
index 8b150e1..d3a9bb0 100644
--- a/src/report_factory.cpp
+++ b/src/report_factory.cpp
@@ -58,9 +58,8 @@
     {
         auto existing = std::find_if(oldMetrics.begin(), oldMetrics.end(),
                                      [labeledMetricParam](auto metric) {
-                                         return labeledMetricParam ==
-                                                metric->dumpConfiguration();
-                                     });
+            return labeledMetricParam == metric->dumpConfiguration();
+        });
 
         if (existing != oldMetrics.end())
         {
@@ -152,8 +151,8 @@
             {
                 auto it = std::find_if(tree.begin(), tree.end(),
                                        [path = sensorPath](const auto& v) {
-                                           return v.first == path;
-                                       });
+                    return v.first == path;
+                });
 
                 if (it != tree.end() && it->second.size() == 1)
                 {
diff --git a/src/report_manager.cpp b/src/report_manager.cpp
index d12e6aa..69a110c 100644
--- a/src/report_manager.cpp
+++ b/src/report_manager.cpp
@@ -44,118 +44,112 @@
     loadFromPersistent();
 
     reportManagerIface = objServer->add_unique_interface(
-        reportManagerPath, reportManagerIfaceName, [this](auto& dbusIface) {
-            dbusIface.register_property_r(
-                "MaxReports", size_t{}, sdbusplus::vtable::property_::const_,
-                [](const auto&) { return maxReports; });
-            dbusIface.register_property_r(
-                "MinInterval", uint64_t{}, sdbusplus::vtable::property_::const_,
-                [](const auto&) -> uint64_t { return minInterval.count(); });
-            dbusIface.register_property_r(
-                "SupportedOperationTypes", std::vector<std::string>{},
-                sdbusplus::vtable::property_::const_,
-                [](const auto&) -> std::vector<std::string> {
-                    return utils::transform<std::vector>(
-                        utils::convDataOperationType, [](const auto& item) {
-                            return std::string(item.first);
-                        });
-                });
+        reportManagerPath, reportManagerIfaceName,
+        [this](auto& dbusIface) {
+        dbusIface.register_property_r("MaxReports", size_t{},
+                                      sdbusplus::vtable::property_::const_,
+                                      [](const auto&) { return maxReports; });
+        dbusIface.register_property_r(
+            "MinInterval", uint64_t{}, sdbusplus::vtable::property_::const_,
+            [](const auto&) -> uint64_t { return minInterval.count(); });
+        dbusIface.register_property_r(
+            "SupportedOperationTypes", std::vector<std::string>{},
+            sdbusplus::vtable::property_::const_,
+            [](const auto&) -> std::vector<std::string> {
+                return utils::transform<std::vector>(
+                    utils::convDataOperationType,
+                    [](const auto& item) { return std::string(item.first); });
+            });
 
-            dbusIface.register_method(
-                "AddReport", [this](boost::asio::yield_context& yield,
-                                    const std::string& reportId,
-                                    const std::string& reportingType,
-                                    const bool emitsReadingsUpdate,
-                                    const bool logToMetricReportsCollection,
-                                    const uint64_t interval,
-                                    ReadingParametersPastVersion metricParams) {
-                    constexpr auto enabledDefault = true;
-                    constexpr ReportUpdates reportUpdatesDefault =
-                        ReportUpdates::overwrite;
+        dbusIface.register_method(
+            "AddReport",
+            [this](boost::asio::yield_context& yield,
+                   const std::string& reportId,
+                   const std::string& reportingType,
+                   const bool emitsReadingsUpdate,
+                   const bool logToMetricReportsCollection,
+                   const uint64_t interval,
+                   ReadingParametersPastVersion metricParams) {
+            constexpr auto enabledDefault = true;
+            constexpr ReportUpdates reportUpdatesDefault =
+                ReportUpdates::overwrite;
 
-                    std::vector<ReportAction> reportActions;
+            std::vector<ReportAction> reportActions;
 
-                    if (emitsReadingsUpdate)
-                    {
-                        reportActions.emplace_back(
-                            ReportAction::emitsReadingsUpdate);
-                    }
-                    if (logToMetricReportsCollection)
-                    {
-                        reportActions.emplace_back(
-                            ReportAction::logToMetricReportsCollection);
-                    }
+            if (emitsReadingsUpdate)
+            {
+                reportActions.emplace_back(ReportAction::emitsReadingsUpdate);
+            }
+            if (logToMetricReportsCollection)
+            {
+                reportActions.emplace_back(
+                    ReportAction::logToMetricReportsCollection);
+            }
 
-                    return addReport(yield, reportId, reportId,
-                                     utils::toReportingType(reportingType),
-                                     reportActions, Milliseconds(interval),
-                                     maxAppendLimit, reportUpdatesDefault,
-                                     convertToReadingParameters(
-                                         std::move(metricParams)),
-                                     enabledDefault)
-                        .getPath();
-                });
+            return addReport(
+                       yield, reportId, reportId,
+                       utils::toReportingType(reportingType), reportActions,
+                       Milliseconds(interval), maxAppendLimit,
+                       reportUpdatesDefault,
+                       convertToReadingParameters(std::move(metricParams)),
+                       enabledDefault)
+                .getPath();
+            });
 
-            dbusIface.register_method(
-                "AddReportFutureVersion",
-                [this](
-                    boost::asio::yield_context& yield,
-                    const std::vector<
-                        std::pair<std::string, AddReportFutureVersionVariant>>&
-                        properties) {
-                    std::optional<std::string> reportId;
-                    std::optional<std::string> reportName;
-                    std::optional<std::string> reportingType;
-                    std::optional<std::vector<std::string>> reportActions;
-                    std::optional<uint64_t> interval;
-                    std::optional<uint64_t> appendLimit;
-                    std::optional<std::string> reportUpdates;
-                    std::optional<ReadingParameters> metricParams;
-                    std::optional<ReadingParameters> readingParameters;
-                    std::optional<bool> enabled;
+        dbusIface.register_method(
+            "AddReportFutureVersion",
+            [this](boost::asio::yield_context& yield,
+                   const std::vector<
+                       std::pair<std::string, AddReportFutureVersionVariant>>&
+                       properties) {
+            std::optional<std::string> reportId;
+            std::optional<std::string> reportName;
+            std::optional<std::string> reportingType;
+            std::optional<std::vector<std::string>> reportActions;
+            std::optional<uint64_t> interval;
+            std::optional<uint64_t> appendLimit;
+            std::optional<std::string> reportUpdates;
+            std::optional<ReadingParameters> metricParams;
+            std::optional<ReadingParameters> readingParameters;
+            std::optional<bool> enabled;
 
-                    try
-                    {
-                        sdbusplus::unpackProperties(
-                            properties, "Id", reportId, "Name", reportName,
-                            "ReportingType", reportingType, "ReportActions",
-                            reportActions, "Interval", interval, "AppendLimit",
-                            appendLimit, "ReportUpdates", reportUpdates,
-                            "MetricParams", metricParams, "Enabled", enabled,
-                            "ReadingParameters", readingParameters);
-                    }
-                    catch (const sdbusplus::exception::UnpackPropertyError& e)
-                    {
-                        throw errors::InvalidArgument(e.propertyName);
-                    }
+            try
+            {
+                sdbusplus::unpackProperties(
+                    properties, "Id", reportId, "Name", reportName,
+                    "ReportingType", reportingType, "ReportActions",
+                    reportActions, "Interval", interval, "AppendLimit",
+                    appendLimit, "ReportUpdates", reportUpdates, "MetricParams",
+                    metricParams, "Enabled", enabled, "ReadingParameters",
+                    readingParameters);
+            }
+            catch (const sdbusplus::exception::UnpackPropertyError& e)
+            {
+                throw errors::InvalidArgument(e.propertyName);
+            }
 
-                    if (readingParameters == std::nullopt)
-                    {
-                        readingParameters = metricParams;
-                    }
+            if (readingParameters == std::nullopt)
+            {
+                readingParameters = metricParams;
+            }
 
-                    return addReport(
-                               yield, reportId.value_or(""),
-                               reportName.value_or(""),
-                               utils::toReportingType(
-                                   reportingType.value_or(utils::enumToString(
-                                       ReportingType::onRequest))),
-                               utils::transform(
-                                   reportActions.value_or(
-                                       std::vector<std::string>{}),
-                                   [](const auto& reportAction) {
-                                       return utils::toReportAction(
-                                           reportAction);
-                                   }),
-                               Milliseconds(interval.value_or(0)),
-                               appendLimit.value_or(maxAppendLimit),
-                               utils::toReportUpdates(
-                                   reportUpdates.value_or(utils::enumToString(
-                                       ReportUpdates::overwrite))),
-                               readingParameters.value_or(ReadingParameters{}),
-                               enabled.value_or(true))
-                        .getPath();
-                });
+            return addReport(
+                       yield, reportId.value_or(""), reportName.value_or(""),
+                       utils::toReportingType(reportingType.value_or(
+                           utils::enumToString(ReportingType::onRequest))),
+                       utils::transform(
+                           reportActions.value_or(std::vector<std::string>{}),
+                           [](const auto& reportAction) {
+                return utils::toReportAction(reportAction);
+                           }),
+                       Milliseconds(interval.value_or(0)),
+                       appendLimit.value_or(maxAppendLimit),
+                       utils::toReportUpdates(reportUpdates.value_or(
+                           utils::enumToString(ReportUpdates::overwrite))),
+                       readingParameters.value_or(ReadingParameters{}),
+                       enabled.value_or(true))
+                .getPath();
+            });
         });
 }
 
@@ -240,8 +234,8 @@
     const uint64_t appendLimit, const ReportUpdates reportUpdates,
     ReadingParameters metricParams, const bool enabled)
 {
-    auto labeledMetricParams =
-        reportFactory->convertMetricParams(yield, metricParams);
+    auto labeledMetricParams = reportFactory->convertMetricParams(yield,
+                                                                  metricParams);
 
     return addReport(reportId, reportName, reportingType, reportActions,
                      interval, appendLimit, reportUpdates,
@@ -295,7 +289,7 @@
             std::vector<ReportAction> reportActions = utils::transform(
                 data->at("ReportActions").get<std::vector<uint32_t>>(),
                 [](const auto reportAction) {
-                    return utils::toReportAction(reportAction);
+                return utils::toReportAction(reportAction);
                 });
             uint64_t interval = data->at("Interval").get<uint64_t>();
             uint64_t appendLimit = data->at("AppendLimit").get<uint64_t>();
diff --git a/src/sensor.cpp b/src/sensor.cpp
index ce25a86..efebc5d 100644
--- a/src/sensor.cpp
+++ b/src/sensor.cpp
@@ -49,18 +49,18 @@
         "xyz.openbmc_project.Sensor.Value", "Value",
         [lock, id = sensorId, weakSelf = weak_from_this()](
             boost::system::error_code ec, double newValue) {
-            if (ec)
-            {
-                phosphor::logging::log<phosphor::logging::level::WARNING>(
-                    "DBus 'GetProperty' call failed on Sensor Value",
-                    phosphor::logging::entry("SENSOR_PATH=%s", id.path.c_str()),
-                    phosphor::logging::entry("ERROR_CODE=%d", ec.value()));
-                return;
-            }
-            if (auto self = weakSelf.lock())
-            {
-                self->updateValue(newValue);
-            }
+        if (ec)
+        {
+            phosphor::logging::log<phosphor::logging::level::WARNING>(
+                "DBus 'GetProperty' call failed on Sensor Value",
+                phosphor::logging::entry("SENSOR_PATH=%s", id.path.c_str()),
+                phosphor::logging::entry("ERROR_CODE=%d", ec.value()));
+            return;
+        }
+        if (auto self = weakSelf.lock())
+        {
+            self->updateValue(newValue);
+        }
         });
 }
 
@@ -96,8 +96,8 @@
             std::remove_if(
                 listeners.begin(), listeners.end(),
                 [listenerToUnregister = listener.get()](const auto& listener) {
-                    return (listener.expired() ||
-                            listener.lock().get() == listenerToUnregister);
+            return (listener.expired() ||
+                    listener.lock().get() == listenerToUnregister);
                 }),
             listeners.end());
     }
@@ -137,7 +137,7 @@
     signalMonitor = std::make_unique<sdbusplus::bus::match_t>(
         *bus, param,
         [weakSelf = weak_from_this()](sdbusplus::message_t& message) {
-            signalProc(weakSelf, message);
+        signalProc(weakSelf, message);
         });
 }
 
diff --git a/src/state.hpp b/src/state.hpp
index 91a7daf..fedc8c5 100644
--- a/src/state.hpp
+++ b/src/state.hpp
@@ -23,8 +23,7 @@
 class State
 {
   public:
-    explicit State(Object& object) : object(object)
-    {}
+    explicit State(Object& object) : object(object) {}
 
     template <Flags... Indexes>
     StateEvent set(boolean auto... values)
diff --git a/src/trigger.cpp b/src/trigger.cpp
index ff08638..a167d3c 100644
--- a/src/trigger.cpp
+++ b/src/trigger.cpp
@@ -52,20 +52,20 @@
                 "Persistent", persistent,
                 sdbusplus::vtable::property_::emits_change,
                 [this](bool newVal, const auto&) {
-                    if (newVal == persistent)
-                    {
-                        return 1;
-                    }
-                    if (newVal)
-                    {
-                        persistent = storeConfiguration();
-                    }
-                    else
-                    {
-                        triggerStorage.remove(fileName);
-                        persistent = false;
-                    }
-                    return 1;
+            if (newVal == persistent)
+            {
+                return 1;
+            }
+            if (newVal)
+            {
+                persistent = storeConfiguration();
+            }
+            else
+            {
+                triggerStorage.remove(fileName);
+                persistent = false;
+            }
+            return 1;
                 },
                 [this](const auto&) { return persistent; });
 
@@ -73,60 +73,57 @@
                 "Thresholds", TriggerThresholdParams{},
                 sdbusplus::vtable::property_::emits_change,
                 [this, &triggerFactory](auto newVal, auto& oldVal) {
-                    auto newThresholdParams = std::visit(
-                        utils::ToLabeledThresholdParamConversion(), newVal);
-                    TriggerManager::verifyThresholdParams(newThresholdParams);
-                    triggerFactory.updateThresholds(
-                        thresholds, *id, triggerActions, reportIds, sensors,
-                        newThresholdParams);
-                    oldVal = std::move(newVal);
-                    return 1;
+            auto newThresholdParams =
+                std::visit(utils::ToLabeledThresholdParamConversion(), newVal);
+            TriggerManager::verifyThresholdParams(newThresholdParams);
+            triggerFactory.updateThresholds(thresholds, *id, triggerActions,
+                                            reportIds, sensors,
+                                            newThresholdParams);
+            oldVal = std::move(newVal);
+            return 1;
                 },
                 [this](const auto&) {
-                    return fromLabeledThresholdParam(getLabeledThresholds());
-                });
+            return fromLabeledThresholdParam(getLabeledThresholds());
+            });
 
             dbusIface.register_property_rw(
                 "Sensors", SensorsInfo{},
                 sdbusplus::vtable::property_::emits_change,
                 [this, &triggerFactory](auto newVal, auto& oldVal) {
-                    auto labeledSensorInfo =
-                        triggerFactory.getLabeledSensorsInfo(newVal);
-                    triggerFactory.updateSensors(sensors, labeledSensorInfo);
-                    for (const auto& threshold : thresholds)
-                    {
-                        threshold->updateSensors(sensors);
-                    }
-                    oldVal = std::move(newVal);
-                    return 1;
+            auto labeledSensorInfo =
+                triggerFactory.getLabeledSensorsInfo(newVal);
+            triggerFactory.updateSensors(sensors, labeledSensorInfo);
+            for (const auto& threshold : thresholds)
+            {
+                threshold->updateSensors(sensors);
+            }
+            oldVal = std::move(newVal);
+            return 1;
                 },
                 [this](const auto&) {
-                    return utils::fromLabeledSensorsInfo(
-                        getLabeledSensorInfo());
-                });
+            return utils::fromLabeledSensorsInfo(getLabeledSensorInfo());
+            });
 
             dbusIface.register_property_rw(
                 "Reports", std::vector<sdbusplus::message::object_path>(),
                 sdbusplus::vtable::property_::emits_change,
                 [this](auto newVal, auto& oldVal) {
-                    auto newReportIds = utils::transform<std::vector>(
-                        newVal, [](const auto& path) {
-                            return utils::reportPathToId(path);
-                        });
-                    TriggerManager::verifyReportIds(newReportIds);
-                    *reportIds = newReportIds;
-                    messanger.send(messages::TriggerPresenceChangedInd{
-                        messages::Presence::Exist, *id, *reportIds});
-                    oldVal = std::move(newVal);
-                    return 1;
+            auto newReportIds = utils::transform<std::vector>(
+                newVal,
+                [](const auto& path) { return utils::reportPathToId(path); });
+            TriggerManager::verifyReportIds(newReportIds);
+            *reportIds = newReportIds;
+            messanger.send(messages::TriggerPresenceChangedInd{
+                messages::Presence::Exist, *id, *reportIds});
+            oldVal = std::move(newVal);
+            return 1;
                 },
                 [this](const auto&) {
-                    return utils::transform<std::vector>(
-                        *reportIds, [](const auto& id) {
-                            return utils::pathAppend(
-                                utils::constants::reportDirPath, id);
-                        });
-                });
+            return utils::transform<std::vector>(*reportIds,
+                                                 [](const auto& id) {
+                return utils::pathAppend(utils::constants::reportDirPath, id);
+            });
+            });
 
             dbusIface.register_property_r(
                 "Discrete", isDiscreate(), sdbusplus::vtable::property_::const_,
@@ -135,24 +132,23 @@
             dbusIface.register_property_rw(
                 "Name", name, sdbusplus::vtable::property_::emits_change,
                 [this](auto newVal, auto& oldVal) {
-                    if (newVal.length() > utils::constants::maxIdNameLength)
-                    {
-                        throw errors::InvalidArgument("Name",
-                                                      "Name is too long.");
-                    }
-                    name = oldVal = newVal;
-                    return 1;
+            if (newVal.length() > utils::constants::maxIdNameLength)
+            {
+                throw errors::InvalidArgument("Name", "Name is too long.");
+            }
+            name = oldVal = newVal;
+            return 1;
                 },
                 [this](const auto&) { return name; });
 
-            dbusIface.register_property_r(
-                "TriggerActions", std::vector<std::string>(),
-                sdbusplus::vtable::property_::const_, [this](const auto&) {
-                    return utils::transform(triggerActions,
-                                            [](const auto& action) {
-                                                return actionToString(action);
-                                            });
-                });
+            dbusIface.register_property_r("TriggerActions",
+                                          std::vector<std::string>(),
+                                          sdbusplus::vtable::property_::const_,
+                                          [this](const auto&) {
+            return utils::transform(triggerActions, [](const auto& action) {
+                return actionToString(action);
+            });
+            });
         });
 
     for (const auto& threshold : thresholds)
@@ -162,11 +158,11 @@
 
     messanger.on_receive<messages::CollectTriggerIdReq>(
         [this](const auto& msg) {
-            if (utils::contains(*reportIds, msg.reportId))
-            {
-                messanger.send(messages::CollectTriggerIdResp{*id});
-            }
-        });
+        if (utils::contains(*reportIds, msg.reportId))
+        {
+            messanger.send(messages::CollectTriggerIdResp{*id});
+        }
+    });
 
     messanger.send(messages::TriggerPresenceChangedInd{
         messages::Presence::Exist, *id, *reportIds});
@@ -186,10 +182,10 @@
         data["Id"] = *id;
         data["Name"] = name;
         data["ThresholdParamsDiscriminator"] = labeledThresholdParams.index();
-        data["TriggerActions"] =
-            utils::transform(triggerActions, [](const auto& action) {
-                return actionToString(action);
-            });
+        data["TriggerActions"] = utils::transform(triggerActions,
+                                                  [](const auto& action) {
+            return actionToString(action);
+        });
         data["ThresholdParams"] =
             utils::labeledThresholdParamsToJson(labeledThresholdParams);
         data["ReportIds"] = *reportIds;
diff --git a/src/trigger_actions.hpp b/src/trigger_actions.hpp
index a74cc7a..14f6294 100644
--- a/src/trigger_actions.hpp
+++ b/src/trigger_actions.hpp
@@ -68,8 +68,7 @@
 class LogToJournal : public interfaces::TriggerAction
 {
   public:
-    explicit LogToJournal(::discrete::Severity severity) : severity(severity)
-    {}
+    explicit LogToJournal(::discrete::Severity severity) : severity(severity) {}
 
     void commit(const std::string& triggerId, const ThresholdName thresholdName,
                 const std::string& sensorName, const Milliseconds timestamp,
@@ -107,8 +106,7 @@
 class LogToJournal : public interfaces::TriggerAction
 {
   public:
-    LogToJournal()
-    {}
+    LogToJournal() {}
 
     void commit(const std::string& triggerId, const ThresholdName thresholdName,
                 const std::string& sensorName, const Milliseconds timestamp,
@@ -118,8 +116,7 @@
 class LogToRedfishEventLog : public interfaces::TriggerAction
 {
   public:
-    LogToRedfishEventLog()
-    {}
+    LogToRedfishEventLog() {}
 
     void commit(const std::string& triggerId, const ThresholdName thresholdName,
                 const std::string& sensorName, const Milliseconds timestamp,
diff --git a/src/trigger_factory.cpp b/src/trigger_factory.cpp
index 615d42d..9ac8f49 100644
--- a/src/trigger_factory.cpp
+++ b/src/trigger_factory.cpp
@@ -223,10 +223,10 @@
     const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const
 {
     const auto& sensors = getSensors(labeledSensorsInfo);
-    auto triggerActions =
-        utils::transform(triggerActionsIn, [](const auto& triggerActionStr) {
-            return toTriggerAction(triggerActionStr);
-        });
+    auto triggerActions = utils::transform(triggerActionsIn,
+                                           [](const auto& triggerActionStr) {
+        return toTriggerAction(triggerActionStr);
+    });
     std::vector<std::shared_ptr<interfaces::Threshold>> thresholds;
     auto id = std::make_unique<const std::string>(idIn);
 
@@ -260,9 +260,8 @@
     {
         auto existing = std::find_if(oldSensors.begin(), oldSensors.end(),
                                      [labeledSensorInfo](auto sensor) {
-                                         return labeledSensorInfo ==
-                                                sensor->getLabeledSensorInfo();
-                                     });
+            return labeledSensorInfo == sensor->getLabeledSensorInfo();
+        });
 
         if (existing != oldSensors.end())
         {
@@ -311,9 +310,10 @@
 {
     return utils::transform(sensorsInfo, [&tree](const auto& item) {
         const auto& [sensorPath, metadata] = item;
-        auto found = std::find_if(
-            tree.begin(), tree.end(),
-            [path = sensorPath](const auto& x) { return x.first == path; });
+        auto found = std::find_if(tree.begin(), tree.end(),
+                                  [path = sensorPath](const auto& x) {
+            return x.first == path;
+        });
 
         if (tree.end() != found)
         {
diff --git a/src/trigger_manager.cpp b/src/trigger_manager.cpp
index fc6bbcd..984b434 100644
--- a/src/trigger_manager.cpp
+++ b/src/trigger_manager.cpp
@@ -21,36 +21,33 @@
 {
     loadFromPersistent();
 
-    managerIface = objServer->add_unique_interface(
-        triggerManagerPath, triggerManagerIfaceName, [this](auto& iface) {
-            iface.register_method(
-                "AddTrigger",
-                [this](
-                    boost::asio::yield_context& yield, const std::string& id,
-                    const std::string& name,
-                    const std::vector<std::string>& triggerActions,
-                    const SensorsInfo& sensors,
-                    const std::vector<sdbusplus::message::object_path>& reports,
-                    const TriggerThresholdParamsExt& thresholds) {
-                    LabeledTriggerThresholdParams
-                        labeledTriggerThresholdParams = std::visit(
-                            utils::ToLabeledThresholdParamConversion(),
-                            thresholds);
+    managerIface = objServer->add_unique_interface(triggerManagerPath,
+                                                   triggerManagerIfaceName,
+                                                   [this](auto& iface) {
+        iface.register_method(
+            "AddTrigger",
+            [this](boost::asio::yield_context& yield, const std::string& id,
+                   const std::string& name,
+                   const std::vector<std::string>& triggerActions,
+                   const SensorsInfo& sensors,
+                   const std::vector<sdbusplus::message::object_path>& reports,
+                   const TriggerThresholdParamsExt& thresholds) {
+            LabeledTriggerThresholdParams labeledTriggerThresholdParams =
+                std::visit(utils::ToLabeledThresholdParamConversion(),
+                           thresholds);
 
-                    std::vector<LabeledSensorInfo> labeledSensorsInfo =
-                        triggerFactory->getLabeledSensorsInfo(yield, sensors);
+            std::vector<LabeledSensorInfo> labeledSensorsInfo =
+                triggerFactory->getLabeledSensorsInfo(yield, sensors);
 
-                    auto reportIds = utils::transform<std::vector>(
-                        reports, [](const auto& item) {
-                            return utils::reportPathToId(item);
-                        });
+            auto reportIds = utils::transform<std::vector>(
+                reports,
+                [](const auto& item) { return utils::reportPathToId(item); });
 
-                    return addTrigger(id, name, triggerActions,
-                                      labeledSensorsInfo, reportIds,
-                                      labeledTriggerThresholdParams)
-                        .getPath();
-                });
-        });
+            return addTrigger(id, name, triggerActions, labeledSensorsInfo,
+                              reportIds, labeledTriggerThresholdParams)
+                .getPath();
+            });
+    });
 }
 
 void TriggerManager::removeTrigger(const interfaces::Trigger* trigger)
diff --git a/src/types/error_type.hpp b/src/types/error_type.hpp
index 00e9bb1..ae2dd4b 100644
--- a/src/types/error_type.hpp
+++ b/src/types/error_type.hpp
@@ -23,9 +23,9 @@
     static constexpr auto propertyName = ConstexprString{"ErrorType"};
 };
 
-constexpr auto convDataErrorType =
-    std::array{std::make_pair<std::string_view, ErrorType>(
-        "PropertyConflict", ErrorType::propertyConflict)};
+constexpr auto convDataErrorType = std::array{
+    std::make_pair<std::string_view, ErrorType>("PropertyConflict",
+                                                ErrorType::propertyConflict)};
 
 inline ErrorType toErrorType(std::underlying_type_t<ErrorType> value)
 {
diff --git a/src/types/readings.cpp b/src/types/readings.cpp
index 2f6246b..5782158 100644
--- a/src/types/readings.cpp
+++ b/src/types/readings.cpp
@@ -9,11 +9,11 @@
 
 LabeledReadings toLabeledReadings(const Readings& readings)
 {
-    return LabeledReadings{
-        std::get<0>(readings),
-        utils::transform(std::get<1>(readings), [](const auto& readingData) {
-            return LabeledReadingData{readingData};
-        })};
+    return LabeledReadings{std::get<0>(readings),
+                           utils::transform(std::get<1>(readings),
+                                            [](const auto& readingData) {
+        return LabeledReadingData{readingData};
+                           })};
 }
 
 Readings toReadings(const LabeledReadings& labeledReadings)
@@ -21,8 +21,8 @@
     return Readings{labeledReadings.at_label<ts::Timestamp>(),
                     utils::transform(labeledReadings.at_label<ts::Readings>(),
                                      [](const auto& labeledReadingData) {
-                                         return labeledReadingData.to_tuple();
-                                     })};
+        return labeledReadingData.to_tuple();
+                    })};
 }
 
 } // namespace utils
diff --git a/src/types/report_types.cpp b/src/types/report_types.cpp
index 72bce4b..4fb0b4e 100644
--- a/src/types/report_types.cpp
+++ b/src/types/report_types.cpp
@@ -7,21 +7,20 @@
 {
     namespace ts = utils::tstring;
 
-    return utils::transform(
-        labeled, [](const LabeledMetricParameters& metricParams) {
-            return ReadingParameters::value_type(
-                utils::transform(
-                    metricParams.at_label<ts::SensorPath>(),
-                    [](const LabeledSensorInfo& sensorParameters) {
-                        return std::tuple<sdbusplus::message::object_path,
-                                          std::string>(
-                            sensorParameters.at_label<ts::Path>(),
-                            sensorParameters.at_label<ts::Metadata>());
-                    }),
-                utils::enumToString(metricParams.at_label<ts::OperationType>()),
-                metricParams.at_label<ts::Id>(),
-                utils::enumToString(
-                    metricParams.at_label<ts::CollectionTimeScope>()),
-                metricParams.at_label<ts::CollectionDuration>().t.count());
-        });
+    return utils::transform(labeled,
+                            [](const LabeledMetricParameters& metricParams) {
+        return ReadingParameters::value_type(
+            utils::transform(
+                metricParams.at_label<ts::SensorPath>(),
+                [](const LabeledSensorInfo& sensorParameters) {
+            return std::tuple<sdbusplus::message::object_path, std::string>(
+                sensorParameters.at_label<ts::Path>(),
+                sensorParameters.at_label<ts::Metadata>());
+                }),
+            utils::enumToString(metricParams.at_label<ts::OperationType>()),
+            metricParams.at_label<ts::Id>(),
+            utils::enumToString(
+                metricParams.at_label<ts::CollectionTimeScope>()),
+            metricParams.at_label<ts::CollectionDuration>().t.count());
+    });
 }
diff --git a/src/types/report_updates.hpp b/src/types/report_updates.hpp
index 8313a94..a3dfe81 100644
--- a/src/types/report_updates.hpp
+++ b/src/types/report_updates.hpp
@@ -25,13 +25,13 @@
     static constexpr auto propertyName = ConstexprString{"ReportUpdates"};
 };
 
-constexpr auto convDataReportUpdates =
-    std::array{std::make_pair<std::string_view, ReportUpdates>(
-                   "Overwrite", ReportUpdates::overwrite),
-               std::make_pair<std::string_view, ReportUpdates>(
-                   "AppendStopsWhenFull", ReportUpdates::appendStopsWhenFull),
-               std::make_pair<std::string_view, ReportUpdates>(
-                   "AppendWrapsWhenFull", ReportUpdates::appendWrapsWhenFull)};
+constexpr auto convDataReportUpdates = std::array{
+    std::make_pair<std::string_view, ReportUpdates>("Overwrite",
+                                                    ReportUpdates::overwrite),
+    std::make_pair<std::string_view, ReportUpdates>(
+        "AppendStopsWhenFull", ReportUpdates::appendStopsWhenFull),
+    std::make_pair<std::string_view, ReportUpdates>(
+        "AppendWrapsWhenFull", ReportUpdates::appendWrapsWhenFull)};
 
 inline ReportUpdates
     toReportUpdates(std::underlying_type_t<ReportUpdates> value)
diff --git a/src/utils/conversion.hpp b/src/utils/conversion.hpp
index e92249a..f528044 100644
--- a/src/utils/conversion.hpp
+++ b/src/utils/conversion.hpp
@@ -90,9 +90,10 @@
 inline T toEnum(const std::array<std::pair<std::string_view, T>, N>& data,
                 const std::string& value)
 {
-    auto it = std::find_if(
-        std::begin(data), std::end(data),
-        [&value](const auto& item) { return item.first == value; });
+    auto it = std::find_if(std::begin(data), std::end(data),
+                           [&value](const auto& item) {
+        return item.first == value;
+    });
     if (it == std::end(data))
     {
         throwConversionError(EnumTraits<T>::propertyName);
@@ -105,9 +106,10 @@
     enumToString(const std::array<std::pair<std::string_view, T>, N>& data,
                  T value)
 {
-    auto it = std::find_if(
-        std::begin(data), std::end(data),
-        [value](const auto& item) { return item.second == value; });
+    auto it = std::find_if(std::begin(data), std::end(data),
+                           [value](const auto& item) {
+        return item.second == value;
+    });
     if (it == std::end(data))
     {
         throwConversionError(EnumTraits<T>::propertyName);
diff --git a/src/utils/conversion_trigger.cpp b/src/utils/conversion_trigger.cpp
index d65eae9..a8417e5 100644
--- a/src/utils/conversion_trigger.cpp
+++ b/src/utils/conversion_trigger.cpp
@@ -21,8 +21,8 @@
     const std::vector<numeric::ThresholdParam>& arg) const
 {
     return utils::transform(arg, [](const auto& thresholdParam) {
-        const auto& [type, dwellTime, direction, thresholdValue] =
-            thresholdParam;
+        const auto& [type, dwellTime, direction,
+                     thresholdValue] = thresholdParam;
         return numeric::LabeledThresholdParam(numeric::toType(type), dwellTime,
                                               numeric::toDirection(direction),
                                               thresholdValue);
@@ -33,8 +33,8 @@
     const std::vector<discrete::ThresholdParam>& arg) const
 {
     return utils::transform(arg, [](const auto& thresholdParam) {
-        const auto& [userId, severity, dwellTime, thresholdValue] =
-            thresholdParam;
+        const auto& [userId, severity, dwellTime,
+                     thresholdValue] = thresholdParam;
         return discrete::LabeledThresholdParam(
             userId, discrete::toSeverity(severity), dwellTime, thresholdValue);
     });
@@ -44,14 +44,14 @@
     const std::vector<numeric::LabeledThresholdParam>& arg) const
 {
     return utils::transform(
-        arg, [](const numeric::LabeledThresholdParam& labeledThresholdParam) {
-            return numeric::ThresholdParam(
-                numeric::typeToString(
-                    labeledThresholdParam.at_label<ts::Type>()),
-                labeledThresholdParam.at_label<ts::DwellTime>(),
-                numeric::directionToString(
-                    labeledThresholdParam.at_label<ts::Direction>()),
-                labeledThresholdParam.at_label<ts::ThresholdValue>());
+        arg,
+        [](const numeric::LabeledThresholdParam& labeledThresholdParam) {
+        return numeric::ThresholdParam(
+            numeric::typeToString(labeledThresholdParam.at_label<ts::Type>()),
+            labeledThresholdParam.at_label<ts::DwellTime>(),
+            numeric::directionToString(
+                labeledThresholdParam.at_label<ts::Direction>()),
+            labeledThresholdParam.at_label<ts::ThresholdValue>());
         });
 }
 
diff --git a/src/utils/conversion_trigger.hpp b/src/utils/conversion_trigger.hpp
index 8719df2..10b0c03 100644
--- a/src/utils/conversion_trigger.hpp
+++ b/src/utils/conversion_trigger.hpp
@@ -45,8 +45,8 @@
 inline constexpr bool is_variant_v = is_variant<T>::value;
 
 template <typename AlternativeT, typename VariantT>
-    requires is_variant_v<VariantT> bool
-isFirstElementOfType(const std::vector<VariantT>& collection)
+    requires is_variant_v<VariantT>
+bool isFirstElementOfType(const std::vector<VariantT>& collection)
 {
     if (collection.empty())
     {
diff --git a/src/utils/ensure.hpp b/src/utils/ensure.hpp
index 8c4fc99..8b7567e 100644
--- a/src/utils/ensure.hpp
+++ b/src/utils/ensure.hpp
@@ -15,8 +15,7 @@
     Ensure(U&& functor) : functor(std::forward<U>(functor))
     {}
 
-    Ensure(F functor) : functor(std::move(functor))
-    {}
+    Ensure(F functor) : functor(std::move(functor)) {}
 
     Ensure(Ensure&& other) = delete;
     Ensure(const Ensure&) = delete;
diff --git a/src/utils/labeled_tuple.hpp b/src/utils/labeled_tuple.hpp
index c4120c9..b320c3b 100644
--- a/src/utils/labeled_tuple.hpp
+++ b/src/utils/labeled_tuple.hpp
@@ -151,10 +151,8 @@
     LabeledTuple(const LabeledTuple&) = default;
     LabeledTuple(LabeledTuple&&) = default;
 
-    explicit LabeledTuple(tuple_type v) : value(std::move(v))
-    {}
-    LabeledTuple(Args... args) : value(std::move(args)...)
-    {}
+    explicit LabeledTuple(tuple_type v) : value(std::move(v)) {}
+    LabeledTuple(Args... args) : value(std::move(args)...) {}
 
     LabeledTuple& operator=(const LabeledTuple&) = default;
     LabeledTuple& operator=(LabeledTuple&&) = default;
@@ -209,11 +207,9 @@
     {
         return std::apply(
             [&](auto&&... x) {
-                return std::apply(
-                    [&](auto&&... y) {
-                        return (true && ... && detail::eq(x, y));
-                    },
-                    value);
+            return std::apply(
+                [&](auto&&... y) { return (true && ... && detail::eq(x, y)); },
+                value);
             },
             other.value);
     }
diff --git a/src/utils/make_id_name.cpp b/src/utils/make_id_name.cpp
index 1390dad..1148622 100644
--- a/src/utils/make_id_name.cpp
+++ b/src/utils/make_id_name.cpp
@@ -49,19 +49,17 @@
     {
         strippedId = defaultName;
     }
-    strippedId.erase(
-        std::remove_if(
-            strippedId.begin(), strippedId.end(),
-            [](char c) {
-                return c == '/' ||
-                       utils::constants::allowedCharactersInPath.find(c) ==
-                           std::string_view::npos;
-            }),
-        strippedId.end());
+    strippedId.erase(std::remove_if(
+                         strippedId.begin(), strippedId.end(),
+                         [](char c) {
+        return c == '/' || utils::constants::allowedCharactersInPath.find(c) ==
+                               std::string_view::npos;
+                         }),
+                     strippedId.end());
 
     size_t idx = 0;
-    std::string tmpId =
-        prefixes + strippedId.substr(0, constants::maxIdNameLength);
+    std::string tmpId = prefixes +
+                        strippedId.substr(0, constants::maxIdNameLength);
 
     while (std::find(conflictIds.begin(), conflictIds.end(), tmpId) !=
            conflictIds.end())
diff --git a/src/utils/messanger_service.cpp b/src/utils/messanger_service.cpp
index e04de34..25f154c 100644
--- a/src/utils/messanger_service.cpp
+++ b/src/utils/messanger_service.cpp
@@ -16,11 +16,11 @@
 
 void MessangerService::destroy(MessangerService::Context& context)
 {
-    contexts_.erase(std::remove_if(contexts_.begin(), contexts_.end(),
-                                   [&context](const auto& item) {
-                                       return item.get() == &context;
-                                   }),
-                    contexts_.end());
+    contexts_.erase(
+        std::remove_if(
+            contexts_.begin(), contexts_.end(),
+            [&context](const auto& item) { return item.get() == &context; }),
+        contexts_.end());
 }
 
 boost::asio::execution_context::id MessangerService::id = {};
diff --git a/src/utils/messanger_service.hpp b/src/utils/messanger_service.hpp
index 86dd2ff..f79bcc7 100644
--- a/src/utils/messanger_service.hpp
+++ b/src/utils/messanger_service.hpp
@@ -20,8 +20,7 @@
     MessangerService(boost::asio::execution_context& execution_context);
     ~MessangerService() = default;
 
-    void shutdown()
-    {}
+    void shutdown() {}
 
     Context& create();
     void destroy(Context& context);
diff --git a/src/utils/threshold_operations.hpp b/src/utils/threshold_operations.hpp
index 99ae4a5..42d469e 100644
--- a/src/utils/threshold_operations.hpp
+++ b/src/utils/threshold_operations.hpp
@@ -22,10 +22,11 @@
         getDetails(ThresholdType* thresholdPtr,
                    const interfaces::Sensor& sensor)
     {
-        auto it = std::find_if(
-            thresholdPtr->sensorDetails.begin(),
-            thresholdPtr->sensorDetails.end(),
-            [&sensor](const auto& x) { return &sensor == x.first.get(); });
+        auto it = std::find_if(thresholdPtr->sensorDetails.begin(),
+                               thresholdPtr->sensorDetails.end(),
+                               [&sensor](const auto& x) {
+            return &sensor == x.first.get();
+        });
         return *it->second;
     }
 
