clang-tidy: Enable readability-make-member-function-const check
Finds non-static member functions that can be made const because the
functions don’t use this in a non-const way.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Iff3a367401d571f9fcff90539aaab59e2c66e627
diff --git a/.clang-tidy b/.clang-tidy
index 53684d8..0b9563b 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -235,6 +235,7 @@
readability-function-size,
readability-identifier-naming,
readability-isolate-declaration,
+readability-make-member-function-const,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-named-parameter,
diff --git a/test/test_activation.cpp b/test/test_activation.cpp
index f63ee11..b7ec3d5 100644
--- a/test/test_activation.cpp
+++ b/test/test_activation.cpp
@@ -44,23 +44,23 @@
utils::freeUtils();
}
- void onUpdateDone()
+ void onUpdateDone() const
{
activation->onUpdateDone();
}
- void onUpdateFailed()
+ void onUpdateFailed() const
{
activation->onUpdateFailed();
}
- int getProgress()
+ int getProgress() const
{
return activation->activationProgress->progress();
}
- const auto& getPsuQueue()
+ const auto& getPsuQueue() const
{
return activation->psuQueue;
}
- std::string getUpdateService(const std::string& psuInventoryPath)
+ std::string getUpdateService(const std::string& psuInventoryPath) const
{
return activation->getUpdateService(psuInventoryPath);
}
diff --git a/test/test_item_updater.cpp b/test/test_item_updater.cpp
index c231654..58125c7 100644
--- a/test/test_item_updater.cpp
+++ b/test/test_item_updater.cpp
@@ -41,7 +41,7 @@
utils::freeUtils();
}
- auto& GetActivations()
+ auto& GetActivations() const
{
return itemUpdater->activations;
}
@@ -52,12 +52,12 @@
}
void onPsuInventoryChanged(const std::string& psuPath,
- const Properties& properties)
+ const Properties& properties) const
{
itemUpdater->onPsuInventoryChanged(psuPath, properties);
}
- void scanDirectory(const fs::path& p)
+ void scanDirectory(const fs::path& p) const
{
itemUpdater->scanDirectory(p);
}