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.

Change-Id: I887b514a8478abedc24d5495d057b9d3e7dc9bdf
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index f063ed1..0e5257a 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -245,6 +245,7 @@
 readability-avoid-const-params-in-decls,
 readability-braces-around-statements,
 readability-const-return-type,
+readability-convert-member-functions-to-static,
 readability-delete-null-pointer,
 readability-deleted-default,
 readability-function-size,
diff --git a/chassis_state_manager.hpp b/chassis_state_manager.hpp
index d79464d..aece536 100644
--- a/chassis_state_manager.hpp
+++ b/chassis_state_manager.hpp
@@ -234,7 +234,7 @@
      *
      *  @return true if fault detected, else false
      */
-    bool standbyVoltageRegulatorFault();
+    static bool standbyVoltageRegulatorFault();
 
     /** @brief Process UPS property changes
      *
diff --git a/scheduled_host_transition.hpp b/scheduled_host_transition.hpp
index 82e0731..2fe3e36 100644
--- a/scheduled_host_transition.hpp
+++ b/scheduled_host_transition.hpp
@@ -79,7 +79,7 @@
      *
      *  @return - return current epoch time
      */
-    std::chrono::seconds getTime();
+    static std::chrono::seconds getTime();
 
     /** @brief Implement host transition
      *
@@ -132,7 +132,7 @@
      *
      *  @return bool - true if successful, false otherwise
      */
-    bool deserializeScheduledValues(uint64_t& time, Transition& trans);
+    static bool deserializeScheduledValues(uint64_t& time, Transition& trans);
 
     /** @brief Restore scheduled time and requested transition from persisted
      * file */
diff --git a/test/test_scheduled_host_transition.cpp b/test/test_scheduled_host_transition.cpp
index 74d43aa..4807a8f 100644
--- a/test/test_scheduled_host_transition.cpp
+++ b/test/test_scheduled_host_transition.cpp
@@ -36,9 +36,9 @@
         // Empty
     }
 
-    seconds getCurrentTime()
+    static seconds getCurrentTime()
     {
-        return scheduledHostTransition.getTime();
+        return ScheduledHostTransition::getTime();
     }
 
     bool isTimerEnabled()
@@ -60,18 +60,20 @@
 
 TEST_F(TestScheduledHostTransition, invalidScheduledTime)
 {
+    seconds currentTime = getCurrentTime();
     // scheduled time is 1 min earlier than current time
     uint64_t schTime =
-        static_cast<uint64_t>((getCurrentTime() - seconds(60)).count());
+        static_cast<uint64_t>((currentTime - seconds(60)).count());
     EXPECT_THROW(scheduledHostTransition.scheduledTime(schTime),
                  InvalidTimeError);
 }
 
 TEST_F(TestScheduledHostTransition, validScheduledTime)
 {
+    seconds currentTime = getCurrentTime();
     // scheduled time is 1 min later than current time
     uint64_t schTime =
-        static_cast<uint64_t>((getCurrentTime() + seconds(60)).count());
+        static_cast<uint64_t>((currentTime + seconds(60)).count());
     EXPECT_EQ(scheduledHostTransition.scheduledTime(schTime), schTime);
     EXPECT_TRUE(isTimerEnabled());
 }
@@ -99,9 +101,10 @@
 
 TEST_F(TestScheduledHostTransition, bmcTimeChangeBackward)
 {
+    seconds currentTime = getCurrentTime();
     // Current time is earlier than scheduled time due to BMC time changing
     uint64_t schTime =
-        static_cast<uint64_t>((getCurrentTime() + seconds(60)).count());
+        static_cast<uint64_t>((currentTime + seconds(60)).count());
     // Set scheduled time, which is the same as bmc time is changed.
     // But can't use this method to write another case like
     // bmcTimeChangeForward, because set a scheduled time earlier than current