clang-tidy: Enable performance-unnecessary-value-param check

This check flags value parameter declarations of expensive to copy
types that are copied for each invocation but it would suffice to
pass them by const reference.

Change-Id: I631deda63fcbb74362313c9596bf7e72933b0d0c
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index bbdad5d..00bbfd1 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -226,7 +226,8 @@
 performance-noexcept-move-constructor,
 performance-trivially-destructible,
 performance-type-promotion-in-math-fn,
-performance-unnecessary-copy-initialization'
+performance-unnecessary-copy-initialization,
+performance-unnecessary-value-param'
 
 WarningsAsErrors: '*'
 HeaderFilterRegex: '.*'
diff --git a/image_manager.cpp b/image_manager.cpp
index 8e32e3f..c9a958d 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -240,7 +240,7 @@
     return 0;
 }
 
-void Manager::erase(std::string entryId)
+void Manager::erase(const std::string& entryId)
 {
     auto it = versions.find(entryId);
     if (it == versions.end())
diff --git a/image_manager.hpp b/image_manager.hpp
index ca4d676..21dd373 100644
--- a/image_manager.hpp
+++ b/image_manager.hpp
@@ -43,7 +43,7 @@
      *
      * @param[in] entryId - unique identifier of the entry
      */
-    void erase(std::string entryId);
+    void erase(const std::string& entryId);
 
   private:
     /** @brief Persistent map of Version dbus objects and their
diff --git a/item_updater.cpp b/item_updater.cpp
index f624cbe..1f62133 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -523,8 +523,8 @@
                                std::pair<std::string, uint8_t>)>
         cmpPriority;
     cmpPriority cmpPriorityFunc =
-        [](std::pair<std::string, uint8_t> priority1,
-           std::pair<std::string, uint8_t> priority2) {
+        [](const std::pair<std::string, uint8_t>& priority1,
+           const std::pair<std::string, uint8_t>& priority2) {
         return priority1.second <= priority2.second;
     };
 
@@ -563,7 +563,7 @@
     info("BMC factory reset will take effect upon reboot.");
 }
 
-void ItemUpdater::removeReadOnlyPartition(std::string versionId)
+void ItemUpdater::removeReadOnlyPartition(const std::string& versionId)
 {
     auto flashId = versions.find(versionId)->second->path();
     helper.removeVersion(flashId);
@@ -867,7 +867,7 @@
     biosActivation = std::make_unique<Activation>(
         bus, path, *this, versionId, server::Activation::Activations::Active,
         assocs);
-    auto dummyErase = [](std::string /*entryId*/) {
+    auto dummyErase = [](const std::string& /*entryId*/) {
         // Do nothing;
     };
     biosVersion = std::make_unique<VersionClass>(
diff --git a/item_updater.hpp b/item_updater.hpp
index 59f9839..a0607fe 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -275,7 +275,7 @@
      *
      * @param[in]  versionId - The version id.
      */
-    void removeReadOnlyPartition(std::string versionId);
+    void removeReadOnlyPartition(const std::string& versionId);
 
     /** @brief Copies U-Boot from the currently booted BMC chip to the
      *  alternate chip.
diff --git a/sync_watch.cpp b/sync_watch.cpp
index fdeace6..225bf18 100644
--- a/sync_watch.cpp
+++ b/sync_watch.cpp
@@ -37,7 +37,7 @@
 SyncWatch::SyncWatch(sd_event& loop,
                      std::function<int(int, fs::path&)> syncCallback) :
     inotifyFd(-1),
-    syncCallback(syncCallback), loop(loop)
+    syncCallback(std::move(syncCallback)), loop(loop)
 {
     auto fd = inotify_init1(IN_NONBLOCK);
     if (-1 == fd)
diff --git a/test/utest.cpp b/test/utest.cpp
index 8e3edd3..5d3d10d 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -354,7 +354,7 @@
 class FileTest : public testing::Test
 {
   protected:
-    std::string readFile(fs::path path)
+    std::string readFile(const fs::path& path)
     {
         std::ifstream f(path, std::ios::in);
         if (!f.is_open())
diff --git a/version.hpp b/version.hpp
index 8a85ba9..77b20f7 100644
--- a/version.hpp
+++ b/version.hpp
@@ -87,7 +87,7 @@
             const std::string& id) :
         VersionInherit(bus, (objPath).c_str(),
                        VersionInherit::action::defer_emit),
-        eraseCallback(callback), id(id), versionStr(versionString)
+        eraseCallback(std::move(callback)), id(id), versionStr(versionString)
     {
         // Set properties.
         extendedVersion(extVersion);
diff --git a/watch.cpp b/watch.cpp
index cabfd79..991bf48 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -28,7 +28,7 @@
 namespace fs = std::filesystem;
 
 Watch::Watch(sd_event* loop, std::function<int(std::string&)> imageCallback) :
-    imageCallback(imageCallback)
+    imageCallback(std::move(imageCallback))
 {
     // Check if IMAGE DIR exists.
     std::error_code ec;