Enable readability-avoid-const-params-in-decls
This check involves explicitly declaring variables const when they're
declared auto, which helps in readability, and makes it more clear that
the variables are const.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 8aa6ba6..dcca3aa 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -91,7 +91,7 @@
* @returns Message InternalError formatted to JSON */
nlohmann::json internalError();
-void internalError(crow::Response& res, const bmcweb::source_location location =
+void internalError(crow::Response& res, bmcweb::source_location location =
bmcweb::source_location::current());
/**
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 4fb07ca..ec294ae 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -555,7 +555,7 @@
}
}
- uint64_t getEventSeqNum()
+ uint64_t getEventSeqNum() const
{
return eventSeqNum;
}
@@ -751,7 +751,7 @@
}
}
- void updateSubscriptionData()
+ void updateSubscriptionData() const
{
persistent_data::EventServiceStore::getInstance()
.eventServiceConfig.enabled = serviceEnabled;
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index f5bc8b6..160816f 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -260,7 +260,7 @@
{
return true;
}
- for (auto& requiredPrivileges : operationPrivilegesRequired)
+ for (const auto& requiredPrivileges : operationPrivilegesRequired)
{
BMCWEB_LOG_DEBUG << "Checking operation privileges...";
if (userPrivileges.isSupersetOf(requiredPrivileges))
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index a0758d9..c05f8cb 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -68,7 +68,7 @@
// example functionalFw:
// v as 2 "/xyz/openbmc_project/software/ace821ef"
// "/xyz/openbmc_project/software/230fb078"
- for (auto& fw : functionalFw)
+ for (const auto& fw : functionalFw)
{
sdbusplus::message::object_path path(fw);
std::string leaf = path.filename();