diff --git a/.clang-format b/.clang-format
index 52ac0a1..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
 AlignConsecutiveAssignments: false
 AlignConsecutiveDeclarations: false
 AlignEscapedNewlines: Right
-AlignOperands:   true
-AlignTrailingComments: true
+AlignOperands:  Align
+AlignTrailingComments:
+  Kind: Always
+  OverEmptyLines: 1
 AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
 AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
 AllowShortIfStatementsOnASingleLine: false
 AllowShortLoopsOnASingleLine: false
 AlwaysBreakAfterReturnType: None
@@ -36,12 +38,13 @@
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
   SplitEmptyNamespace:  false
+BreakAfterAttributes: Never
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: Custom
 BreakBeforeTernaryOperators: true
 BreakConstructorInitializers: AfterColon
 BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
 ColumnLimit:     80
 CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: false
@@ -49,6 +52,7 @@
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
+DeriveLineEnding: false
 DerivePointerAlignment: false
 PointerAlignment: Left
 DisableFormat:   false
@@ -74,9 +78,13 @@
   - Regex:           '.*'
     Priority:        6
 IndentCaseLabels: true
+IndentRequiresClause: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
@@ -84,13 +92,19 @@
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
 ReflowComments:  true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
 SortIncludes:    true
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
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;
     }
 
diff --git a/tests/src/dbus_environment.hpp b/tests/src/dbus_environment.hpp
index eabb53a..558445e 100644
--- a/tests/src/dbus_environment.hpp
+++ b/tests/src/dbus_environment.hpp
@@ -104,12 +104,12 @@
             *DbusEnvironment::getBus(), DbusEnvironment::serviceName(), path,
             interfaceName, property,
             [&propertyPromise](const boost::system::error_code& ec, T t) {
-                if (ec)
-                {
-                    utils::setException(propertyPromise, "GetProperty failed");
-                    return;
-                }
-                propertyPromise.set_value(t);
+            if (ec)
+            {
+                utils::setException(propertyPromise, "GetProperty failed");
+                return;
+            }
+            propertyPromise.set_value(t);
             });
         return DbusEnvironment::waitForFuture(std::move(propertyFuture));
     }
@@ -124,9 +124,9 @@
         sdbusplus::asio::setProperty(
             *DbusEnvironment::getBus(), DbusEnvironment::serviceName(), path,
             interfaceName, property, std::move(newValue),
-            [promise =
-                 std::move(promise)](boost::system::error_code ec) mutable {
-                promise.set_value(ec);
+            [promise = std::move(promise)](
+                boost::system::error_code ec) mutable {
+            promise.set_value(ec);
             });
         return DbusEnvironment::waitForFuture(std::move(future));
     }
diff --git a/tests/src/helpers/interfaces/json_storage_helpers.hpp b/tests/src/helpers/interfaces/json_storage_helpers.hpp
index b5d4004..f339381 100644
--- a/tests/src/helpers/interfaces/json_storage_helpers.hpp
+++ b/tests/src/helpers/interfaces/json_storage_helpers.hpp
@@ -16,4 +16,4 @@
     (*os) << static_cast<std::filesystem::path>(o);
 }
 
-} // namespace interfaces
\ No newline at end of file
+} // namespace interfaces
diff --git a/tests/src/helpers/interfaces/sensor_id_helpers.hpp b/tests/src/helpers/interfaces/sensor_id_helpers.hpp
index 9b59d22..3268e07 100644
--- a/tests/src/helpers/interfaces/sensor_id_helpers.hpp
+++ b/tests/src/helpers/interfaces/sensor_id_helpers.hpp
@@ -19,4 +19,4 @@
            std::tie(right.type, right.service, right.path);
 }
 
-} // namespace interfaces
\ No newline at end of file
+} // namespace interfaces
diff --git a/tests/src/helpers/metric_value_helpers.hpp b/tests/src/helpers/metric_value_helpers.hpp
index f21d42a..9634de3 100644
--- a/tests/src/helpers/metric_value_helpers.hpp
+++ b/tests/src/helpers/metric_value_helpers.hpp
@@ -14,4 +14,4 @@
 {
     return std::tie(left.id, left.metadata, left.value, left.timestamp) ==
            std::tie(right.id, right.metadata, right.value, right.timestamp);
-}
\ No newline at end of file
+}
diff --git a/tests/src/mocks/report_factory_mock.hpp b/tests/src/mocks/report_factory_mock.hpp
index a043c09..8af6d5c 100644
--- a/tests/src/mocks/report_factory_mock.hpp
+++ b/tests/src/mocks/report_factory_mock.hpp
@@ -14,12 +14,12 @@
     {
         return utils::transform(readingParams, [](const auto& params) {
             return LabeledMetricParameters(
-                utils::transform(std::get<0>(params),
-                                 [](const auto& sensorData) {
-                                     return LabeledSensorInfo(
-                                         "Service", std::get<0>(sensorData),
+                utils::transform(
+                    std::get<0>(params),
+                    [](const auto& sensorData) {
+                return LabeledSensorInfo("Service", std::get<0>(sensorData),
                                          std::get<1>(sensorData));
-                                 }),
+                    }),
                 utils::toOperationType(std::get<1>(params)),
                 std::get<2>(params),
                 utils::toCollectionTimeScope(std::get<3>(params)),
diff --git a/tests/src/mocks/trigger_factory_mock.hpp b/tests/src/mocks/trigger_factory_mock.hpp
index d3d83e5..f1dfa1f 100644
--- a/tests/src/mocks/trigger_factory_mock.hpp
+++ b/tests/src/mocks/trigger_factory_mock.hpp
@@ -73,10 +73,11 @@
 
             return EXPECT_CALL(
                 *this, make(params.id(), params.name(),
-                            utils::transform(params.triggerActions(),
-                                             [](const auto& action) {
-                                                 return actionToString(action);
-                                             }),
+                            utils::transform(
+                                params.triggerActions(),
+                                [](const auto& action) {
+                return actionToString(action);
+                                }),
                             params.reportIds(), tm, triggerStorage,
                             params.thresholdParams(), params.sensors()));
         }
diff --git a/tests/src/params/trigger_params.hpp b/tests/src/params/trigger_params.hpp
index 9f633b8..b39941c 100644
--- a/tests/src/params/trigger_params.hpp
+++ b/tests/src/params/trigger_params.hpp
@@ -18,10 +18,10 @@
   public:
     TriggerParams()
     {
-        reportsProperty =
-            utils::transform(reportIdsProperty, [](const auto& id) {
-                return utils::pathAppend(utils::constants::reportDirPath, id);
-            });
+        reportsProperty = utils::transform(reportIdsProperty,
+                                           [](const auto& id) {
+            return utils::pathAppend(utils::constants::reportDirPath, id);
+        });
     }
 
     TriggerParams& id(std::string_view val)
@@ -70,10 +70,10 @@
     TriggerParams& reportIds(std::vector<std::string> val)
     {
         reportIdsProperty = std::move(val);
-        reportsProperty = utils::transform<std::vector>(
-            reportIdsProperty, [](const auto& id) {
-                return utils::pathAppend(utils::constants::reportDirPath, id);
-            });
+        reportsProperty = utils::transform<std::vector>(reportIdsProperty,
+                                                        [](const auto& id) {
+            return utils::pathAppend(utils::constants::reportDirPath, id);
+        });
         return *this;
     }
 
diff --git a/tests/src/stubs/dbus_sensor_object.cpp b/tests/src/stubs/dbus_sensor_object.cpp
index b73478e..dbe95ca 100644
--- a/tests/src/stubs/dbus_sensor_object.cpp
+++ b/tests/src/stubs/dbus_sensor_object.cpp
@@ -17,13 +17,12 @@
     ioc(ioc),
     bus(bus), objServer(objServer)
 {
-    sensorIface = objServer->add_unique_interface(
-        path(), interface(), [this](auto& iface) {
-            iface.register_property_r(
-                property.value(), value,
-                sdbusplus::vtable::property_::emits_change,
-                [this](const auto&) { return value; });
-        });
+    sensorIface = objServer->add_unique_interface(path(), interface(),
+                                                  [this](auto& iface) {
+        iface.register_property_r(property.value(), value,
+                                  sdbusplus::vtable::property_::emits_change,
+                                  [this](const auto&) { return value; });
+    });
 }
 
 void DbusSensorObject::setValue(double v)
diff --git a/tests/src/test_discrete_threshold.cpp b/tests/src/test_discrete_threshold.cpp
index 953ddd5..8b9168b 100644
--- a/tests/src/test_discrete_threshold.cpp
+++ b/tests/src/test_discrete_threshold.cpp
@@ -104,8 +104,7 @@
 
 class TestDiscreteThresholdInit : public TestDiscreteThreshold
 {
-    void SetUp() override
-    {}
+    void SetUp() override {}
 };
 
 TEST_F(TestDiscreteThresholdInit, nonEmptyNameIsNotChanged)
diff --git a/tests/src/test_metric.cpp b/tests/src/test_metric.cpp
index cd6a6ec..952651c 100644
--- a/tests/src/test_metric.cpp
+++ b/tests/src/test_metric.cpp
@@ -353,8 +353,8 @@
         clockFake.advance(timestamp);
     }
 
-    const auto [expectedTimestamp, expectedReading] =
-        GetParam().expectedReading();
+    const auto [expectedTimestamp,
+                expectedReading] = GetParam().expectedReading();
     const auto readings = sut->getUpdatedReadings();
 
     EXPECT_THAT(readings,
@@ -373,8 +373,8 @@
         sut->getUpdatedReadings();
     }
 
-    const auto [expectedTimestamp, expectedReading] =
-        GetParam().expectedReading();
+    const auto [expectedTimestamp,
+                expectedReading] = GetParam().expectedReading();
     const auto readings = sut->getUpdatedReadings();
 
     EXPECT_THAT(readings,
diff --git a/tests/src/test_report.cpp b/tests/src/test_report.cpp
index 875bd4b..1d0f0bb 100644
--- a/tests/src/test_report.cpp
+++ b/tests/src/test_report.cpp
@@ -188,7 +188,7 @@
         std::promise<boost::system::error_code> methodPromise;
         DbusEnvironment::getBus()->async_method_call(
             [&methodPromise](boost::system::error_code ec) {
-                methodPromise.set_value(ec);
+            methodPromise.set_value(ec);
             },
             DbusEnvironment::serviceName(), path, interface, method);
         return DbusEnvironment::waitForFuture(methodPromise.get_future());
@@ -671,8 +671,7 @@
     public TestReport,
     public WithParamInterface<std::pair<std::string, nlohmann::json>>
 {
-    void SetUp() override
-    {}
+    void SetUp() override {}
 };
 
 INSTANTIATE_TEST_SUITE_P(
@@ -687,7 +686,7 @@
         std::make_pair("ReportActions", nlohmann::json(utils::transform(
                                             defaultParams().reportActions(),
                                             [](const auto v) {
-                                                return utils::toUnderlying(v);
+    return utils::toUnderlying(v);
                                             }))),
         std::make_pair("Interval",
                        nlohmann::json(defaultParams().interval().count())),
@@ -754,8 +753,7 @@
     public WithParamInterface<ReportParams>
 {
   public:
-    void SetUp() override
-    {}
+    void SetUp() override {}
 };
 
 INSTANTIATE_TEST_SUITE_P(
@@ -774,8 +772,7 @@
     public WithParamInterface<ReportParams>
 {
   public:
-    void SetUp() override
-    {}
+    void SetUp() override {}
 };
 
 INSTANTIATE_TEST_SUITE_P(InvalidNames, TestReportInvalidIds,
@@ -823,8 +820,8 @@
     clockFake.system.advance(10ms);
 
     messanger.send(messages::UpdateReportInd{{sut->getId()}});
-    const auto [timestamp, readings] =
-        getProperty<Readings>(sut->getPath(), "Readings");
+    const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                             "Readings");
 
     EXPECT_THAT(Milliseconds{timestamp}, Eq(systemTimestamp + 10ms));
 }
@@ -835,8 +832,8 @@
 
     setProperty(sut->getPath(), "Enabled", false);
     messanger.send(messages::UpdateReportInd{{sut->getId()}});
-    const auto [timestamp, readings] =
-        getProperty<Readings>(sut->getPath(), "Readings");
+    const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                             "Readings");
 
     EXPECT_THAT(Milliseconds{timestamp}, Eq(0ms));
 }
@@ -846,8 +843,8 @@
     clockFake.system.advance(10ms);
 
     messanger.send(messages::UpdateReportInd{{sut->getId() + "x"s}});
-    const auto [timestamp, readings] =
-        getProperty<Readings>(sut->getPath(), "Readings");
+    const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                             "Readings");
 
     EXPECT_THAT(Milliseconds{timestamp}, Eq(0ms));
 }
@@ -867,8 +864,8 @@
 
     ASSERT_THAT(update(sut->getPath()), Eq(boost::system::errc::success));
 
-    const auto [timestamp, readings] =
-        getProperty<Readings>(sut->getPath(), "Readings");
+    const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                             "Readings");
 
     EXPECT_THAT(Milliseconds{timestamp}, Eq(systemTimestamp + 10ms));
 }
@@ -877,8 +874,8 @@
 {
     ASSERT_THAT(update(sut->getPath()), Eq(boost::system::errc::success));
 
-    const auto [timestamp, readings] =
-        getProperty<Readings>(sut->getPath(), "Readings");
+    const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                             "Readings");
 
     EXPECT_THAT(readings,
                 ElementsAre(std::make_tuple("a"s, "b"s, 17.1, 114u),
@@ -948,8 +945,8 @@
     clockFake.system.advance(10ms);
     DbusEnvironment::sleepFor(ReportManager::minInterval + 1ms);
 
-    const auto [timestamp, readings] =
-        getProperty<Readings>(sut->getPath(), "Readings");
+    const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                             "Readings");
 
     EXPECT_THAT(Milliseconds{timestamp}, Eq(systemTimestamp + 10ms));
 }
@@ -958,8 +955,8 @@
 {
     DbusEnvironment::sleepFor(ReportManager::minInterval + 1ms);
 
-    const auto [timestamp, readings] =
-        getProperty<Readings>(sut->getPath(), "Readings");
+    const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                             "Readings");
 
     EXPECT_THAT(readings,
                 ElementsAre(std::make_tuple("a"s, "b"s, 17.1, 114u),
@@ -978,8 +975,7 @@
     public WithParamInterface<ReportUpdatesReportParams>
 {
   public:
-    void SetUp() override
-    {}
+    void SetUp() override {}
 
     void changeReport(ReportingType rt, Milliseconds interval)
     {
@@ -990,8 +986,8 @@
 
     auto readings()
     {
-        auto [timestamp, readings] =
-            getProperty<Readings>(sut->getPath(), "Readings");
+        auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+                                                           "Readings");
         return readings;
     }
 
@@ -1285,8 +1281,8 @@
     {
         messanger.on_receive<messages::CollectTriggerIdReq>(
             [this, triggerId](const auto& msg) {
-                messanger.send(messages::CollectTriggerIdResp{triggerId});
-            });
+            messanger.send(messages::CollectTriggerIdResp{triggerId});
+        });
     }
 
     sut = makeReport(ReportParams());
diff --git a/tests/src/test_report_manager.cpp b/tests/src/test_report_manager.cpp
index 51140b7..fc394ae 100644
--- a/tests/src/test_report_manager.cpp
+++ b/tests/src/test_report_manager.cpp
@@ -67,7 +67,7 @@
         DbusEnvironment::getBus()->async_method_call(
             [&addReportPromise](boost::system::error_code ec,
                                 const std::string& path) {
-                addReportPromise.set_value({ec, path});
+            addReportPromise.set_value({ec, path});
             },
             DbusEnvironment::serviceName(), ReportManager::reportManagerPath,
             ReportManager::reportManagerIfaceName, "AddReportFutureVersion",
@@ -88,11 +88,11 @@
                                 utils::enumToString(params.reportUpdates()));
         properties.emplace_back("AppendLimit", params.appendLimit());
         properties.emplace_back("Enabled", params.enabled());
-        properties.emplace_back(
-            "ReportActions",
-            utils::transform(params.reportActions(), [](const auto v) {
-                return utils::enumToString(v);
-            }));
+        properties.emplace_back("ReportActions",
+                                utils::transform(params.reportActions(),
+                                                 [](const auto v) {
+            return utils::enumToString(v);
+                                }));
         properties.emplace_back("Interval", params.interval().count());
         properties.emplace_back("ReadingParameters",
                                 toReadingParameters(params.metricParameters()));
diff --git a/tests/src/test_sensor_cache.cpp b/tests/src/test_sensor_cache.cpp
index b59a062..218e160 100644
--- a/tests/src/test_sensor_cache.cpp
+++ b/tests/src/test_sensor_cache.cpp
@@ -59,10 +59,10 @@
 
 TEST_P(TestSensorCacheP, shouldReturnDifferentSensorWhenIdsAreDifferent)
 {
-    auto sensor1 =
-        sut.makeSensor<NiceMock<SensorMock>>(id<0>().service, id<0>().path);
-    auto sensor2 =
-        sut.makeSensor<NiceMock<SensorMock>>(id<1>().service, id<1>().path);
+    auto sensor1 = sut.makeSensor<NiceMock<SensorMock>>(id<0>().service,
+                                                        id<0>().path);
+    auto sensor2 = sut.makeSensor<NiceMock<SensorMock>>(id<1>().service,
+                                                        id<1>().path);
 
     ASSERT_THAT(sensor1.get(), Not(Eq(sensor2.get())));
     ASSERT_THAT(sensor1->mockId, Not(Eq(sensor2->mockId)));
@@ -70,10 +70,10 @@
 
 TEST_F(TestSensorCache, shouldReturnSameSensorWhenSensorWithSameIdStillExists)
 {
-    auto sensor1 =
-        sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path");
-    auto sensor2 =
-        sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path");
+    auto sensor1 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+                                                        "sensor-path");
+    auto sensor2 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+                                                        "sensor-path");
 
     ASSERT_THAT(sensor1.get(), Eq(sensor2.get()));
     ASSERT_THAT(sensor1->mockId, Eq(sensor2->mockId));
@@ -81,21 +81,21 @@
 
 TEST_F(TestSensorCache, shouldReturnDifferentSensorWhenPreviousSensorExpired)
 {
-    auto mockId1 =
-        sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path")
-            ->mockId;
-    auto mockId2 =
-        sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path")
-            ->mockId;
+    auto mockId1 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+                                                        "sensor-path")
+                       ->mockId;
+    auto mockId2 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+                                                        "sensor-path")
+                       ->mockId;
 
     ASSERT_THAT(mockId2, Not(Eq(mockId1)));
 }
 
 TEST_F(TestSensorCache, shouldCreateSensorWithCorrespondingId)
 {
-    auto id =
-        sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path")
-            ->id();
+    auto id = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+                                                   "sensor-path")
+                  ->id();
 
     auto expected = SensorMock::makeId("sensor-service", "sensor-path");
 
diff --git a/tests/src/test_trigger.cpp b/tests/src/test_trigger.cpp
index 9db2632..f55dec1 100644
--- a/tests/src/test_trigger.cpp
+++ b/tests/src/test_trigger.cpp
@@ -140,7 +140,7 @@
         std::promise<boost::system::error_code> methodPromise;
         DbusEnvironment::getBus()->async_method_call(
             [&methodPromise](boost::system::error_code ec) {
-                methodPromise.set_value(ec);
+            methodPromise.set_value(ec);
             },
             DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName,
             "Delete");
@@ -155,9 +155,10 @@
     EXPECT_THAT(getProperty<bool>(sut->getPath(), "Persistent"), Eq(true));
     EXPECT_THAT(
         getProperty<std::vector<std::string>>(sut->getPath(), "TriggerActions"),
-        Eq(utils::transform(
-            triggerParams.triggerActions(),
-            [](const auto& action) { return actionToString(action); })));
+        Eq(utils::transform(triggerParams.triggerActions(),
+                            [](const auto& action) {
+        return actionToString(action);
+        })));
     EXPECT_THAT((getProperty<SensorsInfo>(sut->getPath(), "Sensors")),
                 Eq(utils::fromLabeledSensorsInfo(triggerParams.sensors())));
     EXPECT_THAT(
@@ -442,8 +443,7 @@
 class TestTriggerInitialization : public TestTrigger
 {
   public:
-    void SetUp() override
-    {}
+    void SetUp() override {}
 
     nlohmann::json storedConfiguration;
 };
@@ -516,8 +516,8 @@
     ASSERT_THAT(storedConfiguration.at("TriggerActions"),
                 Eq(utils::transform(triggerParams.triggerActions(),
                                     [](const auto& action) {
-                                        return actionToString(action);
-                                    })));
+        return actionToString(action);
+                })));
 }
 
 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerReportIds)
diff --git a/tests/src/test_trigger_actions.cpp b/tests/src/test_trigger_actions.cpp
index 42488aa..8711378 100644
--- a/tests/src/test_trigger_actions.cpp
+++ b/tests/src/test_trigger_actions.cpp
@@ -249,8 +249,7 @@
 class TestUpdateReport : public Test
 {
   public:
-    TestUpdateReport() : messanger(DbusEnvironment::getIoc())
-    {}
+    TestUpdateReport() : messanger(DbusEnvironment::getIoc()) {}
 
     void make(std::vector<std::string> names)
     {
diff --git a/tests/src/test_trigger_manager.cpp b/tests/src/test_trigger_manager.cpp
index 48c76ea..03ec5ce 100644
--- a/tests/src/test_trigger_manager.cpp
+++ b/tests/src/test_trigger_manager.cpp
@@ -30,7 +30,7 @@
         DbusEnvironment::getBus()->async_method_call(
             [&addTriggerPromise](boost::system::error_code ec,
                                  const std::string& path) {
-                addTriggerPromise.set_value({ec, path});
+            addTriggerPromise.set_value({ec, path});
             },
             DbusEnvironment::serviceName(), TriggerManager::triggerManagerPath,
             TriggerManager::triggerManagerIfaceName, "AddTrigger", params.id(),
@@ -465,10 +465,10 @@
         {"Name", TriggerParams().name()},
         {"ThresholdParamsDiscriminator",
          TriggerParams().thresholdParams().index()},
-        {"TriggerActions", utils::transform(TriggerParams().triggerActions(),
-                                            [](const auto& action) {
-                                                return actionToString(action);
-                                            })},
+        {"TriggerActions",
+         utils::transform(
+             TriggerParams().triggerActions(),
+             [](const auto& action) { return actionToString(action); })},
         {"ThresholdParams", utils::labeledThresholdParamsToJson(
                                 TriggerParams().thresholdParams())},
         {"ReportIds", TriggerParams().reportIds()},
diff --git a/tests/src/utils/string_utils.cpp b/tests/src/utils/string_utils.cpp
index a39afca..f85f441 100644
--- a/tests/src/utils/string_utils.cpp
+++ b/tests/src/utils/string_utils.cpp
@@ -71,4 +71,4 @@
 {
     return details::getStringWithSpaces(constants::maxIdNameLength + 1);
 }
-} // namespace utils::string_utils
\ No newline at end of file
+} // namespace utils::string_utils
diff --git a/tests/src/utils/string_utils.hpp b/tests/src/utils/string_utils.hpp
index 90f802c..8dcf9dc 100644
--- a/tests/src/utils/string_utils.hpp
+++ b/tests/src/utils/string_utils.hpp
@@ -10,4 +10,4 @@
 std::string getTooLongPrefix();
 std::string getTooLongId();
 std::string getTooLongName();
-} // namespace utils::string_utils
\ No newline at end of file
+} // namespace utils::string_utils
