diff --git a/.clang-tidy b/.clang-tidy
index 1dc6a0c..3b34c55 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -247,7 +247,7 @@
   - { key: readability-identifier-naming.ClassCase,     value: CamelCase  }
   - { key: readability-identifier-naming.VariableCase,  value: camelBack }
   - { key: readability-identifier-naming.FunctionCase,  value: camelBack }
-  - { key: readability-identifier-naming.ParameterCase, value: lowerCamel }
+  - { key: readability-identifier-naming.ParameterCase, value: camelBack }
   - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
   - { key: readability-identifier-naming.StructCase,    value: CamelCase  }
 
diff --git a/http/app.hpp b/http/app.hpp
index 9a4eb20..023eabb 100644
--- a/http/app.hpp
+++ b/http/app.hpp
@@ -65,9 +65,9 @@
         return router.newRuleTagged<Tag>(std::move(rule));
     }
 
-    App& socket(int existing_socket)
+    App& socket(int existingSocket)
     {
-        socketFd = existing_socket;
+        socketFd = existingSocket;
         return *this;
     }
 
@@ -143,14 +143,13 @@
     }
 
 #ifdef BMCWEB_ENABLE_SSL
-    App& sslFile(const std::string& crt_filename,
-                 const std::string& key_filename)
+    App& sslFile(const std::string& crtFilename, const std::string& keyFilename)
     {
         sslContext = std::make_shared<ssl_context_t>(
             boost::asio::ssl::context::tls_server);
         sslContext->set_verify_mode(boost::asio::ssl::verify_peer);
-        sslContext->use_certificate_file(crt_filename, ssl_context_t::pem);
-        sslContext->use_private_key_file(key_filename, ssl_context_t::pem);
+        sslContext->use_certificate_file(crtFilename, ssl_context_t::pem);
+        sslContext->use_private_key_file(keyFilename, ssl_context_t::pem);
         sslContext->set_options(boost::asio::ssl::context::default_workarounds |
                                 boost::asio::ssl::context::no_sslv2 |
                                 boost::asio::ssl::context::no_sslv3 |
@@ -159,12 +158,12 @@
         return *this;
     }
 
-    App& sslFile(const std::string& pem_filename)
+    App& sslFile(const std::string& pemFilename)
     {
         sslContext = std::make_shared<ssl_context_t>(
             boost::asio::ssl::context::tls_server);
         sslContext->set_verify_mode(boost::asio::ssl::verify_peer);
-        sslContext->load_verify_file(pem_filename);
+        sslContext->load_verify_file(pemFilename);
         sslContext->set_options(boost::asio::ssl::context::default_workarounds |
                                 boost::asio::ssl::context::no_sslv2 |
                                 boost::asio::ssl::context::no_sslv3 |
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 506f132..39ac39e 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -60,10 +60,10 @@
 {
   public:
     Connection(Handler* handlerIn,
-               std::function<std::string()>& get_cached_date_str_f,
+               std::function<std::string()>& getCachedDateStrF,
                detail::TimerQueue& timerQueueIn, Adaptor adaptorIn) :
         adaptor(std::move(adaptorIn)),
-        handler(handlerIn), getCachedDateStr(get_cached_date_str_f),
+        handler(handlerIn), getCachedDateStr(getCachedDateStrF),
         timerQueue(timerQueueIn)
     {
         parser.emplace(std::piecewise_construct, std::make_tuple());
@@ -498,9 +498,9 @@
             adaptor, buffer, *parser,
             [this,
              self(shared_from_this())](const boost::system::error_code& ec,
-                                       std::size_t bytes_transferred) {
+                                       std::size_t bytesTransferred) {
                 BMCWEB_LOG_ERROR << this << " async_read_header "
-                                 << bytes_transferred << " Bytes";
+                                 << bytesTransferred << " Bytes";
                 bool errorWhileReading = false;
                 if (ec)
                 {
@@ -599,8 +599,8 @@
             adaptor, buffer, *parser,
             [this,
              self(shared_from_this())](const boost::system::error_code& ec,
-                                       std::size_t bytes_transferred) {
-                BMCWEB_LOG_DEBUG << this << " async_read " << bytes_transferred
+                                       std::size_t bytesTransferred) {
+                BMCWEB_LOG_DEBUG << this << " async_read " << bytesTransferred
                                  << " Bytes";
 
                 bool errorWhileReading = false;
@@ -659,8 +659,8 @@
             adaptor, *serializer,
             [this,
              self(shared_from_this())](const boost::system::error_code& ec,
-                                       std::size_t bytes_transferred) {
-                BMCWEB_LOG_DEBUG << this << " async_write " << bytes_transferred
+                                       std::size_t bytesTransferred) {
+                BMCWEB_LOG_DEBUG << this << " async_write " << bytesTransferred
                                  << " bytes";
 
                 cancelDeadlineTimer();
diff --git a/http/http_response.hpp b/http/http_response.hpp
index 7b8b5d9..cd00ec8 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -102,9 +102,9 @@
         completed = false;
     }
 
-    void write(std::string_view body_part)
+    void write(std::string_view bodyPart)
     {
-        stringResponse->body() += std::string(body_part);
+        stringResponse->body() += std::string(bodyPart);
     }
 
     void end()
@@ -123,9 +123,9 @@
         }
     }
 
-    void end(std::string_view body_part)
+    void end(std::string_view bodyPart)
     {
-        write(body_part);
+        write(bodyPart);
         end();
     }
 
diff --git a/http/http_server.hpp b/http/http_server.hpp
index 0be487f..20b4e50 100644
--- a/http/http_server.hpp
+++ b/http/http_server.hpp
@@ -31,34 +31,34 @@
   public:
     Server(Handler* handlerIn,
            std::unique_ptr<boost::asio::ip::tcp::acceptor>&& acceptorIn,
-           std::shared_ptr<boost::asio::ssl::context> adaptor_ctx,
+           std::shared_ptr<boost::asio::ssl::context> adaptorCtx,
            std::shared_ptr<boost::asio::io_context> io =
                std::make_shared<boost::asio::io_context>()) :
         ioService(std::move(io)),
         acceptor(std::move(acceptorIn)),
         signals(*ioService, SIGINT, SIGTERM, SIGHUP), timer(*ioService),
-        handler(handlerIn), adaptorCtx(std::move(adaptor_ctx))
+        handler(handlerIn), adaptorCtx(std::move(adaptorCtx))
     {}
 
     Server(Handler* handlerIn, const std::string& bindaddr, uint16_t port,
-           const std::shared_ptr<boost::asio::ssl::context>& adaptor_ctx,
+           const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx,
            const std::shared_ptr<boost::asio::io_context>& io =
                std::make_shared<boost::asio::io_context>()) :
         Server(handlerIn,
                std::make_unique<boost::asio::ip::tcp::acceptor>(
                    *io, boost::asio::ip::tcp::endpoint(
                             boost::asio::ip::make_address(bindaddr), port)),
-               adaptor_ctx, io)
+               adaptorCtx, io)
     {}
 
-    Server(Handler* handlerIn, int existing_socket,
-           const std::shared_ptr<boost::asio::ssl::context>& adaptor_ctx,
+    Server(Handler* handlerIn, int existingSocket,
+           const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx,
            const std::shared_ptr<boost::asio::io_context>& io =
                std::make_shared<boost::asio::io_context>()) :
         Server(handlerIn,
                std::make_unique<boost::asio::ip::tcp::acceptor>(
-                   *io, boost::asio::ip::tcp::v6(), existing_socket),
-               adaptor_ctx, io)
+                   *io, boost::asio::ip::tcp::v6(), existingSocket),
+               adaptorCtx, io)
     {}
 
     void updateDateStr()
diff --git a/http/routing.hpp b/http/routing.hpp
index d547348..b4ebede 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -417,10 +417,10 @@
     }
 
     template <typename... MethodArgs>
-    self_t& methods(boost::beast::http::verb method, MethodArgs... args_method)
+    self_t& methods(boost::beast::http::verb method, MethodArgs... argsMethod)
     {
         self_t* self = static_cast<self_t*>(this);
-        methods(args_method...);
+        methods(argsMethod...);
         self->methodsBitfield |= 1U << static_cast<size_t>(method);
         return *self;
     }
@@ -722,8 +722,8 @@
         optimize();
     }
 
-    void findRouteIndexes(const std::string& req_url,
-                          std::vector<unsigned>& route_indexes,
+    void findRouteIndexes(const std::string& reqUrl,
+                          std::vector<unsigned>& routeIndexes,
                           const Node* node = nullptr, unsigned pos = 0) const
     {
         if (node == nullptr)
@@ -734,21 +734,21 @@
         {
             const std::string& fragment = kv.first;
             const Node* child = &nodes[kv.second];
-            if (pos >= req_url.size())
+            if (pos >= reqUrl.size())
             {
                 if (child->ruleIndex != 0 && fragment != "/")
                 {
-                    route_indexes.push_back(child->ruleIndex);
+                    routeIndexes.push_back(child->ruleIndex);
                 }
-                findRouteIndexes(req_url, route_indexes, child,
+                findRouteIndexes(reqUrl, routeIndexes, child,
                                  static_cast<unsigned>(pos + fragment.size()));
             }
             else
             {
-                if (req_url.compare(pos, fragment.size(), fragment) == 0)
+                if (reqUrl.compare(pos, fragment.size(), fragment) == 0)
                 {
                     findRouteIndexes(
-                        req_url, route_indexes, child,
+                        reqUrl, routeIndexes, child,
                         static_cast<unsigned>(pos + fragment.size()));
                 }
             }
@@ -756,7 +756,7 @@
     }
 
     std::pair<unsigned, RoutingParams>
-        find(const std::string_view req_url, const Node* node = nullptr,
+        find(const std::string_view reqUrl, const Node* node = nullptr,
              size_t pos = 0, RoutingParams* params = nullptr) const
     {
         RoutingParams empty;
@@ -772,7 +772,7 @@
         {
             node = head();
         }
-        if (pos == req_url.size())
+        if (pos == reqUrl.size())
         {
             return {node->ruleIndex, *params};
         }
@@ -788,21 +788,21 @@
 
         if (node->paramChildrens[static_cast<size_t>(ParamType::INT)])
         {
-            char c = req_url[pos];
+            char c = reqUrl[pos];
             if ((c >= '0' && c <= '9') || c == '+' || c == '-')
             {
                 char* eptr;
                 errno = 0;
                 long long int value =
-                    std::strtoll(req_url.data() + pos, &eptr, 10);
-                if (errno != ERANGE && eptr != req_url.data() + pos)
+                    std::strtoll(reqUrl.data() + pos, &eptr, 10);
+                if (errno != ERANGE && eptr != reqUrl.data() + pos)
                 {
                     params->intParams.push_back(value);
-                    std::pair<unsigned, RoutingParams> ret = find(
-                        req_url,
-                        &nodes[node->paramChildrens[static_cast<size_t>(
-                            ParamType::INT)]],
-                        static_cast<size_t>(eptr - req_url.data()), params);
+                    std::pair<unsigned, RoutingParams> ret =
+                        find(reqUrl,
+                             &nodes[node->paramChildrens[static_cast<size_t>(
+                                 ParamType::INT)]],
+                             static_cast<size_t>(eptr - reqUrl.data()), params);
                     updateFound(ret);
                     params->intParams.pop_back();
                 }
@@ -811,21 +811,21 @@
 
         if (node->paramChildrens[static_cast<size_t>(ParamType::UINT)])
         {
-            char c = req_url[pos];
+            char c = reqUrl[pos];
             if ((c >= '0' && c <= '9') || c == '+')
             {
                 char* eptr;
                 errno = 0;
                 unsigned long long int value =
-                    std::strtoull(req_url.data() + pos, &eptr, 10);
-                if (errno != ERANGE && eptr != req_url.data() + pos)
+                    std::strtoull(reqUrl.data() + pos, &eptr, 10);
+                if (errno != ERANGE && eptr != reqUrl.data() + pos)
                 {
                     params->uintParams.push_back(value);
-                    std::pair<unsigned, RoutingParams> ret = find(
-                        req_url,
-                        &nodes[node->paramChildrens[static_cast<size_t>(
-                            ParamType::UINT)]],
-                        static_cast<size_t>(eptr - req_url.data()), params);
+                    std::pair<unsigned, RoutingParams> ret =
+                        find(reqUrl,
+                             &nodes[node->paramChildrens[static_cast<size_t>(
+                                 ParamType::UINT)]],
+                             static_cast<size_t>(eptr - reqUrl.data()), params);
                     updateFound(ret);
                     params->uintParams.pop_back();
                 }
@@ -834,20 +834,20 @@
 
         if (node->paramChildrens[static_cast<size_t>(ParamType::DOUBLE)])
         {
-            char c = req_url[pos];
+            char c = reqUrl[pos];
             if ((c >= '0' && c <= '9') || c == '+' || c == '-' || c == '.')
             {
                 char* eptr;
                 errno = 0;
-                double value = std::strtod(req_url.data() + pos, &eptr);
-                if (errno != ERANGE && eptr != req_url.data() + pos)
+                double value = std::strtod(reqUrl.data() + pos, &eptr);
+                if (errno != ERANGE && eptr != reqUrl.data() + pos)
                 {
                     params->doubleParams.push_back(value);
-                    std::pair<unsigned, RoutingParams> ret = find(
-                        req_url,
-                        &nodes[node->paramChildrens[static_cast<size_t>(
-                            ParamType::DOUBLE)]],
-                        static_cast<size_t>(eptr - req_url.data()), params);
+                    std::pair<unsigned, RoutingParams> ret =
+                        find(reqUrl,
+                             &nodes[node->paramChildrens[static_cast<size_t>(
+                                 ParamType::DOUBLE)]],
+                             static_cast<size_t>(eptr - reqUrl.data()), params);
                     updateFound(ret);
                     params->doubleParams.pop_back();
                 }
@@ -857,9 +857,9 @@
         if (node->paramChildrens[static_cast<size_t>(ParamType::STRING)])
         {
             size_t epos = pos;
-            for (; epos < req_url.size(); epos++)
+            for (; epos < reqUrl.size(); epos++)
             {
-                if (req_url[epos] == '/')
+                if (reqUrl[epos] == '/')
                 {
                     break;
                 }
@@ -868,9 +868,9 @@
             if (epos != pos)
             {
                 params->stringParams.emplace_back(
-                    req_url.substr(pos, epos - pos));
+                    reqUrl.substr(pos, epos - pos));
                 std::pair<unsigned, RoutingParams> ret =
-                    find(req_url,
+                    find(reqUrl,
                          &nodes[node->paramChildrens[static_cast<size_t>(
                              ParamType::STRING)]],
                          epos, params);
@@ -881,14 +881,14 @@
 
         if (node->paramChildrens[static_cast<size_t>(ParamType::PATH)])
         {
-            size_t epos = req_url.size();
+            size_t epos = reqUrl.size();
 
             if (epos != pos)
             {
                 params->stringParams.emplace_back(
-                    req_url.substr(pos, epos - pos));
+                    reqUrl.substr(pos, epos - pos));
                 std::pair<unsigned, RoutingParams> ret =
-                    find(req_url,
+                    find(reqUrl,
                          &nodes[node->paramChildrens[static_cast<size_t>(
                              ParamType::PATH)]],
                          epos, params);
@@ -902,10 +902,10 @@
             const std::string& fragment = kv.first;
             const Node* child = &nodes[kv.second];
 
-            if (req_url.compare(pos, fragment.size(), fragment) == 0)
+            if (reqUrl.compare(pos, fragment.size(), fragment) == 0)
             {
                 std::pair<unsigned, RoutingParams> ret =
-                    find(req_url, child, pos + fragment.size(), params);
+                    find(reqUrl, child, pos + fragment.size(), params);
                 updateFound(ret);
             }
         }
diff --git a/http/websocket.hpp b/http/websocket.hpp
index f5c2a7a..363076e 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -66,17 +66,17 @@
     ConnectionImpl(
         const crow::Request& reqIn, Adaptor adaptorIn,
         std::function<void(Connection&, std::shared_ptr<bmcweb::AsyncResp>)>
-            open_handler,
+            openHandler,
         std::function<void(Connection&, const std::string&, bool)>
-            message_handler,
-        std::function<void(Connection&, const std::string&)> close_handler,
-        std::function<void(Connection&)> error_handler) :
+            messageHandler,
+        std::function<void(Connection&, const std::string&)> closeHandler,
+        std::function<void(Connection&)> errorHandler) :
         Connection(reqIn, reqIn.session->username),
         ws(std::move(adaptorIn)), inString(), inBuffer(inString, 131088),
-        openHandler(std::move(open_handler)),
-        messageHandler(std::move(message_handler)),
-        closeHandler(std::move(close_handler)),
-        errorHandler(std::move(error_handler)), session(reqIn.session)
+        openHandler(std::move(openHandler)),
+        messageHandler(std::move(messageHandler)),
+        closeHandler(std::move(closeHandler)),
+        errorHandler(std::move(errorHandler)), session(reqIn.session)
     {
         BMCWEB_LOG_DEBUG << "Creating new connection " << this;
     }
@@ -202,7 +202,7 @@
     {
         ws.async_read(inBuffer,
                       [this, self(shared_from_this())](
-                          boost::beast::error_code ec, std::size_t bytes_read) {
+                          boost::beast::error_code ec, std::size_t bytesRead) {
                           if (ec)
                           {
                               if (ec != boost::beast::websocket::error::closed)
@@ -220,7 +220,7 @@
                           {
                               messageHandler(*this, inString, ws.got_text());
                           }
-                          inBuffer.consume(bytes_read);
+                          inBuffer.consume(bytesRead);
                           inString.clear();
                           doRead();
                       });
diff --git a/include/authorization.hpp b/include/authorization.hpp
index c0a84b6..e32d9ad 100644
--- a/include/authorization.hpp
+++ b/include/authorization.hpp
@@ -37,12 +37,12 @@
 #ifdef BMCWEB_ENABLE_BASIC_AUTHENTICATION
 static std::shared_ptr<persistent_data::UserSession>
     performBasicAuth(const boost::asio::ip::address& clientIp,
-                     std::string_view auth_header)
+                     std::string_view authHeader)
 {
     BMCWEB_LOG_DEBUG << "[AuthMiddleware] Basic authentication";
 
     std::string authData;
-    std::string_view param = auth_header.substr(strlen("Basic "));
+    std::string_view param = authHeader.substr(strlen("Basic "));
     if (!crow::utility::base64Decode(param, authData))
     {
         return nullptr;
@@ -86,11 +86,11 @@
 
 #ifdef BMCWEB_ENABLE_SESSION_AUTHENTICATION
 static std::shared_ptr<persistent_data::UserSession>
-    performTokenAuth(std::string_view auth_header)
+    performTokenAuth(std::string_view authHeader)
 {
     BMCWEB_LOG_DEBUG << "[AuthMiddleware] Token authentication";
 
-    std::string_view token = auth_header.substr(strlen("Token "));
+    std::string_view token = authHeader.substr(strlen("Token "));
     auto session =
         persistent_data::SessionStore::getInstance().loginSessionByToken(token);
     return session;
@@ -132,7 +132,7 @@
         return nullptr;
     }
     startIndex += sizeof("SESSION=") - 1;
-    auto endIndex = cookieValue.find(";", startIndex);
+    auto endIndex = cookieValue.find(';', startIndex);
     if (endIndex == std::string::npos)
     {
         endIndex = cookieValue.size();
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 74d38f6..18085a9 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -27,9 +27,9 @@
     sessions;
 
 inline int onPropertyUpdate(sd_bus_message* m, void* userdata,
-                            sd_bus_error* ret_error)
+                            sd_bus_error* retError)
 {
-    if (ret_error == nullptr || sd_bus_error_is_set(ret_error))
+    if (retError == nullptr || sd_bus_error_is_set(retError))
     {
         BMCWEB_LOG_ERROR << "Got sdbus error on match";
         return 0;
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 8ba9a57..9927024 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -90,8 +90,8 @@
 
     crow::connections::systemBus->async_method_call(
         [callback{std::move(callback)}](const boost::system::error_code ec,
-                                        const GetObjectType& object_names) {
-            callback(!ec && object_names.size() != 0);
+                                        const GetObjectType& objectNames) {
+            callback(!ec && objectNames.size() != 0);
         },
         "xyz.openbmc_project.ObjectMapper",
         "/xyz/openbmc_project/object_mapper",
diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp
index 7b8283e..1b04af5 100644
--- a/include/hostname_monitor.hpp
+++ b/include/hostname_monitor.hpp
@@ -32,9 +32,9 @@
 }
 
 inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
-                            sd_bus_error* ret_error)
+                            sd_bus_error* retError)
 {
-    if (ret_error == nullptr || sd_bus_error_is_set(ret_error))
+    if (retError == nullptr || sd_bus_error_is_set(retError))
     {
         BMCWEB_LOG_ERROR << "Got sdbus error on match";
         return 0;
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index 7ad80a6..7b90e90 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -248,12 +248,12 @@
                                   std::shared_ptr<NbdProxyServer>>
     sessions;
 
-void requestRoutes(App& app)
+inline void requestRoutes(App& app)
 {
     BMCWEB_ROUTE(app, "/nbd/<str>")
         .websocket()
         .onopen([](crow::websocket::Connection& conn,
-                   std::shared_ptr<bmcweb::AsyncResp> asyncResp) {
+                   const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
             BMCWEB_LOG_DEBUG << "nbd-proxy.onopen(" << &conn << ")";
 
             auto getUserInfoHandler =
@@ -399,9 +399,8 @@
                         std::remove((*socketValue).c_str());
 
                         sessions[&conn] = std::make_shared<NbdProxyServer>(
-                            conn, std::move(*socketValue),
-                            std::move(*endpointValue),
-                            std::move(*endpointObjectPath));
+                            conn, *socketValue, *endpointValue,
+                            *endpointObjectPath);
 
                         sessions[&conn]->run();
                     };
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 17c106f..cdb1990 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -45,9 +45,9 @@
     doingWrite = true;
     hostSocket->async_write_some(
         boost::asio::buffer(inputBuffer.data(), inputBuffer.size()),
-        [](boost::beast::error_code ec, std::size_t bytes_written) {
+        [](boost::beast::error_code ec, std::size_t bytesWritten) {
             doingWrite = false;
-            inputBuffer.erase(0, bytes_written);
+            inputBuffer.erase(0, bytesWritten);
 
             if (ec == boost::asio::error::eof)
             {
@@ -148,8 +148,7 @@
             }
         })
         .onmessage([]([[maybe_unused]] crow::websocket::Connection& conn,
-                      const std::string& data,
-                      [[maybe_unused]] bool is_binary) {
+                      const std::string& data, [[maybe_unused]] bool isBinary) {
             inputBuffer += data;
             doWrite();
         });
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index e970de5..466ddc1 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -83,7 +83,7 @@
         [transaction, processName{std::string(processName)},
          objectPath{std::string(objectPath)}](
             const boost::system::error_code ec,
-            const std::string& introspect_xml) {
+            const std::string& introspectXml) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR
@@ -97,7 +97,7 @@
 
             tinyxml2::XMLDocument doc;
 
-            doc.Parse(introspect_xml.c_str());
+            doc.Parse(introspectXml.c_str());
             tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
             if (pRoot == nullptr)
             {
@@ -222,21 +222,21 @@
 };
 
 inline void getManagedObjectsForEnumerate(
-    const std::string& object_name, const std::string& object_manager_path,
-    const std::string& connection_name,
+    const std::string& objectName, const std::string& objectManagerPath,
+    const std::string& connectionName,
     const std::shared_ptr<InProgressEnumerateData>& transaction)
 {
-    BMCWEB_LOG_DEBUG << "getManagedObjectsForEnumerate " << object_name
-                     << " object_manager_path " << object_manager_path
-                     << " connection_name " << connection_name;
+    BMCWEB_LOG_DEBUG << "getManagedObjectsForEnumerate " << objectName
+                     << " object_manager_path " << objectManagerPath
+                     << " connection_name " << connectionName;
     crow::connections::systemBus->async_method_call(
-        [transaction, object_name,
-         connection_name](const boost::system::error_code ec,
-                          const dbus::utility::ManagedObjectType& objects) {
+        [transaction, objectName,
+         connectionName](const boost::system::error_code ec,
+                         const dbus::utility::ManagedObjectType& objects) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "GetManagedObjects on path " << object_name
-                                 << " on connection " << connection_name
+                BMCWEB_LOG_ERROR << "GetManagedObjects on path " << objectName
+                                 << " on connection " << connectionName
                                  << " failed with code " << ec;
                 return;
             }
@@ -246,7 +246,7 @@
 
             for (const auto& objectPath : objects)
             {
-                if (boost::starts_with(objectPath.first.str, object_name))
+                if (boost::starts_with(objectPath.first.str, objectName))
                 {
                     BMCWEB_LOG_DEBUG << "Reading object "
                                      << objectPath.first.str;
@@ -273,23 +273,23 @@
                     {
                         getManagedObjectsForEnumerate(
                             objectPath.first.str, objectPath.first.str,
-                            connection_name, transaction);
+                            connectionName, transaction);
                     }
                 }
             }
         },
-        connection_name, object_manager_path,
-        "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
+        connectionName, objectManagerPath, "org.freedesktop.DBus.ObjectManager",
+        "GetManagedObjects");
 }
 
 inline void findObjectManagerPathForEnumerate(
-    const std::string& object_name, const std::string& connection_name,
+    const std::string& objectName, const std::string& connectionName,
     const std::shared_ptr<InProgressEnumerateData>& transaction)
 {
-    BMCWEB_LOG_DEBUG << "Finding objectmanager for path " << object_name
-                     << " on connection:" << connection_name;
+    BMCWEB_LOG_DEBUG << "Finding objectmanager for path " << objectName
+                     << " on connection:" << connectionName;
     crow::connections::systemBus->async_method_call(
-        [transaction, object_name, connection_name](
+        [transaction, objectName, connectionName](
             const boost::system::error_code ec,
             const boost::container::flat_map<
                 std::string, boost::container::flat_map<
@@ -297,7 +297,7 @@
                 objects) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "GetAncestors on path " << object_name
+                BMCWEB_LOG_ERROR << "GetAncestors on path " << objectName
                                  << " failed with code " << ec;
                 return;
             }
@@ -306,11 +306,11 @@
             {
                 for (const auto& connectionGroup : pathGroup.second)
                 {
-                    if (connectionGroup.first == connection_name)
+                    if (connectionGroup.first == connectionName)
                     {
                         // Found the object manager path for this resource.
                         getManagedObjectsForEnumerate(
-                            object_name, pathGroup.first, connection_name,
+                            objectName, pathGroup.first, connectionName,
                             transaction);
                         return;
                     }
@@ -319,7 +319,7 @@
         },
         "xyz.openbmc_project.ObjectMapper",
         "/xyz/openbmc_project/object_mapper",
-        "xyz.openbmc_project.ObjectMapper", "GetAncestors", object_name,
+        "xyz.openbmc_project.ObjectMapper", "GetAncestors", objectName,
         std::array<const char*, 1>{"org.freedesktop.DBus.ObjectManager"});
 }
 
@@ -515,17 +515,17 @@
     return ret;
 }
 
-inline int convertJsonToDbus(sd_bus_message* m, const std::string& arg_type,
-                             const nlohmann::json& input_json)
+inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
+                             const nlohmann::json& inputJson)
 {
     int r = 0;
-    BMCWEB_LOG_DEBUG << "Converting " << input_json.dump()
-                     << " to type: " << arg_type;
-    const std::vector<std::string> argTypes = dbusArgSplit(arg_type);
+    BMCWEB_LOG_DEBUG << "Converting " << inputJson.dump()
+                     << " to type: " << argType;
+    const std::vector<std::string> argTypes = dbusArgSplit(argType);
 
     // Assume a single object for now.
-    const nlohmann::json* j = &input_json;
-    nlohmann::json::const_iterator jIt = input_json.begin();
+    const nlohmann::json* j = &inputJson;
+    nlohmann::json::const_iterator jIt = inputJson.begin();
 
     for (const std::string& argCode : argTypes)
     {
@@ -533,7 +533,7 @@
         // iterator, and increment it for the next loop
         if (argTypes.size() > 1)
         {
-            if (jIt == input_json.end())
+            if (jIt == inputJson.end())
             {
                 return -2;
             }
@@ -770,7 +770,7 @@
                 return r;
             }
 
-            r = convertJsonToDbus(m, containedType, input_json);
+            r = convertJsonToDbus(m, containedType, inputJson);
             if (r < 0)
             {
                 return r;
@@ -794,7 +794,7 @@
             }
 
             nlohmann::json::const_iterator it = j->begin();
-            for (const std::string& argCode2 : dbusArgSplit(arg_type))
+            for (const std::string& argCode2 : dbusArgSplit(argType))
             {
                 if (it == j->end())
                 {
@@ -1314,8 +1314,8 @@
     crow::connections::systemBus->async_method_call(
         [transaction, connectionName{std::string(connectionName)}](
             const boost::system::error_code ec,
-            const std::string& introspect_xml) {
-            BMCWEB_LOG_DEBUG << "got xml:\n " << introspect_xml;
+            const std::string& introspectXml) {
+            BMCWEB_LOG_DEBUG << "got xml:\n " << introspectXml;
             if (ec)
             {
                 BMCWEB_LOG_ERROR
@@ -1325,7 +1325,7 @@
             }
             tinyxml2::XMLDocument doc;
 
-            doc.Parse(introspect_xml.data(), introspect_xml.size());
+            doc.Parse(introspectXml.data(), introspectXml.size());
             tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
             if (pRoot == nullptr)
             {
@@ -1611,12 +1611,12 @@
 
     crow::connections::systemBus->async_method_call(
         [objectPath, asyncResp](const boost::system::error_code ec,
-                                GetSubTreeType& object_names) {
+                                GetSubTreeType& objectNames) {
             auto transaction = std::make_shared<InProgressEnumerateData>(
                 objectPath, asyncResp);
 
             transaction->subtree =
-                std::make_shared<GetSubTreeType>(std::move(object_names));
+                std::make_shared<GetSubTreeType>(std::move(objectNames));
 
             if (ec)
             {
@@ -1652,8 +1652,8 @@
         std::vector<std::pair<std::string, std::vector<std::string>>>;
     crow::connections::systemBus->async_method_call(
         [&res, path, propertyName](const boost::system::error_code ec,
-                                   const GetObjectType& object_names) {
-            if (ec || object_names.size() <= 0)
+                                   const GetObjectType& objectNames) {
+            if (ec || objectNames.size() <= 0)
             {
                 setErrorResponse(res, boost::beast::http::status::not_found,
                                  notFoundDesc, notFoundMsg);
@@ -1665,7 +1665,7 @@
             // The mapper should never give us an empty interface names
             // list, but check anyway
             for (const std::pair<std::string, std::vector<std::string>>&
-                     connection : object_names)
+                     connection : objectNames)
             {
                 const std::vector<std::string>& interfaceNames =
                     connection.second;
@@ -1820,8 +1820,8 @@
 
     crow::connections::systemBus->async_method_call(
         [transaction](const boost::system::error_code ec2,
-                      const GetObjectType& object_names) {
-            if (!ec2 && object_names.size() <= 0)
+                      const GetObjectType& objectNames) {
+            if (!ec2 && objectNames.size() <= 0)
             {
                 setErrorResponse(transaction->res,
                                  boost::beast::http::status::not_found,
@@ -1830,7 +1830,7 @@
             }
 
             for (const std::pair<std::string, std::vector<std::string>>&
-                     connection : object_names)
+                     connection : objectNames)
             {
                 const std::string& connectionName = connection.first;
 
@@ -2214,8 +2214,8 @@
 
         .methods(boost::beast::http::verb::get)(
             [](const crow::Request&, crow::Response& res,
-               const std::string& Connection) {
-                introspectObjects(Connection, "/",
+               const std::string& connection) {
+                introspectObjects(connection, "/",
                                   std::make_shared<bmcweb::AsyncResp>(res));
             });
 
@@ -2284,7 +2284,7 @@
                 crow::connections::systemBus->async_method_call(
                     [asyncResp, processName,
                      objectPath](const boost::system::error_code ec,
-                                 const std::string& introspect_xml) {
+                                 const std::string& introspectXml) {
                         if (ec)
                         {
                             BMCWEB_LOG_ERROR
@@ -2296,7 +2296,7 @@
                         }
                         tinyxml2::XMLDocument doc;
 
-                        doc.Parse(introspect_xml.c_str());
+                        doc.Parse(introspectXml.c_str());
                         tinyxml2::XMLNode* pRoot =
                             doc.FirstChildElement("node");
                         if (pRoot == nullptr)
@@ -2311,7 +2311,7 @@
                             return;
                         }
 
-                        BMCWEB_LOG_DEBUG << introspect_xml;
+                        BMCWEB_LOG_DEBUG << introspectXml;
                         asyncResp->res.jsonValue = {
                             {"status", "ok"},
                             {"bus_name", processName},
@@ -2347,7 +2347,7 @@
                 crow::connections::systemBus->async_method_call(
                     [asyncResp, processName, objectPath,
                      interfaceName](const boost::system::error_code ec,
-                                    const std::string& introspect_xml) {
+                                    const std::string& introspectXml) {
                         if (ec)
                         {
                             BMCWEB_LOG_ERROR
@@ -2359,7 +2359,7 @@
                         }
                         tinyxml2::XMLDocument doc;
 
-                        doc.Parse(introspect_xml.data(), introspect_xml.size());
+                        doc.Parse(introspectXml.data(), introspectXml.size());
                         tinyxml2::XMLNode* pRoot =
                             doc.FirstChildElement("node");
                         if (pRoot == nullptr)
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index 93fe5d0..39e83d7 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -355,7 +355,7 @@
 }
 
 inline std::shared_ptr<boost::asio::ssl::context>
-    getSslContext(const std::string& ssl_pem_file)
+    getSslContext(const std::string& sslPemFile)
 {
     std::shared_ptr<boost::asio::ssl::context> mSslContext =
         std::make_shared<boost::asio::ssl::context>(
@@ -376,9 +376,9 @@
     BMCWEB_LOG_DEBUG << "Using default TrustStore location: " << trustStorePath;
     mSslContext->add_verify_path(trustStorePath);
 
-    mSslContext->use_certificate_file(ssl_pem_file,
+    mSslContext->use_certificate_file(sslPemFile,
                                       boost::asio::ssl::context::pem);
-    mSslContext->use_private_key_file(ssl_pem_file,
+    mSslContext->use_private_key_file(sslPemFile,
                                       boost::asio::ssl::context::pem);
 
     // Set up EC curves to auto (boost asio doesn't have a method for this)
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index 43eded6..0e46f17 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -344,11 +344,11 @@
 
     crow::connections::systemBus->async_method_call(
         [asyncResp,
-         swId](const boost::system::error_code error_code,
+         swId](const boost::system::error_code errorCode,
                const boost::container::flat_map<
                    std::string, std::variant<bool, std::string, uint64_t,
                                              uint32_t>>& propertiesList) {
-            if (error_code)
+            if (errorCode)
             {
                 // not all fwtypes are updateable, this is ok
                 asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 71f9430..0cf24ea 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -164,7 +164,7 @@
     return;
 }
 
-inline void parseLDAPConfigData(nlohmann::json& json_response,
+inline void parseLDAPConfigData(nlohmann::json& jsonResponse,
                                 const LDAPConfigData& confData,
                                 const std::string& ldapType)
 {
@@ -185,9 +185,9 @@
             {"GroupsAttribute", confData.groupAttribute}}}}},
     };
 
-    json_response[ldapType].update(ldap);
+    jsonResponse[ldapType].update(ldap);
 
-    nlohmann::json& roleMapArray = json_response[ldapType]["RemoteRoleMapping"];
+    nlohmann::json& roleMapArray = jsonResponse[ldapType]["RemoteRoleMapping"];
     roleMapArray = nlohmann::json::array();
     for (auto& obj : confData.groupRoleList)
     {
@@ -402,14 +402,14 @@
             }
             std::string service = resp.begin()->first;
             crow::connections::systemBus->async_method_call(
-                [callback, ldapType](const boost::system::error_code error_code,
+                [callback, ldapType](const boost::system::error_code errorCode,
                                      const ManagedObjectType& ldapObjects) {
                     LDAPConfigData confData{};
-                    if (error_code)
+                    if (errorCode)
                     {
                         callback(false, confData, ldapType);
                         BMCWEB_LOG_ERROR << "D-Bus responses error: "
-                                         << error_code;
+                                         << errorCode;
                         return;
                     }
 
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 48b69a2..e73d338 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -200,16 +200,16 @@
     return "";
 }
 
-inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
-                                         GetManagedObjects& dbus_data,
+inline bool extractEthernetInterfaceData(const std::string& ethifaceId,
+                                         GetManagedObjects& dbusData,
                                          EthernetInterfaceData& ethData)
 {
     bool idFound = false;
-    for (auto& objpath : dbus_data)
+    for (auto& objpath : dbusData)
     {
         for (auto& ifacePair : objpath.second)
         {
-            if (objpath.first == "/xyz/openbmc_project/network/" + ethiface_id)
+            if (objpath.first == "/xyz/openbmc_project/network/" + ethifaceId)
             {
                 idFound = true;
                 if (ifacePair.first == "xyz.openbmc_project.Network.MACAddress")
@@ -416,16 +416,16 @@
 
 // Helper function that extracts data for single ethernet ipv6 address
 inline void
-    extractIPV6Data(const std::string& ethiface_id,
-                    const GetManagedObjects& dbus_data,
-                    boost::container::flat_set<IPv6AddressData>& ipv6_config)
+    extractIPV6Data(const std::string& ethifaceId,
+                    const GetManagedObjects& dbusData,
+                    boost::container::flat_set<IPv6AddressData>& ipv6Config)
 {
     const std::string ipv6PathStart =
-        "/xyz/openbmc_project/network/" + ethiface_id + "/ipv6/";
+        "/xyz/openbmc_project/network/" + ethifaceId + "/ipv6/";
 
     // Since there might be several IPv6 configurations aligned with
     // single ethernet interface, loop over all of them
-    for (const auto& objpath : dbus_data)
+    for (const auto& objpath : dbusData)
     {
         // Check if proper pattern for object path appears
         if (boost::starts_with(objpath.first.str, ipv6PathStart))
@@ -439,7 +439,7 @@
                     std::pair<
                         boost::container::flat_set<IPv6AddressData>::iterator,
                         bool>
-                        it = ipv6_config.insert(IPv6AddressData{});
+                        it = ipv6Config.insert(IPv6AddressData{});
                     IPv6AddressData& ipv6Address = *it.first;
                     ipv6Address.id =
                         objpath.first.str.substr(ipv6PathStart.size());
@@ -489,16 +489,16 @@
 
 // Helper function that extracts data for single ethernet ipv4 address
 inline void
-    extractIPData(const std::string& ethiface_id,
-                  const GetManagedObjects& dbus_data,
-                  boost::container::flat_set<IPv4AddressData>& ipv4_config)
+    extractIPData(const std::string& ethifaceId,
+                  const GetManagedObjects& dbusData,
+                  boost::container::flat_set<IPv4AddressData>& ipv4Config)
 {
     const std::string ipv4PathStart =
-        "/xyz/openbmc_project/network/" + ethiface_id + "/ipv4/";
+        "/xyz/openbmc_project/network/" + ethifaceId + "/ipv4/";
 
     // Since there might be several IPv4 configurations aligned with
     // single ethernet interface, loop over all of them
-    for (const auto& objpath : dbus_data)
+    for (const auto& objpath : dbusData)
     {
         // Check if proper pattern for object path appears
         if (boost::starts_with(objpath.first.str, ipv4PathStart))
@@ -512,7 +512,7 @@
                     std::pair<
                         boost::container::flat_set<IPv4AddressData>::iterator,
                         bool>
-                        it = ipv4_config.insert(IPv4AddressData{});
+                        it = ipv4Config.insert(IPv4AddressData{});
                     IPv4AddressData& ipv4Address = *it.first;
                     ipv4Address.id =
                         objpath.first.str.substr(ipv4PathStart.size());
@@ -888,18 +888,18 @@
  * into JSON
  */
 template <typename CallbackFunc>
-void getEthernetIfaceData(const std::string& ethiface_id,
+void getEthernetIfaceData(const std::string& ethifaceId,
                           CallbackFunc&& callback)
 {
     crow::connections::systemBus->async_method_call(
-        [ethifaceId{std::string{ethiface_id}}, callback{std::move(callback)}](
-            const boost::system::error_code error_code,
+        [ethifaceId{std::string{ethifaceId}}, callback{std::move(callback)}](
+            const boost::system::error_code errorCode,
             GetManagedObjects& resp) {
             EthernetInterfaceData ethData{};
             boost::container::flat_set<IPv4AddressData> ipv4Data;
             boost::container::flat_set<IPv6AddressData> ipv6Data;
 
-            if (error_code)
+            if (errorCode)
             {
                 callback(false, ethData, ipv4Data, ipv6Data);
                 return;
@@ -944,13 +944,13 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::move(callback)}](
-            const boost::system::error_code error_code,
+            const boost::system::error_code errorCode,
             GetManagedObjects& resp) {
             // Callback requires vector<string> to retrieve all available
             // ethernet interfaces
             boost::container::flat_set<std::string> ifaceList;
             ifaceList.reserve(resp.size());
-            if (error_code)
+            if (errorCode)
             {
                 callback(false, ifaceList);
                 return;
@@ -1024,7 +1024,7 @@
         getEthernetIfaceList(
             [asyncResp](
                 const bool& success,
-                const boost::container::flat_set<std::string>& iface_list) {
+                const boost::container::flat_set<std::string>& ifaceList) {
                 if (!success)
                 {
                     messages::internalError(asyncResp->res);
@@ -1035,7 +1035,7 @@
                     asyncResp->res.jsonValue["Members"];
                 ifaceArray = nlohmann::json::array();
                 std::string tag = "_";
-                for (const std::string& ifaceItem : iface_list)
+                for (const std::string& ifaceItem : ifaceList)
                 {
                     std::size_t found = ifaceItem.find(tag);
                     if (found == std::string::npos)
@@ -1707,8 +1707,8 @@
     }
 
     void parseInterfaceData(
-        const std::shared_ptr<AsyncResp>& asyncResp,
-        const std::string& iface_id, const EthernetInterfaceData& ethData,
+        const std::shared_ptr<AsyncResp>& asyncResp, const std::string& ifaceId,
+        const EthernetInterfaceData& ethData,
         const boost::container::flat_set<IPv4AddressData>& ipv4Data,
         const boost::container::flat_set<IPv6AddressData>& ipv6Data)
     {
@@ -1716,9 +1716,9 @@
             "xyz.openbmc_project.Inventory.Item.Ethernet"};
 
         nlohmann::json& jsonResponse = asyncResp->res.jsonValue;
-        jsonResponse["Id"] = iface_id;
+        jsonResponse["Id"] = ifaceId;
         jsonResponse["@odata.id"] =
-            "/redfish/v1/Managers/bmc/EthernetInterfaces/" + iface_id;
+            "/redfish/v1/Managers/bmc/EthernetInterfaces/" + ifaceId;
         jsonResponse["InterfaceEnabled"] = ethData.nicEnabled;
 
         auto health = std::make_shared<HealthPopulate>(asyncResp);
@@ -1784,7 +1784,7 @@
 
         jsonResponse["VLANs"] = {
             {"@odata.id", "/redfish/v1/Managers/bmc/EthernetInterfaces/" +
-                              iface_id + "/VLANs"}};
+                              ifaceId + "/VLANs"}};
 
         jsonResponse["NameServers"] = ethData.nameServers;
         jsonResponse["StaticNameServers"] = ethData.staticNameServers;
@@ -2054,21 +2054,21 @@
     }
 
   private:
-    void parseInterfaceData(nlohmann::json& json_response,
-                            const std::string& parent_iface_id,
-                            const std::string& iface_id,
+    void parseInterfaceData(nlohmann::json& jsonResponse,
+                            const std::string& parentIfaceId,
+                            const std::string& ifaceId,
                             const EthernetInterfaceData& ethData)
     {
         // Fill out obvious data...
-        json_response["Id"] = iface_id;
-        json_response["@odata.id"] =
-            "/redfish/v1/Managers/bmc/EthernetInterfaces/" + parent_iface_id +
-            "/VLANs/" + iface_id;
+        jsonResponse["Id"] = ifaceId;
+        jsonResponse["@odata.id"] =
+            "/redfish/v1/Managers/bmc/EthernetInterfaces/" + parentIfaceId +
+            "/VLANs/" + ifaceId;
 
-        json_response["VLANEnable"] = true;
+        jsonResponse["VLANEnable"] = true;
         if (!ethData.vlan_id.empty())
         {
-            json_response["VLANId"] = ethData.vlan_id.back();
+            jsonResponse["VLANId"] = ethData.vlan_id.back();
         }
     }
 
@@ -2311,14 +2311,14 @@
         getEthernetIfaceList(
             [asyncResp, rootInterfaceName{std::string(rootInterfaceName)}](
                 const bool& success,
-                const boost::container::flat_set<std::string>& iface_list) {
+                const boost::container::flat_set<std::string>& ifaceList) {
                 if (!success)
                 {
                     messages::internalError(asyncResp->res);
                     return;
                 }
 
-                if (iface_list.find(rootInterfaceName) == iface_list.end())
+                if (ifaceList.find(rootInterfaceName) == ifaceList.end())
                 {
                     messages::resourceNotFound(asyncResp->res,
                                                "VLanNetworkInterfaceCollection",
@@ -2334,7 +2334,7 @@
 
                 nlohmann::json ifaceArray = nlohmann::json::array();
 
-                for (const std::string& ifaceItem : iface_list)
+                for (const std::string& ifaceItem : ifaceList)
                 {
                     if (boost::starts_with(ifaceItem, rootInterfaceName + "_"))
                     {
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index adc1c80..f22744b 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -143,7 +143,7 @@
     }
     contents = std::string_view(data, length);
     // Only use the content after the "=" character.
-    contents.remove_prefix(std::min(contents.find("=") + 1, contents.size()));
+    contents.remove_prefix(std::min(contents.find('=') + 1, contents.size()));
     return ret;
 }
 
@@ -319,7 +319,7 @@
     // Convert the unique ID back to a timestamp to find the entry
     std::string_view tsStr(entryID);
 
-    auto underscorePos = tsStr.find("_");
+    auto underscorePos = tsStr.find('_');
     if (underscorePos != tsStr.npos)
     {
         // Timestamp has an index
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 31efc75..b82e697 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -60,11 +60,11 @@
                    {"IPMI", "phosphor-ipmi-net"}};
 
 inline void
-    extractNTPServersAndDomainNamesData(const GetManagedObjects& dbus_data,
+    extractNTPServersAndDomainNamesData(const GetManagedObjects& dbusData,
                                         std::vector<std::string>& ntpData,
                                         std::vector<std::string>& dnData)
 {
-    for (const auto& obj : dbus_data)
+    for (const auto& obj : dbusData)
     {
         for (const auto& ifacePair : obj.second)
         {
@@ -107,18 +107,18 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::move(callback)}](
-            const boost::system::error_code error_code,
-            const GetManagedObjects& dbus_data) {
+            const boost::system::error_code errorCode,
+            const GetManagedObjects& dbusData) {
             std::vector<std::string> ntpServers;
             std::vector<std::string> domainNames;
 
-            if (error_code)
+            if (errorCode)
             {
                 callback(false, ntpServers, domainNames);
                 return;
             }
 
-            extractNTPServersAndDomainNamesData(dbus_data, ntpServers,
+            extractNTPServersAndDomainNamesData(dbusData, ntpServers,
                                                 domainNames);
 
             callback(true, ntpServers, domainNames);
@@ -166,9 +166,9 @@
     void getNTPProtocolEnabled(const std::shared_ptr<AsyncResp>& asyncResp)
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code error_code,
+            [asyncResp](const boost::system::error_code errorCode,
                         const std::variant<std::string>& timeSyncMethod) {
-                if (error_code)
+                if (errorCode)
                 {
                     return;
                 }
@@ -390,8 +390,8 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code error_code) {
-                if (error_code)
+            [asyncResp](const boost::system::error_code errorCode) {
+                if (errorCode)
                 {
                     messages::internalError(asyncResp->res);
                 }
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 567cb0c..14c9593 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -223,7 +223,7 @@
  */
 template <typename Callback>
 void getObjectsWithConnection(
-    const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+    const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
     const std::shared_ptr<boost::container::flat_set<std::string>>& sensorNames,
     Callback&& callback)
 {
@@ -233,13 +233,13 @@
         "xyz.openbmc_project.Sensor.Value"};
 
     // Response handler for parsing objects subtree
-    auto respHandler = [callback{std::move(callback)}, SensorsAsyncResp,
+    auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp,
                         sensorNames](const boost::system::error_code ec,
                                      const GetSubTreeType& subtree) {
         BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler enter";
         if (ec)
         {
-            messages::internalError(SensorsAsyncResp->res);
+            messages::internalError(sensorsAsyncResp->res);
             BMCWEB_LOG_ERROR
                 << "getObjectsWithConnection resp_handler: Dbus error " << ec;
             return;
@@ -298,7 +298,7 @@
  */
 template <typename Callback>
 void getConnections(
-    std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp,
+    std::shared_ptr<SensorsAsyncResp> sensorsAsyncResp,
     const std::shared_ptr<boost::container::flat_set<std::string>> sensorNames,
     Callback&& callback)
 {
@@ -306,7 +306,7 @@
         [callback](const boost::container::flat_set<std::string>& connections,
                    const std::set<std::pair<std::string, std::string>>&
                    /*objectsWithConnection*/) { callback(connections); };
-    getObjectsWithConnection(SensorsAsyncResp, sensorNames,
+    getObjectsWithConnection(sensorsAsyncResp, sensorNames,
                              std::move(objectsWithConnectionCb));
 }
 
@@ -320,20 +320,20 @@
  * made, and eliminate Power sensors when a Thermal request is made.
  */
 inline void reduceSensorList(
-    const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+    const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
     const std::vector<std::string>* allSensors,
     const std::shared_ptr<boost::container::flat_set<std::string>>&
         activeSensors)
 {
-    if (SensorsAsyncResp == nullptr)
+    if (sensorsAsyncResp == nullptr)
     {
         return;
     }
     if ((allSensors == nullptr) || (activeSensors == nullptr))
     {
         messages::resourceNotFound(
-            SensorsAsyncResp->res, SensorsAsyncResp->chassisSubNode,
-            SensorsAsyncResp->chassisSubNode == sensors::node::thermal
+            sensorsAsyncResp->res, sensorsAsyncResp->chassisSubNode,
+            sensorsAsyncResp->chassisSubNode == sensors::node::thermal
                 ? "Temperatures"
                 : "Voltages");
 
@@ -345,7 +345,7 @@
         return;
     }
 
-    for (const char* type : SensorsAsyncResp->types)
+    for (const char* type : sensorsAsyncResp->types)
     {
         for (const std::string& sensor : *allSensors)
         {
@@ -566,7 +566,7 @@
  */
 template <typename Callback>
 void getObjectManagerPaths(
-    const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+    const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
     Callback&& callback)
 {
     BMCWEB_LOG_DEBUG << "getObjectManagerPaths enter";
@@ -575,12 +575,12 @@
 
     // Response handler for GetSubTree DBus method
     auto respHandler = [callback{std::move(callback)},
-                        SensorsAsyncResp](const boost::system::error_code ec,
+                        sensorsAsyncResp](const boost::system::error_code ec,
                                           const GetSubTreeType& subtree) {
         BMCWEB_LOG_DEBUG << "getObjectManagerPaths respHandler enter";
         if (ec)
         {
-            messages::internalError(SensorsAsyncResp->res);
+            messages::internalError(sensorsAsyncResp->res);
             BMCWEB_LOG_ERROR << "getObjectManagerPaths respHandler: DBus error "
                              << ec;
             return;
@@ -800,7 +800,7 @@
     const boost::container::flat_map<
         std::string, boost::container::flat_map<std::string, SensorVariant>>&
         interfacesDict,
-    nlohmann::json& sensor_json, InventoryItem* inventoryItem)
+    nlohmann::json& sensorJson, InventoryItem* inventoryItem)
 {
     // We need a value interface before we can do anything with it
     auto valueIt = interfacesDict.find("xyz.openbmc_project.Sensor.Value");
@@ -828,21 +828,21 @@
     {
         // For sensors in SensorCollection we set Id instead of MemberId,
         // including power sensors.
-        sensor_json["Id"] = sensorName;
-        sensor_json["Name"] = boost::replace_all_copy(sensorName, "_", " ");
+        sensorJson["Id"] = sensorName;
+        sensorJson["Name"] = boost::replace_all_copy(sensorName, "_", " ");
     }
     else if (sensorType != "power")
     {
         // Set MemberId and Name for non-power sensors.  For PowerSupplies and
         // PowerControl, those properties have more general values because
         // multiple sensors can be stored in the same JSON object.
-        sensor_json["MemberId"] = sensorName;
-        sensor_json["Name"] = boost::replace_all_copy(sensorName, "_", " ");
+        sensorJson["MemberId"] = sensorName;
+        sensorJson["Name"] = boost::replace_all_copy(sensorName, "_", " ");
     }
 
-    sensor_json["Status"]["State"] = getState(inventoryItem);
-    sensor_json["Status"]["Health"] =
-        getHealth(sensor_json, interfacesDict, inventoryItem);
+    sensorJson["Status"]["State"] = getState(inventoryItem);
+    sensorJson["Status"]["Health"] =
+        getHealth(sensorJson, interfacesDict, inventoryItem);
 
     // Parameter to set to override the type we get from dbus, and force it to
     // int, regardless of what is available.  This is used for schemas like fan,
@@ -852,47 +852,47 @@
     nlohmann::json::json_pointer unit("/Reading");
     if (sensorsAsyncResp->chassisSubNode == sensors::node::sensors)
     {
-        sensor_json["@odata.type"] = "#Sensor.v1_0_0.Sensor";
+        sensorJson["@odata.type"] = "#Sensor.v1_0_0.Sensor";
         if (sensorType == "power")
         {
-            sensor_json["ReadingUnits"] = "Watts";
+            sensorJson["ReadingUnits"] = "Watts";
         }
         else if (sensorType == "current")
         {
-            sensor_json["ReadingUnits"] = "Amperes";
+            sensorJson["ReadingUnits"] = "Amperes";
         }
         else if (sensorType == "utilization")
         {
-            sensor_json["ReadingUnits"] = "Percent";
+            sensorJson["ReadingUnits"] = "Percent";
         }
     }
     else if (sensorType == "temperature")
     {
         unit = "/ReadingCelsius"_json_pointer;
-        sensor_json["@odata.type"] = "#Thermal.v1_3_0.Temperature";
+        sensorJson["@odata.type"] = "#Thermal.v1_3_0.Temperature";
         // TODO(ed) Documentation says that path should be type fan_tach,
         // implementation seems to implement fan
     }
     else if (sensorType == "fan" || sensorType == "fan_tach")
     {
         unit = "/Reading"_json_pointer;
-        sensor_json["ReadingUnits"] = "RPM";
-        sensor_json["@odata.type"] = "#Thermal.v1_3_0.Fan";
-        setLedState(sensor_json, inventoryItem);
+        sensorJson["ReadingUnits"] = "RPM";
+        sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
+        setLedState(sensorJson, inventoryItem);
         forceToInt = true;
     }
     else if (sensorType == "fan_pwm")
     {
         unit = "/Reading"_json_pointer;
-        sensor_json["ReadingUnits"] = "Percent";
-        sensor_json["@odata.type"] = "#Thermal.v1_3_0.Fan";
-        setLedState(sensor_json, inventoryItem);
+        sensorJson["ReadingUnits"] = "Percent";
+        sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
+        setLedState(sensorJson, inventoryItem);
         forceToInt = true;
     }
     else if (sensorType == "voltage")
     {
         unit = "/ReadingVolts"_json_pointer;
-        sensor_json["@odata.type"] = "#Power.v1_0_0.Voltage";
+        sensorJson["@odata.type"] = "#Power.v1_0_0.Voltage";
     }
     else if (sensorType == "power")
     {
@@ -901,11 +901,11 @@
 
         if (!sensorName.compare("total_power"))
         {
-            sensor_json["@odata.type"] = "#Power.v1_0_0.PowerControl";
+            sensorJson["@odata.type"] = "#Power.v1_0_0.PowerControl";
             // Put multiple "sensors" into a single PowerControl, so have
             // generic names for MemberId and Name. Follows Redfish mockup.
-            sensor_json["MemberId"] = "0";
-            sensor_json["Name"] = "Chassis Power Control";
+            sensorJson["MemberId"] = "0";
+            sensorJson["Name"] = "Chassis Power Control";
             unit = "/PowerConsumedWatts"_json_pointer;
         }
         else if (sensorNameLower.find("input") != std::string::npos)
@@ -1027,17 +1027,17 @@
                 temp = temp * std::pow(10, scaleMultiplier);
                 if (forceToInt)
                 {
-                    sensor_json[key] = static_cast<int64_t>(temp);
+                    sensorJson[key] = static_cast<int64_t>(temp);
                 }
                 else
                 {
-                    sensor_json[key] = temp;
+                    sensorJson[key] = temp;
                 }
             }
         }
     }
 
-    sensorsAsyncResp->addMetadata(sensor_json, unit.to_string(),
+    sensorsAsyncResp->addMetadata(sensorJson, unit.to_string(),
                                   "/xyz/openbmc_project/sensors/" + sensorType +
                                       "/" + sensorName);
 
@@ -1252,11 +1252,11 @@
 }
 
 inline void
-    sortJSONResponse(const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp)
+    sortJSONResponse(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp)
 {
-    nlohmann::json& response = SensorsAsyncResp->res.jsonValue;
+    nlohmann::json& response = sensorsAsyncResp->res.jsonValue;
     std::array<std::string, 2> sensorHeaders{"Temperatures", "Fans"};
-    if (SensorsAsyncResp->chassisSubNode == sensors::node::power)
+    if (sensorsAsyncResp->chassisSubNode == sensors::node::power)
     {
         sensorHeaders = {"Voltages", "PowerSupplies"};
     }
@@ -1284,7 +1284,7 @@
                 {
                     *value += std::to_string(count);
                     count++;
-                    SensorsAsyncResp->updateUri(sensorJson["Name"], *value);
+                    sensorsAsyncResp->updateUri(sensorJson["Name"], *value);
                 }
             }
         }
@@ -2418,7 +2418,7 @@
  * @param inventoryItems Inventory items associated with the sensors.
  */
 inline void getSensorData(
-    const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+    const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
     const std::shared_ptr<boost::container::flat_set<std::string>>& sensorNames,
     const boost::container::flat_set<std::string>& connections,
     const std::shared_ptr<boost::container::flat_map<std::string, std::string>>&
@@ -2430,7 +2430,7 @@
     for (const std::string& connection : connections)
     {
         // Response handler to process managed objects
-        auto getManagedObjectsCb = [SensorsAsyncResp, sensorNames,
+        auto getManagedObjectsCb = [sensorsAsyncResp, sensorNames,
                                     inventoryItems](
                                        const boost::system::error_code ec,
                                        ManagedObjectsVectorType& resp) {
@@ -2438,7 +2438,7 @@
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "getManagedObjectsCb DBUS error: " << ec;
-                messages::internalError(SensorsAsyncResp->res);
+                messages::internalError(sensorsAsyncResp->res);
                 return;
             }
             // Go through all objects and update response with sensor data
@@ -2477,17 +2477,17 @@
                     findInventoryItemForSensor(inventoryItems, objPath);
 
                 const std::string& sensorSchema =
-                    SensorsAsyncResp->chassisSubNode;
+                    sensorsAsyncResp->chassisSubNode;
 
                 nlohmann::json* sensorJson = nullptr;
 
                 if (sensorSchema == sensors::node::sensors)
                 {
-                    SensorsAsyncResp->res.jsonValue["@odata.id"] =
-                        "/redfish/v1/Chassis/" + SensorsAsyncResp->chassisId +
-                        "/" + SensorsAsyncResp->chassisSubNode + "/" +
+                    sensorsAsyncResp->res.jsonValue["@odata.id"] =
+                        "/redfish/v1/Chassis/" + sensorsAsyncResp->chassisId +
+                        "/" + sensorsAsyncResp->chassisSubNode + "/" +
                         sensorName;
-                    sensorJson = &(SensorsAsyncResp->res.jsonValue);
+                    sensorJson = &(sensorsAsyncResp->res.jsonValue);
                 }
                 else
                 {
@@ -2530,7 +2530,7 @@
                     }
 
                     nlohmann::json& tempArray =
-                        SensorsAsyncResp->res.jsonValue[fieldName];
+                        sensorsAsyncResp->res.jsonValue[fieldName];
                     if (fieldName == "PowerControl")
                     {
                         if (tempArray.empty())
@@ -2541,8 +2541,8 @@
                             tempArray.push_back(
                                 {{"@odata.id",
                                   "/redfish/v1/Chassis/" +
-                                      SensorsAsyncResp->chassisId + "/" +
-                                      SensorsAsyncResp->chassisSubNode + "#/" +
+                                      sensorsAsyncResp->chassisId + "/" +
+                                      sensorsAsyncResp->chassisSubNode + "#/" +
                                       fieldName + "/0"}});
                         }
                         sensorJson = &(tempArray.back());
@@ -2553,7 +2553,7 @@
                         {
                             sensorJson =
                                 &(getPowerSupply(tempArray, *inventoryItem,
-                                                 SensorsAsyncResp->chassisId));
+                                                 sensorsAsyncResp->chassisId));
                         }
                     }
                     else
@@ -2561,8 +2561,8 @@
                         tempArray.push_back(
                             {{"@odata.id",
                               "/redfish/v1/Chassis/" +
-                                  SensorsAsyncResp->chassisId + "/" +
-                                  SensorsAsyncResp->chassisSubNode + "#/" +
+                                  sensorsAsyncResp->chassisId + "/" +
+                                  sensorsAsyncResp->chassisSubNode + "#/" +
                                   fieldName + "/"}});
                         sensorJson = &(tempArray.back());
                     }
@@ -2571,16 +2571,16 @@
                 if (sensorJson != nullptr)
                 {
                     objectInterfacesToJson(
-                        sensorName, sensorType, SensorsAsyncResp,
+                        sensorName, sensorType, sensorsAsyncResp,
                         objDictEntry.second, *sensorJson, inventoryItem);
                 }
             }
-            if (SensorsAsyncResp.use_count() == 1)
+            if (sensorsAsyncResp.use_count() == 1)
             {
-                sortJSONResponse(SensorsAsyncResp);
-                if (SensorsAsyncResp->chassisSubNode == sensors::node::thermal)
+                sortJSONResponse(sensorsAsyncResp);
+                if (sensorsAsyncResp->chassisSubNode == sensors::node::thermal)
                 {
-                    populateFanRedundancy(SensorsAsyncResp);
+                    populateFanRedundancy(sensorsAsyncResp);
                 }
             }
             BMCWEB_LOG_DEBUG << "getManagedObjectsCb exit";
@@ -2602,33 +2602,33 @@
 }
 
 inline void processSensorList(
-    const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+    const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
     const std::shared_ptr<boost::container::flat_set<std::string>>& sensorNames)
 {
     auto getConnectionCb =
-        [SensorsAsyncResp, sensorNames](
+        [sensorsAsyncResp, sensorNames](
             const boost::container::flat_set<std::string>& connections) {
             BMCWEB_LOG_DEBUG << "getConnectionCb enter";
             auto getObjectManagerPathsCb =
-                [SensorsAsyncResp, sensorNames,
+                [sensorsAsyncResp, sensorNames,
                  connections](const std::shared_ptr<boost::container::flat_map<
                                   std::string, std::string>>& objectMgrPaths) {
                     BMCWEB_LOG_DEBUG << "getObjectManagerPathsCb enter";
                     auto getInventoryItemsCb =
-                        [SensorsAsyncResp, sensorNames, connections,
+                        [sensorsAsyncResp, sensorNames, connections,
                          objectMgrPaths](
                             const std::shared_ptr<std::vector<InventoryItem>>&
                                 inventoryItems) {
                             BMCWEB_LOG_DEBUG << "getInventoryItemsCb enter";
                             // Get sensor data and store results in JSON
-                            getSensorData(SensorsAsyncResp, sensorNames,
+                            getSensorData(sensorsAsyncResp, sensorNames,
                                           connections, objectMgrPaths,
                                           inventoryItems);
                             BMCWEB_LOG_DEBUG << "getInventoryItemsCb exit";
                         };
 
                     // Get inventory items associated with sensors
-                    getInventoryItems(SensorsAsyncResp, sensorNames,
+                    getInventoryItems(sensorsAsyncResp, sensorNames,
                                       objectMgrPaths,
                                       std::move(getInventoryItemsCb));
 
@@ -2637,13 +2637,13 @@
 
             // Get mapping from connection names to the DBus object
             // paths that implement the ObjectManager interface
-            getObjectManagerPaths(SensorsAsyncResp,
+            getObjectManagerPaths(sensorsAsyncResp,
                                   std::move(getObjectManagerPathsCb));
             BMCWEB_LOG_DEBUG << "getConnectionCb exit";
         };
 
     // Get set of connections that provide sensor values
-    getConnections(SensorsAsyncResp, sensorNames, std::move(getConnectionCb));
+    getConnections(sensorsAsyncResp, sensorNames, std::move(getConnectionCb));
 }
 
 /**
@@ -2652,21 +2652,21 @@
  * @param SensorsAsyncResp   Pointer to object holding response data
  */
 inline void
-    getChassisData(const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp)
+    getChassisData(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp)
 {
     BMCWEB_LOG_DEBUG << "getChassisData enter";
     auto getChassisCb =
-        [SensorsAsyncResp](
+        [sensorsAsyncResp](
             const std::shared_ptr<boost::container::flat_set<std::string>>&
                 sensorNames) {
             BMCWEB_LOG_DEBUG << "getChassisCb enter";
-            processSensorList(SensorsAsyncResp, sensorNames);
+            processSensorList(sensorsAsyncResp, sensorNames);
             BMCWEB_LOG_DEBUG << "getChassisCb exit";
         };
-    SensorsAsyncResp->res.jsonValue["Redundancy"] = nlohmann::json::array();
+    sensorsAsyncResp->res.jsonValue["Redundancy"] = nlohmann::json::array();
 
     // Get set of sensors in chassis
-    getChassis(SensorsAsyncResp, std::move(getChassisCb));
+    getChassis(sensorsAsyncResp, std::move(getChassisCb));
     BMCWEB_LOG_DEBUG << "getChassisData exit";
 }
 
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index ddb8b30..0eb9d10 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -44,11 +44,11 @@
 {
     BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
     crow::connections::systemBus->async_method_call(
-        [](const boost::system::error_code error_code) {
-            if (error_code)
+        [](const boost::system::error_code errorCode) {
+            if (errorCode)
             {
-                BMCWEB_LOG_DEBUG << "error_code = " << error_code;
-                BMCWEB_LOG_DEBUG << "error msg = " << error_code.message();
+                BMCWEB_LOG_DEBUG << "error_code = " << errorCode;
+                BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message();
             }
         },
         service, objPath, "org.freedesktop.DBus.Properties", "Set",
@@ -83,14 +83,14 @@
             // Retrieve service and activate
             crow::connections::systemBus->async_method_call(
                 [objPath, asyncResp,
-                 req](const boost::system::error_code error_code,
+                 req](const boost::system::error_code errorCode,
                       const std::vector<std::pair<
                           std::string, std::vector<std::string>>>& objInfo) {
-                    if (error_code)
+                    if (errorCode)
                     {
-                        BMCWEB_LOG_DEBUG << "error_code = " << error_code;
+                        BMCWEB_LOG_DEBUG << "error_code = " << errorCode;
                         BMCWEB_LOG_DEBUG << "error msg = "
-                                         << error_code.message();
+                                         << errorCode.message();
                         if (asyncResp)
                         {
                             messages::internalError(asyncResp->res);
@@ -848,10 +848,10 @@
 
                     crow::connections::systemBus->async_method_call(
                         [asyncResp,
-                         swId](const boost::system::error_code error_code,
+                         swId](const boost::system::error_code errorCode,
                                const boost::container::flat_map<
                                    std::string, VariantType>& propertiesList) {
-                            if (error_code)
+                            if (errorCode)
                             {
                                 messages::internalError(asyncResp->res);
                                 return;
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 6d1672c..95a8881 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -55,7 +55,7 @@
  * @brief Read all known properties from VM object interfaces
  */
 static void vmParseInterfaceObject(const DbusInterfaceType& interface,
-                                   std::shared_ptr<AsyncResp> aResp)
+                                   const std::shared_ptr<AsyncResp>& aResp)
 {
     const auto mountPointIface =
         interface.find("xyz.openbmc_project.VirtualMedia.MountPoint");
@@ -227,7 +227,7 @@
 /**
  *  @brief Fills data for specific resource
  */
-static void getVmData(std::shared_ptr<AsyncResp> aResp,
+static void getVmData(const std::shared_ptr<AsyncResp>& aResp,
                       const std::string& service, const std::string& name,
                       const std::string& resName)
 {
@@ -334,7 +334,7 @@
             {
                 return TransferProtocol::smb;
             }
-            else if (scheme == "https")
+            if (scheme == "https")
             {
                 return TransferProtocol::https;
             }
@@ -380,7 +380,7 @@
      * @brief Function extends URI with transfer protocol type.
      *
      */
-    const std::string
+    std::string
         getUriWithTransferProtocol(const std::string& imageUri,
                                    const TransferProtocol& transferProtocol)
     {
@@ -557,9 +557,9 @@
                 BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
 
                 crow::connections::systemBus->async_method_call(
-                    [this, service, resName, req, aResp{std::move(aResp)}](
-                        const boost::system::error_code ec,
-                        ManagedObjectType& subtree) {
+                    [this, service, resName, req,
+                     aResp{aResp}](const boost::system::error_code ec,
+                                   ManagedObjectType& subtree) {
                         if (ec)
                         {
                             BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -635,10 +635,10 @@
 
                                 // manager is irrelevant for VirtualMedia dbus
                                 // calls
-                                doMountVmLegacy(
-                                    std::move(aResp), service, resName,
-                                    imageUrl, !(*writeProtected),
-                                    std::move(*userName), std::move(*password));
+                                doMountVmLegacy(aResp, service, resName,
+                                                imageUrl, !(*writeProtected),
+                                                std::move(*userName),
+                                                std::move(*password));
 
                                 return;
                             }
@@ -732,7 +732,7 @@
             return credentials.password();
         }
 
-        SecureBuffer pack(const FormatterFunc formatter)
+        SecureBuffer pack(FormatterFunc formatter)
         {
             SecureBuffer packed{new Buffer{}};
             if (formatter)
@@ -770,7 +770,7 @@
         }
 
         template <typename WriteHandler>
-        void async_write(WriteHandler&& handler)
+        void asyncWrite(WriteHandler&& handler)
         {
             impl.async_write_some(data(), std::forward<WriteHandler>(handler));
         }
@@ -803,7 +803,7 @@
      *
      * All BMC state properties will be retrieved before sending reset request.
      */
-    void doMountVmLegacy(std::shared_ptr<AsyncResp> asyncResp,
+    void doMountVmLegacy(const std::shared_ptr<AsyncResp>& asyncResp,
                          const std::string& service, const std::string& name,
                          const std::string& imageUrl, const bool rw,
                          std::string&& userName, std::string&& password)
@@ -845,7 +845,7 @@
             unixFd = secretPipe->fd();
 
             // Pass secret over pipe
-            secretPipe->async_write(
+            secretPipe->asyncWrite(
                 [asyncResp](const boost::system::error_code& ec, std::size_t) {
                     if (ec)
                     {
@@ -939,9 +939,9 @@
                 BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
 
                 crow::connections::systemBus->async_method_call(
-                    [this, resName, service, req, aResp{std::move(aResp)}](
-                        const boost::system::error_code ec,
-                        ManagedObjectType& subtree) {
+                    [this, resName, service, req,
+                     aResp{aResp}](const boost::system::error_code ec,
+                                   ManagedObjectType& subtree) {
                         if (ec)
                         {
                             BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -968,16 +968,14 @@
                                 if (lastIndex != std::string::npos)
                                 {
                                     // Proxy mode
-                                    doVmAction(std::move(aResp), service,
-                                               resName, false);
+                                    doVmAction(aResp, service, resName, false);
                                 }
 
                                 lastIndex = path.rfind("Legacy");
                                 if (lastIndex != std::string::npos)
                                 {
                                     // Legacy mode
-                                    doVmAction(std::move(aResp), service,
-                                               resName, true);
+                                    doVmAction(aResp, service, resName, true);
                                 }
 
                                 return;
@@ -1001,7 +999,7 @@
      *
      * All BMC state properties will be retrieved before sending reset request.
      */
-    void doVmAction(std::shared_ptr<AsyncResp> asyncResp,
+    void doVmAction(const std::shared_ptr<AsyncResp>& asyncResp,
                     const std::string& service, const std::string& name,
                     bool legacy)
     {
