clang-tidy: Enable readability-convert-member-functions-to-static
This check finds non-static member functions that can be made
static because the functions don’t use this.
This check also triggers readability-static-accessed-through
-instance check as we are trying to access a static member
function through an instance.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I6c06c61e8f199247e74aca3443741683e3853274
diff --git a/.clang-tidy b/.clang-tidy
index b3cb96d..ad408a4 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -230,6 +230,7 @@
readability-braces-around-statements,
readability-const-return-type,
readability-container-size-empty,
+readability-convert-member-functions-to-static,
readability-delete-null-pointer,
readability-deleted-default,
readability-function-size,
diff --git a/src/item_updater.hpp b/src/item_updater.hpp
index 2bfd39c..bc8930e 100644
--- a/src/item_updater.hpp
+++ b/src/item_updater.hpp
@@ -181,7 +181,7 @@
void syncToLatestImage();
/** @brief Invoke the activation via DBus */
- void invokeActivation(const std::unique_ptr<Activation>& activation);
+ static void invokeActivation(const std::unique_ptr<Activation>& activation);
/** @brief Callback function for interfaces added signal.
*
diff --git a/test/test_item_updater.cpp b/test/test_item_updater.cpp
index 096e15f..7fd1e7a 100644
--- a/test/test_item_updater.cpp
+++ b/test/test_item_updater.cpp
@@ -46,7 +46,7 @@
return itemUpdater->activations;
}
- std::string getObjPath(const std::string& versionId)
+ static std::string getObjPath(const std::string& versionId)
{
return std::string(dBusPath) + "/" + versionId;
}
diff --git a/test/test_version.cpp b/test/test_version.cpp
index d447e10..ee41bf1 100644
--- a/test/test_version.cpp
+++ b/test/test_version.cpp
@@ -45,7 +45,7 @@
fs::remove_all(tmpDir);
}
- void writeFile(const fs::path& file, const char* data)
+ static void writeFile(const fs::path& file, const char* data)
{
std::ofstream f{file};
f << data;