lint: fix trivial clang tidy errors

Change-Id: Ie5395004a451d6168249f56f75c5e6ae31dca4af
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/fail-monitor/monitor.cpp b/fail-monitor/monitor.cpp
index 97316c9..2c4beb7 100644
--- a/fail-monitor/monitor.cpp
+++ b/fail-monitor/monitor.cpp
@@ -38,13 +38,13 @@
 
 void Monitor::analyze()
 {
-    if (inFailedState(std::move(getSourceUnitPath())))
+    if (inFailedState(getSourceUnitPath()))
     {
         runTargetAction();
     }
 }
 
-bool Monitor::inFailedState(const std::string&& path)
+bool Monitor::inFailedState(const std::string& path)
 {
     std::variant<std::string> property;
 
@@ -93,7 +93,8 @@
 void Monitor::runTargetAction()
 {
     // Start or stop the target unit
-    auto methodCall = (action == Action::start) ? startMethod : stopMethod;
+    const auto* methodCall =
+        (action == Action::start) ? startMethod : stopMethod;
 
     log<level::INFO>("The source unit is in failed state, "
                      "running target action",
diff --git a/fail-monitor/monitor.hpp b/fail-monitor/monitor.hpp
index 4393d99..a8a387f 100644
--- a/fail-monitor/monitor.hpp
+++ b/fail-monitor/monitor.hpp
@@ -37,7 +37,7 @@
     Monitor(const Monitor&) = delete;
     Monitor(Monitor&&) = default;
     Monitor& operator=(const Monitor&) = delete;
-    Monitor& operator=(Monitor&&) = default;
+    Monitor& operator=(Monitor&&) = delete;
     ~Monitor() = default;
 
     /**
@@ -49,7 +49,7 @@
      */
     Monitor(const std::string& sourceUnit, const std::string& targetUnit,
             Action action) :
-        bus(std::move(sdbusplus::bus::new_default())),
+        bus(sdbusplus::bus::new_default()),
         source(sourceUnit), target(targetUnit), action(action)
     {}
 
@@ -73,7 +73,7 @@
      *
      * @return - true if this unit is in the failed state
      */
-    bool inFailedState(const std::string&& path);
+    bool inFailedState(const std::string& path);
 
     /**
      * Runs the action on the target unit.
diff --git a/src/associations.cpp b/src/associations.cpp
index 306afe5..75457d9 100644
--- a/src/associations.cpp
+++ b/src/associations.cpp
@@ -128,7 +128,7 @@
             // changed.
             boost::container::flat_set<std::string> toRemove;
 
-            for (auto& originalEndpoint : originalEndpoints)
+            for (const auto& originalEndpoint : originalEndpoints)
             {
                 if (std::find(newEndpoints->second.begin(),
                               newEndpoints->second.end(),
@@ -156,7 +156,7 @@
     auto& endpoints = std::get<endpointsPos>(iface);
 
     // Only add new endpoints
-    for (auto& e : endpointPaths)
+    for (const auto& e : endpointPaths)
     {
         if (std::find(endpoints.begin(), endpoints.end(), e) == endpoints.end())
         {
@@ -190,30 +190,30 @@
     {
         std::string forward;
         std::string reverse;
-        std::string endpoint;
-        std::tie(forward, reverse, endpoint) = association;
+        std::string objectPath;
+        std::tie(forward, reverse, objectPath) = association;
 
-        if (endpoint.empty())
+        if (objectPath.empty())
         {
             std::cerr << "Found invalid association on path " << path << "\n";
             continue;
         }
 
         // Can't create this association if the endpoint isn't on D-Bus.
-        if (interfaceMap.find(endpoint) == interfaceMap.end())
+        if (interfaceMap.find(objectPath) == interfaceMap.end())
         {
-            addPendingAssociation(endpoint, reverse, path, forward, owner,
+            addPendingAssociation(objectPath, reverse, path, forward, owner,
                                   assocMaps);
             continue;
         }
 
-        if (forward.size())
+        if (!forward.empty())
         {
-            objects[path + "/" + forward].emplace(endpoint);
+            objects[path + "/" + forward].emplace(objectPath);
         }
-        if (reverse.size())
+        if (!reverse.empty())
         {
-            objects[endpoint + "/" + reverse].emplace(path);
+            objects[objectPath + "/" + reverse].emplace(path);
         }
     }
     for (const auto& object : objects)
@@ -415,10 +415,9 @@
             // exception is thrown. mapper has no control of the interface/path
             // of the associations, so it has to catch the error and drop the
             // association request.
-            fprintf(stderr,
-                    "Error adding association: assocPath %s, endpointPath %s, "
-                    "what: %s\n",
-                    assocPath.c_str(), endpointPath.c_str(), e.what());
+            std::cerr << "Error adding association: assocPath " << assocPath
+                      << ", endpointPath " << endpointPath
+                      << ", what: " << e.what() << "\n";
         }
 
         // Not pending anymore
diff --git a/src/main.cpp b/src/main.cpp
index 69ab8e1..c969777 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,6 +17,7 @@
 #include <chrono>
 #include <iomanip>
 #include <iostream>
+#include <utility>
 
 AssociationMaps associationMaps;
 
@@ -61,6 +62,11 @@
 
 struct InProgressIntrospect
 {
+    InProgressIntrospect() = delete;
+    InProgressIntrospect(const InProgressIntrospect&) = delete;
+    InProgressIntrospect(InProgressIntrospect&&) = delete;
+    InProgressIntrospect& operator=(const InProgressIntrospect&) = delete;
+    InProgressIntrospect& operator=(InProgressIntrospect&&) = delete;
     InProgressIntrospect(
         sdbusplus::asio::connection* systemBus, boost::asio::io_context& io,
         const std::string& processName, AssociationMaps& am
@@ -74,7 +80,7 @@
         io(io), processName(processName), assocMaps(am)
 #ifdef DEBUG
         ,
-        globalStartTime(globalStartTime),
+        globalStartTime(std::move(globalStartTime)),
         processStartTime(std::chrono::steady_clock::now())
 #endif
     {}
@@ -142,10 +148,10 @@
 }
 
 void doIntrospect(sdbusplus::asio::connection* systemBus,
-                  std::shared_ptr<InProgressIntrospect> transaction,
+                  const std::shared_ptr<InProgressIntrospect>& transaction,
                   InterfaceMapType& interfaceMap,
                   sdbusplus::asio::object_server& objectServer,
-                  std::string path, int timeoutRetries = 0)
+                  const std::string& path, int timeoutRetries = 0)
 {
     constexpr int maxTimeoutRetries = 3;
     systemBus->async_method_call(
@@ -440,16 +446,16 @@
     {
         reqPath.pop_back();
     }
-    if (reqPath.size() && interfaceMap.find(reqPath) == interfaceMap.end())
+    if (!reqPath.empty() && interfaceMap.find(reqPath) == interfaceMap.end())
     {
         throw sdbusplus::xyz::openbmc_project::Common::Error::
             ResourceNotFound();
     }
 
     std::vector<InterfaceMapType::value_type> ret;
-    for (auto& objectPath : interfaceMap)
+    for (const auto& objectPath : interfaceMap)
     {
-        auto& thisPath = objectPath.first;
+        const auto& thisPath = objectPath.first;
         if (boost::starts_with(reqPath, thisPath) && (reqPath != thisPath))
         {
             if (interfaces.empty())
@@ -458,7 +464,7 @@
             }
             else
             {
-                for (auto& interfaceMap : objectPath.second)
+                for (const auto& interfaceMap : objectPath.second)
                 {
                     if (intersect(interfaces.begin(), interfaces.end(),
                                   interfaceMap.second.begin(),
@@ -494,7 +500,7 @@
     {
         return pathRef->second;
     }
-    for (auto& interfaceMap : pathRef->second)
+    for (const auto& interfaceMap : pathRef->second)
     {
         if (intersect(interfaces.begin(), interfaces.end(),
                       interfaceMap.second.begin(), interfaceMap.second.end()))
@@ -528,15 +534,15 @@
     {
         reqPath.pop_back();
     }
-    if (reqPath.size() && interfaceMap.find(reqPath) == interfaceMap.end())
+    if (!reqPath.empty() && interfaceMap.find(reqPath) == interfaceMap.end())
     {
         throw sdbusplus::xyz::openbmc_project::Common::Error::
             ResourceNotFound();
     }
 
-    for (auto& objectPath : interfaceMap)
+    for (const auto& objectPath : interfaceMap)
     {
-        auto& thisPath = objectPath.first;
+        const auto& thisPath = objectPath.first;
 
         if (thisPath == reqPath)
         {
@@ -550,7 +556,7 @@
                                            thisPath.end(), '/');
             if (thisDepth <= depth)
             {
-                for (auto& interfaceMap : objectPath.second)
+                for (const auto& interfaceMap : objectPath.second)
                 {
                     if (intersect(interfaces.begin(), interfaces.end(),
                                   interfaceMap.second.begin(),
@@ -583,15 +589,15 @@
     {
         reqPath.pop_back();
     }
-    if (reqPath.size() && interfaceMap.find(reqPath) == interfaceMap.end())
+    if (!reqPath.empty() && interfaceMap.find(reqPath) == interfaceMap.end())
     {
         throw sdbusplus::xyz::openbmc_project::Common::Error::
             ResourceNotFound();
     }
 
-    for (auto& objectPath : interfaceMap)
+    for (const auto& objectPath : interfaceMap)
     {
-        auto& thisPath = objectPath.first;
+        const auto& thisPath = objectPath.first;
 
         if (thisPath == reqPath)
         {
@@ -606,7 +612,7 @@
             if (thisDepth <= depth)
             {
                 bool add = interfaces.empty();
-                for (auto& interfaceMap : objectPath.second)
+                for (const auto& interfaceMap : objectPath.second)
                 {
                     if (intersect(interfaces.begin(), interfaces.end(),
                                   interfaceMap.second.begin(),
diff --git a/src/test/util/debug_output.hpp b/src/test/util/debug_output.hpp
index 3cdf42b..ea0ebf9 100644
--- a/src/test/util/debug_output.hpp
+++ b/src/test/util/debug_output.hpp
@@ -8,20 +8,20 @@
 {
     using namespace std;
     cout << "##### AssociationOwnersType #####" << endl;
-    for (auto i : assocOwners)
+    for (const auto& i : assocOwners)
     {
         cout << "------------------------------------" << endl;
         cout << setw(15) << left << "OBJ PATH:" << i.first << endl;
 
-        for (auto j : i.second)
+        for (const auto& j : i.second)
         {
             cout << setw(16) << left << "DBUS SERVICE:" << j.first << endl;
 
-            for (auto k : j.second)
+            for (const auto& k : j.second)
             {
                 cout << setw(17) << left << "ASSOC PATH:" << k.first << endl;
 
-                for (auto l : k.second)
+                for (const auto& l : k.second)
                 {
                     cout << setw(18) << left << "ENDPOINT:" << l << endl;
                 }
@@ -41,7 +41,7 @@
         cout << setw(15) << left << "OBJ PATH:" << i.first << endl;
         auto intfEndpoints = std::get<endpointsPos>(i.second);
 
-        for (auto k : intfEndpoints)
+        for (const auto& k : intfEndpoints)
         {
             cout << setw(16) << left << "ENDPOINTS:" << k << endl;
         }
@@ -53,16 +53,16 @@
 {
     using namespace std;
     cout << "##### interfaceMapType #####" << endl;
-    for (auto i : intfMap)
+    for (const auto& i : intfMap)
     {
         cout << "------------------------------------" << endl;
         cout << setw(15) << left << "OBJ PATH:" << i.first << endl;
 
-        for (auto j : i.second)
+        for (const auto& j : i.second)
         {
             cout << setw(16) << left << "DBUS SERVICE:" << j.first << endl;
 
-            for (auto k : j.second)
+            for (const auto& k : j.second)
             {
                 cout << setw(18) << left << "INTERFACE:" << k << endl;
             }