Fix cppcheck warnings

Warning message:
mslverify/verify.cpp:30:5: style: Struct 'BusMeetsMSL < decltype ( arg . second ) :: value_type >' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
    BusMeetsMSL(const std::string& p) : path(p)
    ^
src/callback.hpp:222:5: warning: Member variable 'DeferrableCallback::ctx' is not initialized in the constructor. [uninitMemberVar]
    DeferrableCallback(const std::vector<size_t>& graphEntry, Conditional& cond,
    ^
src/elog.hpp:102:5: style: Class 'Elog' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
    Elog(Args&&... arguments) :
    ^
src/propertywatch.hpp:133:5: style: Class 'PropertyWatchOfType' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
    PropertyWatchOfType(const PropertyIndex& watchIndex,
    ^
src/event_manager.cpp:56:18: style: Local variable 'path' shadows outer variable [shadowVariable]
        fs::path path(eventQueue.back()->objectPath);
                 ^
src/event_manager.cpp:44:10: note: Shadowed declaration
    auto path = "path="s + objectPath;
         ^
src/event_manager.cpp:56:18: note: Shadow variable
        fs::path path(eventQueue.back()->objectPath);
                 ^
src/snmp_trap.hpp:65:10: style: The function 'operator()' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
    void operator()(Context /* ctx */)
         ^
src/callback.hpp:41:18: note: Virtual function in base class
    virtual void operator()(Context /* ctx */) = 0;
                 ^
src/snmp_trap.hpp:65:10: note: Function in derived class
    void operator()(Context /* ctx */)
         ^
src/snmp_trap.hpp:72:10: style: The function 'operator()' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
    void operator()(Context /* ctx */, sdbusplus::message::message& msg)
         ^
src/callback.hpp:50:18: note: Virtual function in base class
    virtual void operator()(Context /* ctx */,
                 ^
src/snmp_trap.hpp:72:10: note: Function in derived class
    void operator()(Context /* ctx */, sdbusplus::message::message& msg)
         ^
src/snmp_trap.cpp:44:17: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
        message += " " + s;
                ^
src/test/pathgentest.cpp:118:21: style: Local variable 'meta' shadows outer variable [shadowVariable]
        const auto& meta = std::get<1>(pathMeta[i]).get();
                    ^
src/test/pathgentest.hpp:1:34: note: Shadowed declaration
const std::array<std::string, 3> meta = {
                                 ^
src/test/pathgentest.cpp:118:21: note: Shadow variable
        const auto& meta = std::get<1>(pathMeta[i]).get();
                    ^
src/test/propertygentest.cpp:133:25: style: Local variable 'expectedMeta' shadows outer variable [shadowVariable]
            const auto& expectedMeta = std::get<1>(expectedGroups[i][j]).get();
                        ^
src/test/propertygentest.cpp:17:34: note: Shadowed declaration
const std::array<std::string, 3> expectedMeta = {
                                 ^
src/test/propertygentest.cpp:133:25: note: Shadow variable
            const auto& expectedMeta = std::get<1>(expectedGroups[i][j]).get();
                        ^
src/test/propertywatchtest.cpp:263:21: style: Local variable 'interfaces' shadows outer variable [shadowVariable]
        const auto& interfaces = o.second;
                    ^
src/test/propertywatchtest.cpp:18:34: note: Shadowed declaration
const std::array<std::string, 2> interfaces = {
                                 ^
src/test/propertywatchtest.cpp:263:21: note: Shadow variable
        const auto& interfaces = o.second;
                    ^
src/test/propertywatchtest.cpp:280:25: style: Local variable 'properties' shadows outer variable [shadowVariable]
            const auto& properties = i.second;
                        ^
src/test/propertywatchtest.cpp:23:34: note: Shadowed declaration
const std::array<std::string, 2> properties = {
                                 ^
src/test/propertywatchtest.cpp:280:25: note: Shadow variable
            const auto& properties = i.second;
                        ^

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ica5d54cefe22fed961f01aa6288b4cf76a9db563
diff --git a/mslverify/verify.cpp b/mslverify/verify.cpp
index d322b8b..7347977 100644
--- a/mslverify/verify.cpp
+++ b/mslverify/verify.cpp
@@ -27,7 +27,7 @@
 {
     std::string path;
 
-    BusMeetsMSL(const std::string& p) : path(p)
+    explicit BusMeetsMSL(const std::string& p) : path(p)
     {}
 
     auto operator()(const T& arg)
diff --git a/src/callback.hpp b/src/callback.hpp
index 732e671..9b729e4 100644
--- a/src/callback.hpp
+++ b/src/callback.hpp
@@ -222,7 +222,7 @@
     DeferrableCallback(const std::vector<size_t>& graphEntry, Conditional& cond,
                        const std::chrono::microseconds& delay) :
         ConditionalCallback<CallbackAccess>(graphEntry, cond),
-        delayInterval(delay), timer(nullptr)
+        delayInterval(delay)
     {}
 
     /** @brief Start internal timer if the condition is satisfied.
@@ -269,10 +269,10 @@
     std::chrono::microseconds delayInterval;
 
     /** @brief Delegated timer functions. */
-    std::unique_ptr<TimerType> timer;
+    std::unique_ptr<TimerType> timer = nullptr;
 
     /** @brief Current context for timer. */
-    Context ctx;
+    Context ctx = Context::START;
 };
 
 } // namespace monitoring
diff --git a/src/elog.hpp b/src/elog.hpp
index 4b3916e..c02a20b 100644
--- a/src/elog.hpp
+++ b/src/elog.hpp
@@ -99,7 +99,7 @@
     Elog& operator=(const Elog&) = delete;
     Elog& operator=(Elog&&) = default;
     ~Elog() = default;
-    Elog(Args&&... arguments) :
+    explicit Elog(Args&&... arguments) :
         ElogBase(), args(std::forward<Args>(arguments)...)
     {}
 
diff --git a/src/event_manager.cpp b/src/event_manager.cpp
index c52a96e..72813cc 100644
--- a/src/event_manager.cpp
+++ b/src/event_manager.cpp
@@ -53,8 +53,8 @@
     auto id = 0;
     if (eventQueue.size() > 0)
     {
-        fs::path path(eventQueue.back()->objectPath);
-        id = std::stoi(std::string(path.filename().c_str()));
+        fs::path eventPath(eventQueue.back()->objectPath);
+        id = std::stoi(std::string(eventPath.filename().c_str()));
         id++;
     }
 
diff --git a/src/propertywatch.hpp b/src/propertywatch.hpp
index 1d88eae..6cb1d63 100644
--- a/src/propertywatch.hpp
+++ b/src/propertywatch.hpp
@@ -130,9 +130,9 @@
                                          &callback),
         filterOps(filterOps)
     {}
-    PropertyWatchOfType(const PropertyIndex& watchIndex,
-                        bool ignoreStartCallback = false,
-                        Filters* filterOps = nullptr) :
+    explicit PropertyWatchOfType(const PropertyIndex& watchIndex,
+                                 bool ignoreStartCallback = false,
+                                 Filters* filterOps = nullptr) :
         PropertyWatch<DBusInterfaceType>(watchIndex, ignoreStartCallback,
                                          nullptr),
         filterOps(filterOps)
diff --git a/src/snmp_trap.cpp b/src/snmp_trap.cpp
index c9e85b7..497f0e4 100644
--- a/src/snmp_trap.cpp
+++ b/src/snmp_trap.cpp
@@ -41,7 +41,8 @@
         std::get<std::vector<std::string>>(propMap.at("AdditionalData"));
     for (auto& s : additionalData)
     {
-        message += " " + s;
+        message.append(" ");
+        message.append(s);
     }
     try
     {
diff --git a/src/snmp_trap.hpp b/src/snmp_trap.hpp
index d21b805..b587d8c 100644
--- a/src/snmp_trap.hpp
+++ b/src/snmp_trap.hpp
@@ -62,14 +62,15 @@
     /** @brief Callback interface implementation.
      *  @param[in] ctc - context.
      */
-    void operator()(Context /* ctx */)
+    void operator()(Context /* ctx */) override
     {}
 
     /** @brief Callback interface implementation.
      *  @param[in] ctc - context.
      *  @param[in] msg - sdbus message.
      */
-    void operator()(Context /* ctx */, sdbusplus::message::message& msg)
+    void operator()(Context /* ctx */,
+                    sdbusplus::message::message& msg) override
     {
         event.trap(msg);
     }
diff --git a/src/test/pathgentest.cpp b/src/test/pathgentest.cpp
index 9e0e073..21c2084 100644
--- a/src/test/pathgentest.cpp
+++ b/src/test/pathgentest.cpp
@@ -113,13 +113,13 @@
     size_t i;
     for (i = 0; i < expectedPathMeta.size(); ++i)
     {
-        const auto& path = std::get<0>(pathMeta[i]).get();
+        const auto& oriPath = std::get<0>(pathMeta[i]).get();
         const auto& expPath = std::get<0>(expectedPathMeta[i]).get();
-        const auto& meta = std::get<1>(pathMeta[i]).get();
+        const auto& oriMeta = std::get<1>(pathMeta[i]).get();
         const auto& expMeta = std::get<1>(expectedPathMeta[i]).get();
 
-        ASSERT_EQ(path, expPath);
-        ASSERT_EQ(meta, expMeta);
+        ASSERT_EQ(oriPath, expPath);
+        ASSERT_EQ(oriMeta, expMeta);
     }
 }
 
diff --git a/src/test/propertygentest.cpp b/src/test/propertygentest.cpp
index 4124246..6a1e2c8 100644
--- a/src/test/propertygentest.cpp
+++ b/src/test/propertygentest.cpp
@@ -130,9 +130,10 @@
             const auto& actualProperty = std::get<1>(groups[i][j]).get();
             ASSERT_EQ(expectedProperty, actualProperty);
 
-            const auto& expectedMeta = std::get<1>(expectedGroups[i][j]).get();
-            const auto& actualMeta = std::get<1>(groups[i][j]).get();
-            ASSERT_EQ(expectedMeta, actualMeta);
+            const auto& retExpectedMeta =
+                std::get<1>(expectedGroups[i][j]).get();
+            const auto& retActualMeta = std::get<1>(groups[i][j]).get();
+            ASSERT_EQ(retExpectedMeta, retActualMeta);
         }
     }
 }
diff --git a/src/test/propertywatchtest.cpp b/src/test/propertywatchtest.cpp
index 1df64fb..a1d827e 100644
--- a/src/test/propertywatchtest.cpp
+++ b/src/test/propertywatchtest.cpp
@@ -260,9 +260,9 @@
     for (const auto& o : convert(watchIndex))
     {
         const auto& path = o.first.get();
-        const auto& interfaces = o.second;
+        const auto& tmpInterfaces = o.second;
         std::vector<std::string> mapperResponse;
-        std::transform(interfaces.begin(), interfaces.end(),
+        std::transform(tmpInterfaces.begin(), tmpInterfaces.end(),
                        std::back_inserter(mapperResponse),
                        // *INDENT-OFF*
                        [](const auto& item) { return item.first; });
@@ -274,10 +274,10 @@
         EXPECT_CALL(
             dbus, fwdAddMatch(
                       sdbusplus::bus::match::rules::interfacesAdded(path), _));
-        for (const auto& i : interfaces)
+        for (const auto& i : tmpInterfaces)
         {
             const auto& interface = i.first.get();
-            const auto& properties = i.second;
+            const auto& tmpProperties = i.second;
             EXPECT_CALL(
                 dbus,
                 fwdAddMatch(sdbusplus::bus::match::rules::propertiesChanged(
@@ -285,7 +285,7 @@
                             _));
 
             PropertiesChanged<T> serviceResponse;
-            for (const auto& p : properties)
+            for (const auto& p : tmpProperties)
             {
                 serviceResponse[p] = Values<T>::get(ndx);
                 ++ndx;