Enable clang-tidy and apply fixes

Enable clang-tidy, fix the compile issue and fix the clang-tidy issues.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I6250c6519a725c07b0cd10abe464fda97a2aebd7
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..4b6eca0
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,7 @@
+Checks: '
+    -*,
+    bugprone-unchecked-optional-access,
+    readability-identifier-naming
+'
+WarningsAsErrors: '*'
+HeaderFilterRegex: '(?!^subprojects).*'
diff --git a/command/rakp12.cpp b/command/rakp12.cpp
index 7a5f198..5c674ac 100644
--- a/command/rakp12.cpp
+++ b/command/rakp12.cpp
@@ -35,7 +35,7 @@
     lg2::error(
         "message: {MSG}, id: {REDFISH_MESSAGE_ID}, args: {REDFISH_MESSAGE_ARGS}",
         "MSG", journalMsg, "REDFISH_MESSAGE_ID", messageID,
-        "REDFISH_MESSAGE_ARGS", messageArgs.value());
+        "REDFISH_MESSAGE_ARGS", messageArgs.value_or(std::string{}));
 }
 std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload,
                             std::shared_ptr<message::Handler>& /* handler */)
diff --git a/command_table.cpp b/command_table.cpp
index c6f7625..9880bc0 100644
--- a/command_table.cpp
+++ b/command_table.cpp
@@ -77,8 +77,8 @@
              ipmi::Value(static_cast<uint32_t>(session->getBMCSessionID()))},
         };
         bus->async_method_call(
-            [handler, this](const boost::system::error_code& ec,
-                            const IpmiDbusRspType& response) {
+            [handler](const boost::system::error_code& ec,
+                      const IpmiDbusRspType& response) {
                 if (!ec)
                 {
                     const uint8_t& cc = std::get<3>(response);
diff --git a/integrity_algo.hpp b/integrity_algo.hpp
index 6ba6340..4d6674f 100644
--- a/integrity_algo.hpp
+++ b/integrity_algo.hpp
@@ -212,8 +212,9 @@
      * @return on success returns the Kn based on HMAC-SHA1
      *
      */
-    std::vector<uint8_t> generateKn(const std::vector<uint8_t>& sik,
-                                    const rmcp::Const_n& const_n) const;
+    std::vector<uint8_t> generateKn(
+        const std::vector<uint8_t>& sik,
+        const rmcp::Const_n& const_n) const override;
 
   private:
     /**
@@ -297,8 +298,9 @@
      * @return on success returns the Kn based on HMAC-SHA256
      *
      */
-    std::vector<uint8_t> generateKn(const std::vector<uint8_t>& sik,
-                                    const rmcp::Const_n& const_n) const;
+    std::vector<uint8_t> generateKn(
+        const std::vector<uint8_t>& sik,
+        const rmcp::Const_n& const_n) const override;
 
   private:
     /**
diff --git a/session.hpp b/session.hpp
index ab3fe07..c12ec2c 100644
--- a/session.hpp
+++ b/session.hpp
@@ -99,12 +99,12 @@
 class Session : public SessionIface
 {
   public:
-    Session() = default;
+    Session() = delete;
     ~Session() = default;
     Session(const Session&) = delete;
     Session& operator=(const Session&) = delete;
-    Session(Session&&) = default;
-    Session& operator=(Session&&) = default;
+    Session(Session&&) = delete;
+    Session& operator=(Session&&) = delete;
 
     /**
      * @brief Session Constructor
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
index 8fabeeb..ccfbc3c 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -19,7 +19,6 @@
 
 constexpr const char* solInterface = "xyz.openbmc_project.Ipmi.SOL";
 constexpr const char* solPath = "/xyz/openbmc_project/ipmi/sol/";
-constexpr const char* PROP_INTF = "org.freedesktop.DBus.Properties";
 
 namespace sol
 {
@@ -120,7 +119,6 @@
 
 void Manager::updateSOLParameter(uint8_t channelNum)
 {
-    std::variant<uint8_t, bool> value;
     sdbusplus::bus_t dbus(ipmid_get_sd_bus_connection());
     static std::string solService{};
     ipmi::PropertyMap properties;
diff --git a/sol/sol_manager.hpp b/sol/sol_manager.hpp
index dd857fe..4d7652a 100644
--- a/sol/sol_manager.hpp
+++ b/sol/sol_manager.hpp
@@ -232,7 +232,8 @@
             return *(iter->second);
         }
 
-        std::string msg = "Invalid SOL payload instance " + payloadInstance;
+        std::string msg =
+            "Invalid SOL payload instance " + std::to_string(payloadInstance);
         throw std::runtime_error(msg.c_str());
     }
 
@@ -252,7 +253,7 @@
             }
         }
 
-        std::string msg = "Invalid SOL SessionID " + sessionID;
+        std::string msg = "Invalid SOL SessionID " + std::to_string(sessionID);
         throw std::runtime_error(msg.c_str());
     }