Move variant usage to std

Since sdbusplus now uses std, it's cleaner just to
use the variant type directly not behind the namespace.

Also updates clang format.

Style only change.

Tested-by: It builds

Change-Id: I2b7e3ae6b0135cda3e8443e8f910009e6e857f87
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/.clang-format b/.clang-format
index bbc1bb1..ea71ad6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -17,7 +17,7 @@
 AlwaysBreakAfterDefinitionReturnType: None
 AlwaysBreakAfterReturnType: None
 AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: true
 BinPackArguments: true
 BinPackParameters: true
 BraceWrapping:
@@ -42,12 +42,26 @@
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
 PointerAlignment: Left
 DisableFormat:   false
 ExperimentalAutoDetectBinPacking: false
 FixNamespaceComments: true
 ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+  - Regex:           '^[<"](gtest|gmock)'
+    Priority:        5
+  - Regex:           '^"config.h"'
+    Priority:        -1
+  - Regex:           '^".*\.hpp"'
+    Priority:        1
+  - Regex:           '^<.*\.h>'
+    Priority:        2
+  - Regex:           '^<.*'
+    Priority:        3
+  - Regex:           '.*'
+    Priority:        4
 IndentCaseLabels: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
@@ -65,9 +79,9 @@
 PenaltyBreakString: 1000
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
 ReflowComments:  true
-SortIncludes:    false
+SortIncludes:    true
+SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
 SpaceBeforeAssignmentOperators: true
 SpaceBeforeParens: ControlStatements
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79c1772..8aeb6d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,7 +48,7 @@
     externalproject_add (sdbusplus-project PREFIX
                          ${CMAKE_BINARY_DIR}/sdbusplus-project GIT_REPOSITORY
                          https://github.com/openbmc/sdbusplus.git GIT_TAG
-                         076d14af2b3e29e48471ffb7fab632317da0fc21 SOURCE_DIR
+                         bed15f0cee4784acdf151cca14efdfb98cb9d397 SOURCE_DIR
                          ${CMAKE_BINARY_DIR}/sdbusplus-src BINARY_DIR
                          ${CMAKE_BINARY_DIR}/sdbusplus-build CONFIGURE_COMMAND
                          "" BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/sdbusplus-src
diff --git a/include/Overlay.hpp b/include/Overlay.hpp
index 54a8964..d3c8eff 100644
--- a/include/Overlay.hpp
+++ b/include/Overlay.hpp
@@ -18,4 +18,4 @@
 #include <nlohmann/json.hpp>
 
 void unloadAllOverlays(void);
-bool loadOverlays(const nlohmann::json &systemConfiguration);
\ No newline at end of file
+bool loadOverlays(const nlohmann::json& systemConfiguration);
\ No newline at end of file
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 176f7ef..990eb14 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -16,26 +16,27 @@
 
 #pragma once
 #include "filesystem.hpp"
+
 #include <nlohmann/json.hpp>
 #include <sdbusplus/exception.hpp>
 
-bool findFiles(const std::filesystem::path &dirPath,
-               const std::string &matchString,
-               std::vector<std::filesystem::path> &foundPaths);
+bool findFiles(const std::filesystem::path& dirPath,
+               const std::string& matchString,
+               std::vector<std::filesystem::path>& foundPaths);
 
-bool validateJson(const nlohmann::json &schemaFile,
-                  const nlohmann::json &input);
+bool validateJson(const nlohmann::json& schemaFile,
+                  const nlohmann::json& input);
 struct DBusInternalError final : public sdbusplus::exception_t
 {
-    const char *name() const noexcept override
+    const char* name() const noexcept override
     {
         return "org.freedesktop.DBus.Error.Failed";
     };
-    const char *description() const noexcept override
+    const char* description() const noexcept override
     {
         return "internal error";
     };
-    const char *what() const noexcept override
+    const char* what() const noexcept override
     {
         return "org.freedesktop.DBus.Error.Failed: "
                "internal error";
diff --git a/include/VariantVisitors.hpp b/include/VariantVisitors.hpp
index 4b4adf4..935803e 100644
--- a/include/VariantVisitors.hpp
+++ b/include/VariantVisitors.hpp
@@ -19,56 +19,60 @@
 
 struct VariantToFloatVisitor
 {
-    template <typename T> float operator()(const T &t) const
+    template <typename T>
+    float operator()(const T& t) const
     {
         return static_cast<float>(t);
     }
 };
 template <>
 inline float VariantToFloatVisitor::
-    operator()<std::string>(const std::string &s) const
+    operator()<std::string>(const std::string& s) const
 {
     throw std::invalid_argument("Cannot translate string to float");
 }
 
 struct VariantToIntVisitor
 {
-    template <typename T> int operator()(const T &t) const
+    template <typename T>
+    int operator()(const T& t) const
     {
         return static_cast<int>(t);
     }
 };
 template <>
 inline int VariantToIntVisitor::
-    operator()<std::string>(const std::string &s) const
+    operator()<std::string>(const std::string& s) const
 {
     throw std::invalid_argument("Cannot translate string to int");
 }
 
 struct VariantToUnsignedIntVisitor
 {
-    template <typename T> unsigned int operator()(const T &t) const
+    template <typename T>
+    unsigned int operator()(const T& t) const
     {
         return static_cast<int>(t);
     }
 };
 template <>
 inline unsigned int VariantToUnsignedIntVisitor::
-    operator()<std::string>(const std::string &s) const
+    operator()<std::string>(const std::string& s) const
 {
     throw std::invalid_argument("Cannot translate string to unsigned int");
 }
 
 struct VariantToStringVisitor
 {
-    template <typename T> std::string operator()(const T &t) const
+    template <typename T>
+    std::string operator()(const T& t) const
     {
         return std::to_string(t);
     }
 };
 template <>
 inline std::string VariantToStringVisitor::
-    operator()<std::string>(const std::string &s) const
+    operator()<std::string>(const std::string& s) const
 {
     return s;
 }
diff --git a/include/devices.hpp b/include/devices.hpp
index 24cba32..ccce5d9 100644
--- a/include/devices.hpp
+++ b/include/devices.hpp
@@ -22,7 +22,7 @@
 
 struct CmpStr
 {
-    bool operator()(const char *a, const char *b) const
+    bool operator()(const char* a, const char* b) const
     {
         return std::strcmp(a, b) < 0;
     }
@@ -30,13 +30,13 @@
 
 struct ExportTemplate
 {
-    ExportTemplate(const char *parameters, const char *device) :
+    ExportTemplate(const char* parameters, const char* device) :
         parameters(parameters), device(device){};
-    const char *parameters;
-    const char *device;
+    const char* parameters;
+    const char* device;
 };
 
-const boost::container::flat_map<const char *, ExportTemplate, CmpStr>
+const boost::container::flat_map<const char*, ExportTemplate, CmpStr>
     exportTemplates{
         {{"EEPROM", ExportTemplate("eeprom $Address",
                                    "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 77d4387..14b6fb6 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -14,36 +14,37 @@
 // limitations under the License.
 */
 
-#include <Utils.hpp>
+#include "filesystem.hpp"
+
 #include <Overlay.hpp>
-#include <nlohmann/json.hpp>
-#include <fstream>
-#include <regex>
-#include <iostream>
-#include <sdbusplus/asio/connection.hpp>
-#include <sdbusplus/asio/object_server.hpp>
+#include <Utils.hpp>
+#include <VariantVisitors.hpp>
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/algorithm/string/replace.hpp>
-#include <boost/lexical_cast.hpp>
 #include <boost/container/flat_map.hpp>
 #include <boost/container/flat_set.hpp>
-#include <VariantVisitors.hpp>
-#include "filesystem.hpp"
+#include <boost/lexical_cast.hpp>
+#include <fstream>
+#include <iostream>
+#include <nlohmann/json.hpp>
+#include <regex>
+#include <sdbusplus/asio/connection.hpp>
+#include <sdbusplus/asio/object_server.hpp>
+#include <variant>
 
-constexpr const char *OUTPUT_DIR = "/var/configuration/";
-constexpr const char *configurationDirectory = PACKAGE_DIR "configurations";
-constexpr const char *schemaDirectory = PACKAGE_DIR "configurations/schemas";
-constexpr const char *globalSchema = "global.json";
-constexpr const char *TEMPLATE_CHAR = "$";
+constexpr const char* OUTPUT_DIR = "/var/configuration/";
+constexpr const char* configurationDirectory = PACKAGE_DIR "configurations";
+constexpr const char* schemaDirectory = PACKAGE_DIR "configurations/schemas";
+constexpr const char* globalSchema = "global.json";
+constexpr const char* TEMPLATE_CHAR = "$";
 constexpr const size_t PROPERTIES_CHANGED_UNTIL_FLUSH_COUNT = 20;
 constexpr const int32_t MAX_MAPPER_DEPTH = 0;
 constexpr const size_t SLEEP_AFTER_PROPERTIES_CHANGE_SECONDS = 5;
 
-namespace variant_ns = sdbusplus::message::variant_ns;
 struct cmp_str
 {
-    bool operator()(const char *a, const char *b) const
+    bool operator()(const char* a, const char* b) const
     {
         return std::strcmp(a, b) < 0;
     }
@@ -61,7 +62,7 @@
     FOUND,
     MATCH_ONE
 };
-const static boost::container::flat_map<const char *, probe_type_codes, cmp_str>
+const static boost::container::flat_map<const char*, probe_type_codes, cmp_str>
     PROBE_TYPES{{{"FALSE", probe_type_codes::FALSE_T},
                  {"TRUE", probe_type_codes::TRUE_T},
                  {"AND", probe_type_codes::AND},
@@ -69,15 +70,14 @@
                  {"FOUND", probe_type_codes::FOUND},
                  {"MATCH_ONE", probe_type_codes::MATCH_ONE}}};
 
-static constexpr std::array<const char *, 4> settableInterfaces = {
+static constexpr std::array<const char*, 4> settableInterfaces = {
     "Thresholds", "Pid", "Pid.Zone", "Stepwise"};
 using JsonVariantType =
-    sdbusplus::message::variant<std::vector<std::string>, std::string, int64_t,
-                                uint64_t, double, int32_t, uint32_t, int16_t,
-                                uint16_t, uint8_t, bool>;
+    std::variant<std::vector<std::string>, std::string, int64_t, uint64_t,
+                 double, int32_t, uint32_t, int16_t, uint16_t, uint8_t, bool>;
 using BasicVariantType =
-    sdbusplus::message::variant<std::string, int64_t, uint64_t, double, int32_t,
-                                uint32_t, int16_t, uint16_t, uint8_t, bool>;
+    std::variant<std::string, int64_t, uint64_t, double, int32_t, uint32_t,
+                 int16_t, uint16_t, uint8_t, bool>;
 
 using GetSubTreeType = std::vector<
     std::pair<std::string,
@@ -100,17 +100,17 @@
 
 const std::regex ILLEGAL_DBUS_REGEX("[^A-Za-z0-9_.]");
 
-void registerCallbacks(boost::asio::io_service &io,
-                       std::vector<sdbusplus::bus::match::match> &dbusMatches,
-                       nlohmann::json &systemConfiguration,
-                       sdbusplus::asio::object_server &objServer);
+void registerCallbacks(boost::asio::io_service& io,
+                       std::vector<sdbusplus::bus::match::match>& dbusMatches,
+                       nlohmann::json& systemConfiguration,
+                       sdbusplus::asio::object_server& objServer);
 
 // calls the mapper to find all exposed objects of an interface type
 // and creates a vector<flat_map> that contains all the key value pairs
 // getManagedObjects
 void findDbusObjects(std::shared_ptr<PerformProbe> probe,
                      std::shared_ptr<sdbusplus::asio::connection> connection,
-                     std::string &interface)
+                     std::string& interface)
 {
 
     // store reference to pending callbacks so we don't overwhelm services
@@ -125,8 +125,8 @@
 
     // add shared_ptr to vector of Probes waiting for callback from a specific
     // interface to keep alive while waiting for response
-    std::array<const char *, 1> objects = {interface.c_str()};
-    std::vector<std::shared_ptr<PerformProbe>> &pending =
+    std::array<const char*, 1> objects = {interface.c_str()};
+    std::vector<std::shared_ptr<PerformProbe>>& pending =
         pendingProbes[interface];
     auto iter = pending.emplace(pending.end(), probe);
     // only allow first call to run to not overwhelm processes
@@ -137,8 +137,8 @@
 
     // find all connections in the mapper that expose a specific type
     connection->async_method_call(
-        [connection, interface, probe](boost::system::error_code &ec,
-                                       const GetSubTreeType &interfaceSubtree) {
+        [connection, interface, probe](boost::system::error_code& ec,
+                                       const GetSubTreeType& interfaceSubtree) {
             boost::container::flat_set<std::string> interfaceConnections;
             if (ec)
             {
@@ -154,9 +154,9 @@
             }
             else
             {
-                for (auto &object : interfaceSubtree)
+                for (auto& object : interfaceSubtree)
                 {
-                    for (auto &connPair : object.second)
+                    for (auto& connPair : object.second)
                     {
                         auto insertPair =
                             interfaceConnections.insert(connPair.first);
@@ -169,12 +169,12 @@
                 return;
             }
             // get managed objects for all interfaces
-            for (const auto &conn : interfaceConnections)
+            for (const auto& conn : interfaceConnections)
             {
                 connection->async_method_call(
                     [conn,
-                     interface](boost::system::error_code &ec,
-                                const ManagedObjectType &managedInterface) {
+                     interface](boost::system::error_code& ec,
+                                const ManagedObjectType& managedInterface) {
                         if (ec)
                         {
                             std::cerr
@@ -183,7 +183,7 @@
                             pendingProbes[interface].clear();
                             return;
                         }
-                        for (auto &interfaceManagedObj : managedInterface)
+                        for (auto& interfaceManagedObj : managedInterface)
                         {
                             auto ifaceObjFind =
                                 interfaceManagedObj.second.find(interface);
@@ -191,8 +191,8 @@
                                 interfaceManagedObj.second.end())
                             {
                                 std::vector<boost::container::flat_map<
-                                    std::string, BasicVariantType>>
-                                    &dbusObject = DBUS_PROBE_OBJECTS[interface];
+                                    std::string, BasicVariantType>>&
+                                    dbusObject = DBUS_PROBE_OBJECTS[interface];
                                 dbusObject.emplace_back(ifaceObjFind->second);
                             }
                         }
@@ -209,14 +209,14 @@
 }
 // probes dbus interface dictionary for a key with a value that matches a regex
 bool probeDbus(
-    const std::string &interface,
-    const std::map<std::string, nlohmann::json> &matches,
-    std::vector<boost::container::flat_map<std::string, BasicVariantType>>
-        &devices,
-    bool &foundProbe)
+    const std::string& interface,
+    const std::map<std::string, nlohmann::json>& matches,
+    std::vector<boost::container::flat_map<std::string, BasicVariantType>>&
+        devices,
+    bool& foundProbe)
 {
-    std::vector<boost::container::flat_map<std::string, BasicVariantType>>
-        &dbusObject = DBUS_PROBE_OBJECTS[interface];
+    std::vector<boost::container::flat_map<std::string, BasicVariantType>>&
+        dbusObject = DBUS_PROBE_OBJECTS[interface];
     if (dbusObject.empty())
     {
         foundProbe = false;
@@ -225,10 +225,10 @@
     foundProbe = true;
 
     bool foundMatch = false;
-    for (auto &device : dbusObject)
+    for (auto& device : dbusObject)
     {
         bool deviceMatches = true;
-        for (auto &match : matches)
+        for (auto& match : matches)
         {
             auto deviceValue = device.find(match.first);
             if (deviceValue != device.end())
@@ -241,7 +241,7 @@
                         std::smatch match;
 
                         // convert value to string respresentation
-                        std::string probeValue = variant_ns::visit(
+                        std::string probeValue = std::visit(
                             VariantToStringVisitor(), deviceValue->second);
                         if (!std::regex_search(probeValue, match, search))
                         {
@@ -253,7 +253,7 @@
                     case nlohmann::json::value_t::boolean:
                     case nlohmann::json::value_t::number_unsigned:
                     {
-                        unsigned int probeValue = variant_ns::visit(
+                        unsigned int probeValue = std::visit(
                             VariantToUnsignedIntVisitor(), deviceValue->second);
 
                         if (probeValue != match.second.get<unsigned int>())
@@ -264,8 +264,8 @@
                     }
                     case nlohmann::json::value_t::number_integer:
                     {
-                        int probeValue = variant_ns::visit(
-                            VariantToIntVisitor(), deviceValue->second);
+                        int probeValue = std::visit(VariantToIntVisitor(),
+                                                    deviceValue->second);
 
                         if (probeValue != match.second.get<int>())
                         {
@@ -275,8 +275,8 @@
                     }
                     case nlohmann::json::value_t::number_float:
                     {
-                        float probeValue = variant_ns::visit(
-                            VariantToFloatVisitor(), deviceValue->second);
+                        float probeValue = std::visit(VariantToFloatVisitor(),
+                                                      deviceValue->second);
 
                         if (probeValue != match.second.get<float>())
                         {
@@ -307,9 +307,9 @@
 // default probe entry point, iterates a list looking for specific types to
 // call specific probe functions
 bool probe(
-    const std::vector<std::string> &probeCommand,
-    std::vector<boost::container::flat_map<std::string, BasicVariantType>>
-        &foundDevs)
+    const std::vector<std::string>& probeCommand,
+    std::vector<boost::container::flat_map<std::string, BasicVariantType>>&
+        foundDevs)
 {
     const static std::regex command(R"(\((.*)\))");
     std::smatch match;
@@ -318,10 +318,10 @@
     bool cur = true;
     probe_type_codes lastCommand = probe_type_codes::FALSE_T;
 
-    for (auto &probe : probeCommand)
+    for (auto& probe : probeCommand)
     {
         bool foundProbe = false;
-        boost::container::flat_map<const char *, probe_type_codes,
+        boost::container::flat_map<const char*, probe_type_codes,
                                    cmp_str>::const_iterator probeType;
 
         for (probeType = PROBE_TYPES.begin(); probeType != PROBE_TYPES.end();
@@ -445,9 +445,9 @@
 {
 
     PerformProbe(
-        const std::vector<std::string> &probeCommand,
+        const std::vector<std::string>& probeCommand,
         std::function<void(std::vector<boost::container::flat_map<
-                               std::string, BasicVariantType>> &)> &&callback) :
+                               std::string, BasicVariantType>>&)>&& callback) :
         _probeCommand(probeCommand),
         _callback(std::move(callback))
     {
@@ -462,14 +462,14 @@
     void run()
     {
         // parse out dbus probes by discarding other probe types
-        boost::container::flat_map<const char *, probe_type_codes,
+        boost::container::flat_map<const char*, probe_type_codes,
                                    cmp_str>::const_iterator probeType;
 
         std::vector<std::string> dbusProbes;
-        for (std::string &probe : _probeCommand)
+        for (std::string& probe : _probeCommand)
         {
             bool found = false;
-            boost::container::flat_map<const char *, probe_type_codes,
+            boost::container::flat_map<const char*, probe_type_codes,
                                        cmp_str>::const_iterator probeType;
             for (probeType = PROBE_TYPES.begin();
                  probeType != PROBE_TYPES.end(); probeType++)
@@ -492,16 +492,15 @@
         }
     }
     std::vector<std::string> _probeCommand;
-    std::function<void(
-        std::vector<boost::container::flat_map<std::string, BasicVariantType>>
-            &)>
+    std::function<void(std::vector<boost::container::flat_map<
+                           std::string, BasicVariantType>>&)>
         _callback;
     std::vector<boost::container::flat_map<std::string, BasicVariantType>>
         _foundDevs;
 };
 
 // writes output files to persist data
-bool writeJsonFiles(const nlohmann::json &systemConfiguration)
+bool writeJsonFiles(const nlohmann::json& systemConfiguration)
 {
     std::filesystem::create_directory(OUTPUT_DIR);
     std::ofstream output(std::string(OUTPUT_DIR) + "system.json");
@@ -516,14 +515,14 @@
 
 // template function to add array as dbus property
 template <typename PropertyType>
-void addArrayToDbus(const std::string &name, const nlohmann::json &array,
-                    sdbusplus::asio::dbus_interface *iface,
+void addArrayToDbus(const std::string& name, const nlohmann::json& array,
+                    sdbusplus::asio::dbus_interface* iface,
                     sdbusplus::asio::PropertyPermission permission)
 {
     std::vector<PropertyType> values;
-    for (const auto &property : array)
+    for (const auto& property : array)
     {
-        auto ptr = property.get_ptr<const PropertyType *>();
+        auto ptr = property.get_ptr<const PropertyType*>();
         if (ptr != nullptr)
         {
             values.emplace_back(*ptr);
@@ -536,13 +535,13 @@
 }
 
 template <typename JsonType>
-bool setJsonFromPointer(const std::string &ptrStr, const JsonType &value,
-                        nlohmann::json &systemConfiguration)
+bool setJsonFromPointer(const std::string& ptrStr, const JsonType& value,
+                        nlohmann::json& systemConfiguration)
 {
     try
     {
         nlohmann::json::json_pointer ptr(ptrStr);
-        nlohmann::json &ref = systemConfiguration[ptr];
+        nlohmann::json& ref = systemConfiguration[ptr];
         ref = value;
         return true;
     }
@@ -553,10 +552,10 @@
 }
 
 template <typename PropertyType>
-void addProperty(const std::string &propertyName, const PropertyType &value,
-                 sdbusplus::asio::dbus_interface *iface,
-                 nlohmann::json &systemConfiguration,
-                 const std::string &jsonPointerString,
+void addProperty(const std::string& propertyName, const PropertyType& value,
+                 sdbusplus::asio::dbus_interface* iface,
+                 nlohmann::json& systemConfiguration,
+                 const std::string& jsonPointerString,
                  sdbusplus::asio::PropertyPermission permission)
 {
     if (permission == sdbusplus::asio::PropertyPermission::readOnly)
@@ -568,7 +567,7 @@
         propertyName, value,
         [&systemConfiguration,
          jsonPointerString{std::string(jsonPointerString)}](
-            const PropertyType &newVal, PropertyType &val) {
+            const PropertyType& newVal, PropertyType& val) {
             val = newVal;
             if (!setJsonFromPointer(jsonPointerString, val,
                                     systemConfiguration))
@@ -586,10 +585,10 @@
 }
 
 void createDeleteObjectMethod(
-    const std::string &jsonPointerPath,
-    const std::shared_ptr<sdbusplus::asio::dbus_interface> &iface,
-    sdbusplus::asio::object_server &objServer,
-    nlohmann::json &systemConfiguration)
+    const std::string& jsonPointerPath,
+    const std::shared_ptr<sdbusplus::asio::dbus_interface>& iface,
+    sdbusplus::asio::object_server& objServer,
+    nlohmann::json& systemConfiguration)
 {
     std::weak_ptr<sdbusplus::asio::dbus_interface> interface = iface;
     iface->register_method(
@@ -623,13 +622,13 @@
 
 // adds simple json types to interface's properties
 void populateInterfaceFromJson(
-    nlohmann::json &systemConfiguration, const std::string &jsonPointerPath,
-    std::shared_ptr<sdbusplus::asio::dbus_interface> &iface,
-    nlohmann::json &dict, sdbusplus::asio::object_server &objServer,
+    nlohmann::json& systemConfiguration, const std::string& jsonPointerPath,
+    std::shared_ptr<sdbusplus::asio::dbus_interface>& iface,
+    nlohmann::json& dict, sdbusplus::asio::object_server& objServer,
     sdbusplus::asio::PropertyPermission permission =
         sdbusplus::asio::PropertyPermission::readOnly)
 {
-    for (auto &dictPair : dict.items())
+    for (auto& dictPair : dict.items())
     {
         auto type = dictPair.value().type();
         bool array = false;
@@ -642,7 +641,7 @@
             }
             type = dictPair.value()[0].type();
             bool isLegal = true;
-            for (const auto &arrayItem : dictPair.value())
+            for (const auto& arrayItem : dictPair.value())
             {
                 if (arrayItem.type() != type)
                 {
@@ -765,7 +764,7 @@
     iface->initialize();
 }
 
-sdbusplus::asio::PropertyPermission getPermission(const std::string &interface)
+sdbusplus::asio::PropertyPermission getPermission(const std::string& interface)
 {
     return std::find(settableInterfaces.begin(), settableInterfaces.end(),
                      interface) != settableInterfaces.end()
@@ -773,10 +772,10 @@
                : sdbusplus::asio::PropertyPermission::readOnly;
 }
 
-void createAddObjectMethod(const std::string &jsonPointerPath,
-                           const std::string &path,
-                           nlohmann::json &systemConfiguration,
-                           sdbusplus::asio::object_server &objServer)
+void createAddObjectMethod(const std::string& jsonPointerPath,
+                           const std::string& path,
+                           nlohmann::json& systemConfiguration,
+                           sdbusplus::asio::object_server& objServer)
 {
     auto iface = objServer.add_interface(path, "xyz.openbmc_project.AddObject");
 
@@ -785,10 +784,10 @@
         [&systemConfiguration, &objServer,
          jsonPointerPath{std::string(jsonPointerPath)},
          path{std::string(path)}](
-            const boost::container::flat_map<std::string, JsonVariantType>
-                &data) {
+            const boost::container::flat_map<std::string, JsonVariantType>&
+                data) {
             nlohmann::json::json_pointer ptr(jsonPointerPath);
-            nlohmann::json &base = systemConfiguration[ptr];
+            nlohmann::json& base = systemConfiguration[ptr];
             auto findExposes = base.find("Exposes");
 
             if (findExposes == base.end())
@@ -798,12 +797,11 @@
 
             // this will throw invalid-argument to sdbusplus if invalid json
             nlohmann::json newData{};
-            for (const auto &item : data)
+            for (const auto& item : data)
             {
-                nlohmann::json &newJson = newData[item.first];
-                variant_ns::visit(
-                    [&newJson](auto &&val) { newJson = std::move(val); },
-                    item.second);
+                nlohmann::json& newJson = newData[item.first];
+                std::visit([&newJson](auto&& val) { newJson = std::move(val); },
+                           item.second);
             }
 
             auto findName = newData.find("Name");
@@ -812,8 +810,8 @@
             {
                 throw std::invalid_argument("AddObject missing Name or Type");
             }
-            const std::string *type = findType->get_ptr<const std::string *>();
-            const std::string *name = findName->get_ptr<const std::string *>();
+            const std::string* type = findType->get_ptr<const std::string*>();
+            const std::string* name = findName->get_ptr<const std::string*>();
             if (type == nullptr || name == nullptr)
             {
                 throw std::invalid_argument("Type and Name must be a string.");
@@ -879,13 +877,13 @@
     iface->initialize();
 }
 
-void postToDbus(const nlohmann::json &newConfiguration,
-                nlohmann::json &systemConfiguration,
-                sdbusplus::asio::object_server &objServer)
+void postToDbus(const nlohmann::json& newConfiguration,
+                nlohmann::json& systemConfiguration,
+                sdbusplus::asio::object_server& objServer)
 
 {
     // iterate through boards
-    for (auto &boardPair : newConfiguration.items())
+    for (auto& boardPair : newConfiguration.items())
     {
         std::string boardKey = boardPair.key();
         std::vector<std::string> path;
@@ -928,7 +926,7 @@
                                   boardIface, boardValues, objServer);
         jsonPointerPath += "/";
         // iterate through board properties
-        for (auto &boardField : boardValues.items())
+        for (auto& boardField : boardValues.items())
         {
             if (boardField.value().type() == nlohmann::json::value_t::object)
             {
@@ -951,7 +949,7 @@
         // store the board level pointer so we can modify it on the way down
         std::string jsonPointerPathBoard = jsonPointerPath;
         size_t exposesIndex = -1;
-        for (auto &item : *exposes)
+        for (auto& item : *exposes)
         {
             exposesIndex++;
             jsonPointerPath = jsonPointerPathBoard;
@@ -996,7 +994,7 @@
                                       itemIface, item, objServer,
                                       getPermission(itemType));
 
-            for (auto &objectPair : item.items())
+            for (auto& objectPair : item.items())
             {
                 jsonPointerPath = jsonPointerPathBoard +
                                   std::to_string(exposesIndex) + "/" +
@@ -1029,7 +1027,7 @@
                     }
 
                     // verify legal json
-                    for (const auto &arrayItem : objectPair.value())
+                    for (const auto& arrayItem : objectPair.value())
                     {
                         if (arrayItem.type() != type)
                         {
@@ -1044,7 +1042,7 @@
                         break;
                     }
 
-                    for (auto &arrayItem : objectPair.value())
+                    for (auto& arrayItem : objectPair.value())
                     {
 
                         auto objectIface = objServer.add_interface(
@@ -1068,10 +1066,10 @@
 // the field found in a dbus object i.e. $ADDRESS would get populated with the
 // ADDRESS field from a object on dbus
 void templateCharReplace(
-    nlohmann::json::iterator &keyPair,
-    const boost::container::flat_map<std::string, BasicVariantType>
-        &foundDevice,
-    size_t &foundDeviceIdx)
+    nlohmann::json::iterator& keyPair,
+    const boost::container::flat_map<std::string, BasicVariantType>&
+        foundDevice,
+    size_t& foundDeviceIdx)
 {
     if (keyPair.value().type() == nlohmann::json::value_t::object)
     {
@@ -1102,13 +1100,12 @@
         else
         {
             bool found = false;
-            for (auto &foundDevicePair : foundDevice)
+            for (auto& foundDevicePair : foundDevice)
             {
                 if (boost::iequals(foundDevicePair.first, templateValue))
                 {
-                    variant_ns::visit(
-                        [&](auto &&val) { keyPair.value() = val; },
-                        foundDevicePair.second);
+                    std::visit([&](auto&& val) { keyPair.value() = val; },
+                               foundDevicePair.second);
                     found = true;
                     break;
                 }
@@ -1142,7 +1139,7 @@
 }
 
 // reads json files out of the filesystem
-bool findJsonFiles(std::list<nlohmann::json> &configurations)
+bool findJsonFiles(std::list<nlohmann::json>& configurations)
 {
     // find configuration files
     std::vector<std::filesystem::path> jsonPaths;
@@ -1172,7 +1169,7 @@
         return false;
     }
 
-    for (auto &jsonPath : jsonPaths)
+    for (auto& jsonPath : jsonPaths)
     {
         std::ifstream jsonStream(jsonPath.c_str());
         if (!jsonStream.good())
@@ -1198,7 +1195,7 @@
 
         if (data.type() == nlohmann::json::value_t::array)
         {
-            for (auto &d : data)
+            for (auto& d : data)
             {
                 configurations.emplace_back(d);
             }
@@ -1214,9 +1211,9 @@
 struct PerformScan : std::enable_shared_from_this<PerformScan>
 {
 
-    PerformScan(nlohmann::json &systemConfiguration,
-                std::list<nlohmann::json> &configurations,
-                std::function<void(void)> &&callback) :
+    PerformScan(nlohmann::json& systemConfiguration,
+                std::list<nlohmann::json>& configurations,
+                std::function<void(void)>&& callback) :
         _systemConfiguration(systemConfiguration),
         _configurations(configurations), _callback(std::move(callback))
     {
@@ -1262,7 +1259,7 @@
                 it = _configurations.erase(it);
                 continue;
             }
-            nlohmann::json *record = &(*it);
+            nlohmann::json* record = &(*it);
 
             // store reference to this to children to makes sure we don't get
             // destroyed too early
@@ -1271,7 +1268,7 @@
                 probeCommand,
                 [&, record, name,
                  thisRef](std::vector<boost::container::flat_map<
-                              std::string, BasicVariantType>> &foundDevices) {
+                              std::string, BasicVariantType>>& foundDevices) {
                     _passed = true;
 
                     PASSED_PROBES.push_back(name);
@@ -1281,7 +1278,7 @@
                     // reference ourselves
                     _systemConfiguration[name] = *record;
 
-                    for (auto &foundDevice : foundDevices)
+                    for (auto& foundDevice : foundDevices)
                     {
                         for (auto keyPair = record->begin();
                              keyPair != record->end(); keyPair++)
@@ -1294,7 +1291,7 @@
                         {
                             continue;
                         }
-                        for (auto &expose : *findExpose)
+                        for (auto& expose : *findExpose)
                         {
                             for (auto keyPair = expose.begin();
                                  keyPair != expose.end(); keyPair++)
@@ -1319,7 +1316,7 @@
                                     std::string bind = keyPair.key().substr(
                                         sizeof("Bind") - 1);
 
-                                    for (auto &configurationPair :
+                                    for (auto& configurationPair :
                                          _systemConfiguration.items())
                                     {
 
@@ -1335,7 +1332,7 @@
                                         {
                                             continue;
                                         }
-                                        for (auto &exposedObject :
+                                        for (auto& exposedObject :
                                              *configListFind)
                                         {
                                             std::string foundObjectName =
@@ -1390,7 +1387,7 @@
             _callback();
         }
     }
-    nlohmann::json &_systemConfiguration;
+    nlohmann::json& _systemConfiguration;
     std::list<nlohmann::json> _configurations;
     std::function<void(void)> _callback;
     std::vector<std::shared_ptr<PerformProbe>> _probes;
@@ -1399,16 +1396,16 @@
 
 // main properties changed entry
 void propertiesChangedCallback(
-    boost::asio::io_service &io,
-    std::vector<sdbusplus::bus::match::match> &dbusMatches,
-    nlohmann::json &systemConfiguration,
-    sdbusplus::asio::object_server &objServer)
+    boost::asio::io_service& io,
+    std::vector<sdbusplus::bus::match::match>& dbusMatches,
+    nlohmann::json& systemConfiguration,
+    sdbusplus::asio::object_server& objServer)
 {
     static boost::asio::deadline_timer timer(io);
     timer.expires_from_now(boost::posix_time::seconds(1));
 
     // setup an async wait as we normally get flooded with new requests
-    timer.async_wait([&](const boost::system::error_code &ec) {
+    timer.async_wait([&](const boost::system::error_code& ec) {
         if (ec == boost::asio::error::operation_aborted)
         {
             // we were cancelled
@@ -1467,14 +1464,14 @@
     });
 }
 
-void registerCallbacks(boost::asio::io_service &io,
-                       std::vector<sdbusplus::bus::match::match> &dbusMatches,
-                       nlohmann::json &systemConfiguration,
-                       sdbusplus::asio::object_server &objServer)
+void registerCallbacks(boost::asio::io_service& io,
+                       std::vector<sdbusplus::bus::match::match>& dbusMatches,
+                       nlohmann::json& systemConfiguration,
+                       sdbusplus::asio::object_server& objServer)
 {
     static boost::container::flat_set<std::string> watchedObjects;
 
-    for (const auto &objectMap : DBUS_PROBE_OBJECTS)
+    for (const auto& objectMap : DBUS_PROBE_OBJECTS)
     {
         auto findObject = watchedObjects.find(objectMap.first);
         if (findObject != watchedObjects.end())
@@ -1484,13 +1481,13 @@
         std::function<void(sdbusplus::message::message & message)>
             eventHandler =
 
-                [&](sdbusplus::message::message &) {
+                [&](sdbusplus::message::message&) {
                     propertiesChangedCallback(io, dbusMatches,
                                               systemConfiguration, objServer);
                 };
 
         sdbusplus::bus::match::match match(
-            static_cast<sdbusplus::bus::bus &>(*SYSTEM_BUS),
+            static_cast<sdbusplus::bus::bus&>(*SYSTEM_BUS),
             "type='signal',member='PropertiesChanged',arg0='" +
                 objectMap.first + "'",
             eventHandler);
@@ -1498,7 +1495,7 @@
     }
 }
 
-int main(int argc, char **argv)
+int main(int argc, char** argv)
 {
     // setup connection to dbus
     boost::asio::io_service io;
@@ -1522,10 +1519,11 @@
     nlohmann::json systemConfiguration = nlohmann::json::object();
 
     inventoryIface->register_method(
-        "Notify", [](const boost::container::flat_map<
-                      std::string,
-                      boost::container::flat_map<std::string, BasicVariantType>>
-                         &object) { return; });
+        "Notify",
+        [](const boost::container::flat_map<
+            std::string,
+            boost::container::flat_map<std::string, BasicVariantType>>&
+               object) { return; });
     inventoryIface->initialize();
 
     io.post([&]() {
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index ca0e541..5469edf 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -31,6 +31,7 @@
 #include <sdbusplus/asio/connection.hpp>
 #include <sdbusplus/asio/object_server.hpp>
 #include <thread>
+#include <variant>
 
 extern "C" {
 #include <i2c/smbus.h>
@@ -44,12 +45,12 @@
 constexpr size_t MAX_EEPROM_PAGE_INDEX = 255;
 constexpr size_t busTimeoutSeconds = 5;
 
-const static constexpr char *BASEBOARD_FRU_LOCATION =
+const static constexpr char* BASEBOARD_FRU_LOCATION =
     "/etc/fru/baseboard.fru.bin";
 
-const static constexpr char *I2C_DEV_LOCATION = "/dev";
+const static constexpr char* I2C_DEV_LOCATION = "/dev";
 
-static constexpr std::array<const char *, 5> FRU_AREAS = {
+static constexpr std::array<const char*, 5> FRU_AREAS = {
     "INTERNAL", "CHASSIS", "BOARD", "PRODUCT", "MULTIRECORD"};
 const static std::regex NON_ASCII_REGEX("[^\x01-\x7f]");
 using DeviceMap = boost::container::flat_map<int, std::vector<char>>;
@@ -90,7 +91,7 @@
 }
 
 static int read_block_data(int flag, int file, uint16_t offset, uint8_t len,
-                           uint8_t *buf)
+                           uint8_t* buf)
 {
     uint8_t low_addr = offset & 0xFF;
     uint8_t high_addr = (offset >> 8) & 0xFF;
@@ -222,11 +223,11 @@
     return future.get();
 }
 
-static void FindI2CDevices(const std::vector<fs::path> &i2cBuses,
+static void FindI2CDevices(const std::vector<fs::path>& i2cBuses,
                            std::shared_ptr<FindDevicesWithCallback> context,
-                           boost::asio::io_service &io, BusMap &busMap)
+                           boost::asio::io_service& io, BusMap& busMap)
 {
-    for (auto &i2cBus : i2cBuses)
+    for (auto& i2cBus : i2cBuses)
     {
         auto busnum = i2cBus.string();
         auto lastDash = busnum.rfind(std::string("-"));
@@ -260,7 +261,7 @@
                       << bus << "\n";
             continue;
         }
-        auto &device = busMap[bus];
+        auto& device = busMap[bus];
         device = std::make_shared<DeviceMap>();
 
         // don't scan muxed buses async as don't want to confuse the mux
@@ -288,9 +289,9 @@
 struct FindDevicesWithCallback
     : std::enable_shared_from_this<FindDevicesWithCallback>
 {
-    FindDevicesWithCallback(const std::vector<fs::path> &i2cBuses,
-                            boost::asio::io_service &io, BusMap &busMap,
-                            std::function<void(void)> &&callback) :
+    FindDevicesWithCallback(const std::vector<fs::path>& i2cBuses,
+                            boost::asio::io_service& io, BusMap& busMap,
+                            std::function<void(void)>&& callback) :
         _i2cBuses(i2cBuses),
         _io(io), _busMap(busMap), _callback(std::move(callback))
     {
@@ -304,9 +305,9 @@
         FindI2CDevices(_i2cBuses, shared_from_this(), _io, _busMap);
     }
 
-    const std::vector<fs::path> &_i2cBuses;
-    boost::asio::io_service &_io;
-    BusMap &_busMap;
+    const std::vector<fs::path>& _i2cBuses;
+    boost::asio::io_service& _io;
+    BusMap& _busMap;
     std::function<void(void)> _callback;
 };
 
@@ -317,17 +318,17 @@
     return val;
 }
 
-bool formatFru(const std::vector<char> &fruBytes,
-               boost::container::flat_map<std::string, std::string> &result)
+bool formatFru(const std::vector<char>& fruBytes,
+               boost::container::flat_map<std::string, std::string>& result)
 {
-    static const std::vector<const char *> CHASSIS_FRU_AREAS = {
+    static const std::vector<const char*> CHASSIS_FRU_AREAS = {
         "PART_NUMBER", "SERIAL_NUMBER", "INFO_AM1", "INFO_AM2"};
 
-    static const std::vector<const char *> BOARD_FRU_AREAS = {
+    static const std::vector<const char*> BOARD_FRU_AREAS = {
         "MANUFACTURER",   "PRODUCT_NAME", "SERIAL_NUMBER", "PART_NUMBER",
         "FRU_VERSION_ID", "INFO_AM1",     "INFO_AM2"};
 
-    static const std::vector<const char *> PRODUCT_FRU_AREAS = {
+    static const std::vector<const char*> PRODUCT_FRU_AREAS = {
         "MANUFACTURER",   "PRODUCT_NAME",  "PART_NUMBER",
         "VERSION",        "SERIAL_NUMBER", "ASSET_TAG",
         "FRU_VERSION_ID", "INFO_AM1",      "INFO_AM2"};
@@ -342,9 +343,9 @@
     result["Common_Format_Version"] =
         std::to_string(static_cast<int>(*fruAreaOffsetField));
 
-    const std::vector<const char *> *fieldData;
+    const std::vector<const char*>* fieldData;
 
-    for (auto &area : FRU_AREAS)
+    for (auto& area : FRU_AREAS)
     {
         fruAreaOffsetField++;
         if (fruAreaOffsetField >= fruBytes.end())
@@ -406,7 +407,7 @@
             {
                 continue;
             }
-            for (auto &field : *fieldData)
+            for (auto& field : *fieldData)
             {
                 if (fruBytesIter >= fruBytes.end())
                 {
@@ -442,14 +443,14 @@
                 if (fruBytesIter >= fruBytes.end())
                 {
                     std::cerr << "Warning Fru Length Mismatch:\n    ";
-                    for (auto &c : fruBytes)
+                    for (auto& c : fruBytes)
                     {
                         std::cerr << c;
                     }
                     std::cerr << "\n";
                     if (DEBUG)
                     {
-                        for (auto &keyPair : result)
+                        for (auto& keyPair : result)
                         {
                             std::cerr << keyPair.first << " : "
                                       << keyPair.second << "\n";
@@ -466,10 +467,10 @@
 
 void AddFruObjectToDbus(
     std::shared_ptr<sdbusplus::asio::connection> dbusConn,
-    std::vector<char> &device, sdbusplus::asio::object_server &objServer,
-    boost::container::flat_map<std::pair<size_t, size_t>,
-                               std::shared_ptr<sdbusplus::asio::dbus_interface>>
-        &dbusInterfaceMap,
+    std::vector<char>& device, sdbusplus::asio::object_server& objServer,
+    boost::container::flat_map<
+        std::pair<size_t, size_t>,
+        std::shared_ptr<sdbusplus::asio::dbus_interface>>& dbusInterfaceMap,
     uint32_t bus, uint32_t address)
 {
     boost::container::flat_map<std::string, std::string> formattedFru;
@@ -502,7 +503,7 @@
     if (bus > 0)
     {
         size_t index = 0;
-        for (auto const &busIface : dbusInterfaceMap)
+        for (auto const& busIface : dbusInterfaceMap)
         {
             if ((busIface.second->get_object_path() == productName))
             {
@@ -529,7 +530,7 @@
         objServer.add_interface(productName, "xyz.openbmc_project.FruDevice");
     dbusInterfaceMap[std::pair<size_t, size_t>(bus, address)] = iface;
 
-    for (auto &property : formattedFru)
+    for (auto& property : formattedFru)
     {
 
         std::regex_replace(property.second.begin(), property.second.begin(),
@@ -557,7 +558,7 @@
     iface->initialize();
 }
 
-static bool readBaseboardFru(std::vector<char> &baseboardFru)
+static bool readBaseboardFru(std::vector<char>& baseboardFru)
 {
     // try to read baseboard fru from file
     std::ifstream baseboardFruFile(BASEBOARD_FRU_LOCATION, std::ios::binary);
@@ -576,7 +577,7 @@
     return true;
 }
 
-bool writeFru(uint8_t bus, uint8_t address, const std::vector<uint8_t> &fru)
+bool writeFru(uint8_t bus, uint8_t address, const std::vector<uint8_t>& fru)
 {
     boost::container::flat_map<std::string, std::string> tmp;
     if (fru.size() > MAX_FRU_SIZE)
@@ -585,7 +586,7 @@
         return false;
     }
     // verify legal fru by running it through fru parsing logic
-    if (!formatFru(reinterpret_cast<const std::vector<char> &>(fru), tmp))
+    if (!formatFru(reinterpret_cast<const std::vector<char>&>(fru), tmp))
     {
         std::cerr << "Invalid fru format during writeFru\n";
         return false;
@@ -601,7 +602,7 @@
             throw DBusInternalError();
             return false;
         }
-        file.write(reinterpret_cast<const char *>(fru.data()), fru.size());
+        file.write(reinterpret_cast<const char*>(fru.data()), fru.size());
         return file.good();
     }
     else
@@ -667,18 +668,18 @@
 }
 
 void rescanBusses(
-    boost::asio::io_service &io, BusMap &busMap,
-    boost::container::flat_map<std::pair<size_t, size_t>,
-                               std::shared_ptr<sdbusplus::asio::dbus_interface>>
-        &dbusInterfaceMap,
-    std::shared_ptr<sdbusplus::asio::connection> &systemBus,
-    sdbusplus::asio::object_server &objServer)
+    boost::asio::io_service& io, BusMap& busMap,
+    boost::container::flat_map<
+        std::pair<size_t, size_t>,
+        std::shared_ptr<sdbusplus::asio::dbus_interface>>& dbusInterfaceMap,
+    std::shared_ptr<sdbusplus::asio::connection>& systemBus,
+    sdbusplus::asio::object_server& objServer)
 {
     static boost::asio::deadline_timer timer(io);
     timer.expires_from_now(boost::posix_time::seconds(1));
 
     // setup an async wait in case we get flooded with requests
-    timer.async_wait([&](const boost::system::error_code &ec) {
+    timer.async_wait([&](const boost::system::error_code& ec) {
         auto devDir = fs::path("/dev/");
         auto matchString = std::string("i2c*");
         std::vector<fs::path> i2cBuses;
@@ -695,7 +696,7 @@
         busMap.clear();
         auto scan = std::make_shared<FindDevicesWithCallback>(
             i2cBuses, io, busMap, [&]() {
-                for (auto &busIface : dbusInterfaceMap)
+                for (auto& busIface : dbusInterfaceMap)
                 {
                     objServer.remove_interface(busIface.second);
                 }
@@ -712,9 +713,9 @@
                     baseboardDev.emplace(0, baseboardFru);
                     busMap[0] = std::make_shared<DeviceMap>(baseboardDev);
                 }
-                for (auto &devicemap : busMap)
+                for (auto& devicemap : busMap)
                 {
-                    for (auto &device : *devicemap.second)
+                    for (auto& device : *devicemap.second)
                     {
                         AddFruObjectToDbus(systemBus, device.second, objServer,
                                            dbusInterfaceMap, devicemap.first,
@@ -726,7 +727,7 @@
     });
 }
 
-int main(int argc, char **argv)
+int main(int argc, char** argv)
 {
     auto devDir = fs::path("/dev/");
     auto matchString = std::string("i2c*");
@@ -759,7 +760,7 @@
     });
 
     iface->register_method(
-        "GetRawFru", [&](const uint8_t &bus, const uint8_t &address) {
+        "GetRawFru", [&](const uint8_t& bus, const uint8_t& address) {
             auto deviceMap = busmap.find(bus);
             if (deviceMap == busmap.end())
             {
@@ -770,14 +771,14 @@
             {
                 throw std::invalid_argument("Invalid Address.");
             }
-            std::vector<uint8_t> &ret =
-                reinterpret_cast<std::vector<uint8_t> &>(device->second);
+            std::vector<uint8_t>& ret =
+                reinterpret_cast<std::vector<uint8_t>&>(device->second);
             return ret;
         });
 
     iface->register_method("WriteFru", [&](const uint8_t bus,
                                            const uint8_t address,
-                                           const std::vector<uint8_t> &data) {
+                                           const std::vector<uint8_t>& data) {
         if (!writeFru(bus, address, data))
         {
             throw std::invalid_argument("Invalid Arguments.");
@@ -789,11 +790,11 @@
     iface->initialize();
 
     std::function<void(sdbusplus::message::message & message)> eventHandler =
-        [&](sdbusplus::message::message &message) {
+        [&](sdbusplus::message::message& message) {
             std::string objectName;
             boost::container::flat_map<
-                std::string, sdbusplus::message::variant<
-                                 std::string, bool, int64_t, uint64_t, double>>
+                std::string,
+                std::variant<std::string, bool, int64_t, uint64_t, double>>
                 values;
             message.read(objectName, values);
             auto findPgood = values.find("pgood");
@@ -806,7 +807,7 @@
         };
 
     sdbusplus::bus::match::match powerMatch = sdbusplus::bus::match::match(
-        static_cast<sdbusplus::bus::bus &>(*systemBus),
+        static_cast<sdbusplus::bus::bus&>(*systemBus),
         "type='signal',interface='org.freedesktop.DBus.Properties',path_"
         "namespace='/xyz/openbmc_project/Chassis/Control/"
         "power0',arg0='xyz.openbmc_project.Chassis.Control.Power'",
@@ -820,7 +821,7 @@
     // monitor for new i2c devices
     boost::asio::posix::stream_descriptor dirWatch(io, fd);
     std::function<void(const boost::system::error_code, std::size_t)>
-        watchI2cBusses = [&](const boost::system::error_code &ec,
+        watchI2cBusses = [&](const boost::system::error_code& ec,
                              std::size_t bytes_transferred) {
             if (ec)
             {
@@ -831,8 +832,8 @@
             bool devChange = false;
             while (pendingBuffer.size() > sizeof(inotify_event))
             {
-                const inotify_event *iEvent =
-                    reinterpret_cast<const inotify_event *>(
+                const inotify_event* iEvent =
+                    reinterpret_cast<const inotify_event*>(
                         pendingBuffer.data());
                 switch (iEvent->mask)
                 {
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 07b5e60..c1b6de4 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -14,29 +14,30 @@
 // limitations under the License.
 */
 
-#include <string>
-#include <iostream>
-#include <regex>
-#include <iomanip>
-#include <boost/process/child.hpp>
-#include <boost/algorithm/string/predicate.hpp>
 #include "filesystem.hpp"
-#include <boost/container/flat_map.hpp>
-#include <boost/container/flat_set.hpp>
-#include <nlohmann/json.hpp>
-#include <devices.hpp>
+
 #include <Overlay.hpp>
 #include <Utils.hpp>
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/container/flat_map.hpp>
+#include <boost/container/flat_set.hpp>
+#include <boost/process/child.hpp>
+#include <devices.hpp>
+#include <iomanip>
+#include <iostream>
+#include <nlohmann/json.hpp>
+#include <regex>
+#include <string>
 
-constexpr const char *DT_OVERLAY = "/usr/bin/dtoverlay";
-constexpr const char *DTC = "/usr/bin/dtc";
-constexpr const char *OUTPUT_DIR = "/tmp/overlays";
-constexpr const char *TEMPLATE_DIR = PACKAGE_DIR "overlay_templates";
-constexpr const char *TEMPLATE_CHAR = "$";
-constexpr const char *HEX_FORMAT_STR = "0x";
-constexpr const char *PLATFORM = "aspeed,ast2500";
-constexpr const char *I2C_DEVS_DIR = "/sys/bus/i2c/devices";
-constexpr const char *MUX_SYMLINK_DIR = "/dev/i2c-mux";
+constexpr const char* DT_OVERLAY = "/usr/bin/dtoverlay";
+constexpr const char* DTC = "/usr/bin/dtc";
+constexpr const char* OUTPUT_DIR = "/tmp/overlays";
+constexpr const char* TEMPLATE_DIR = PACKAGE_DIR "overlay_templates";
+constexpr const char* TEMPLATE_CHAR = "$";
+constexpr const char* HEX_FORMAT_STR = "0x";
+constexpr const char* PLATFORM = "aspeed,ast2500";
+constexpr const char* I2C_DEVS_DIR = "/sys/bus/i2c/devices";
+constexpr const char* MUX_SYMLINK_DIR = "/dev/i2c-mux";
 
 // some drivers need to be unbind / bind to load device tree changes
 static const boost::container::flat_map<std::string, std::string> FORCE_PROBES =
@@ -44,8 +45,8 @@
 
 std::regex ILLEGAL_NAME_REGEX("[^A-Za-z0-9_]");
 
-void createOverlay(const std::string &templatePath,
-                   const nlohmann::json &configuration);
+void createOverlay(const std::string& templatePath,
+                   const nlohmann::json& configuration);
 
 void unloadAllOverlays(void)
 {
@@ -55,7 +56,7 @@
 
 // this is hopefully temporary, but some drivers can't detect changes
 // without an unbind and bind so this function must exist for now
-void forceProbe(const std::string &driver)
+void forceProbe(const std::string& driver)
 {
     std::ofstream driverUnbind(driver + "/unbind");
     std::ofstream driverBind(driver + "/bind");
@@ -72,7 +73,7 @@
     }
 
     std::filesystem::path pathObj(driver);
-    for (auto &p : std::filesystem::directory_iterator(pathObj))
+    for (auto& p : std::filesystem::directory_iterator(pathObj))
     {
         // symlinks are object names
         if (is_symlink(p))
@@ -88,7 +89,7 @@
 }
 
 // helper function to make json types into string
-std::string jsonToString(const nlohmann::json &in)
+std::string jsonToString(const nlohmann::json& in)
 {
     if (in.type() == nlohmann::json::value_t::string)
     {
@@ -105,8 +106,8 @@
     return in.dump();
 }
 
-void linkMux(const std::string &muxName, size_t bus, size_t address,
-             const nlohmann::json::array_t &channelNames)
+void linkMux(const std::string& muxName, size_t bus, size_t address,
+             const nlohmann::json::array_t& channelNames)
 {
     // create directory first time
     static bool createDir = false;
@@ -118,7 +119,7 @@
     }
     std::ostringstream hex;
     hex << std::hex << std::setfill('0') << std::setw(4) << address;
-    const std::string &addressHex = hex.str();
+    const std::string& addressHex = hex.str();
 
     std::filesystem::path devDir(I2C_DEVS_DIR);
     devDir /= std::to_string(bus) + "-" + addressHex;
@@ -134,8 +135,8 @@
         }
         else
         {
-            const std::string *ptr =
-                channelNames[channel].get_ptr<const std::string *>();
+            const std::string* ptr =
+                channelNames[channel].get_ptr<const std::string*>();
             if (ptr == nullptr)
             {
                 channelName = channelNames[channel].dump();
@@ -152,7 +153,7 @@
         }
 
         std::filesystem::path bus = std::filesystem::read_symlink(channelPath);
-        const std::string &busName = bus.filename();
+        const std::string& busName = bus.filename();
 
         std::string linkDir = MUX_SYMLINK_DIR + std::string("/") + muxName;
         if (channel == 0)
@@ -177,17 +178,17 @@
     }
 }
 
-void exportDevice(const std::string &type,
-                  const devices::ExportTemplate &exportTemplate,
-                  const nlohmann::json &configuration)
+void exportDevice(const std::string& type,
+                  const devices::ExportTemplate& exportTemplate,
+                  const nlohmann::json& configuration)
 {
 
     std::string parameters = exportTemplate.parameters;
     std::string device = exportTemplate.device;
     std::string name = "unknown";
-    const uint64_t *bus = nullptr;
-    const uint64_t *address = nullptr;
-    const nlohmann::json::array_t *channels = nullptr;
+    const uint64_t* bus = nullptr;
+    const uint64_t* address = nullptr;
+    const nlohmann::json::array_t* channels = nullptr;
 
     for (auto keyPair = configuration.begin(); keyPair != configuration.end();
          keyPair++)
@@ -208,16 +209,16 @@
 
         if (keyPair.key() == "Bus")
         {
-            bus = keyPair.value().get_ptr<const uint64_t *>();
+            bus = keyPair.value().get_ptr<const uint64_t*>();
         }
         else if (keyPair.key() == "Address")
         {
-            address = keyPair.value().get_ptr<const uint64_t *>();
+            address = keyPair.value().get_ptr<const uint64_t*>();
         }
         else if (keyPair.key() == "ChannelNames")
         {
             channels =
-                keyPair.value().get_ptr<const nlohmann::json::array_t *>();
+                keyPair.value().get_ptr<const nlohmann::json::array_t*>();
         }
         boost::replace_all(parameters, TEMPLATE_CHAR + keyPair.key(),
                            subsituteString);
@@ -230,19 +231,19 @@
     {
         std::ostringstream hex;
         hex << std::hex << *address;
-        const std::string &addressHex = hex.str();
+        const std::string& addressHex = hex.str();
         std::string busStr = std::to_string(*bus);
 
         std::filesystem::path devicePath(device);
-        const std::string &dir = devicePath.parent_path().string();
-        for (const auto &path : std::filesystem::directory_iterator(dir))
+        const std::string& dir = devicePath.parent_path().string();
+        for (const auto& path : std::filesystem::directory_iterator(dir))
         {
             if (!std::filesystem::is_directory(path))
             {
                 continue;
             }
 
-            const std::string &directoryName = path.path().filename();
+            const std::string& directoryName = path.path().filename();
             if (boost::starts_with(directoryName, busStr) &&
                 boost::ends_with(directoryName, addressHex))
             {
@@ -266,8 +267,8 @@
 }
 
 // this is now deprecated
-void createOverlay(const std::string &templatePath,
-                   const nlohmann::json &configuration)
+void createOverlay(const std::string& templatePath,
+                   const nlohmann::json& configuration)
 {
     std::ifstream templateFile(templatePath);
 
@@ -364,7 +365,7 @@
     }
 }
 
-bool loadOverlays(const nlohmann::json &systemConfiguration)
+bool loadOverlays(const nlohmann::json& systemConfiguration)
 {
 
     std::vector<std::filesystem::path> paths;
@@ -387,7 +388,7 @@
             continue;
         }
 
-        for (auto &configuration : *findExposes)
+        for (auto& configuration : *findExposes)
         {
             auto findStatus = configuration.find("Status");
             // status missing is assumed to be 'okay'
@@ -405,7 +406,7 @@
 #if OVERLAYS
 
             std::string typeFile = type + std::string(".template");
-            for (const auto &path : paths)
+            for (const auto& path : paths)
             {
                 if (path.filename() != typeFile)
                 {
diff --git a/src/Utils.cpp b/src/Utils.cpp
index dda3b40..66841de 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -14,8 +14,9 @@
 // limitations under the License.
 */
 
-#include <Utils.hpp>
 #include "filesystem.hpp"
+
+#include <Utils.hpp>
 #include <fstream>
 #include <regex>
 #include <valijson/adapters/nlohmann_json_adapter.hpp>
@@ -25,15 +26,15 @@
 
 namespace fs = std::filesystem;
 
-bool findFiles(const fs::path &dirPath, const std::string &matchString,
-               std::vector<fs::path> &foundPaths)
+bool findFiles(const fs::path& dirPath, const std::string& matchString,
+               std::vector<fs::path>& foundPaths)
 {
     if (!fs::exists(dirPath))
         return false;
 
     std::regex search(matchString);
     std::smatch match;
-    for (const auto &p : fs::directory_iterator(dirPath))
+    for (const auto& p : fs::directory_iterator(dirPath))
     {
         std::string path = p.path().string();
         if (std::regex_search(path, match, search))
@@ -44,7 +45,7 @@
     return true;
 }
 
-bool validateJson(const nlohmann::json &schemaFile, const nlohmann::json &input)
+bool validateJson(const nlohmann::json& schemaFile, const nlohmann::json& input)
 {
     valijson::Schema schema;
     valijson::SchemaParser parser;