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/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 9f40725..aa4d5ec 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -428,7 +428,7 @@
if (interfaceMap.first ==
"xyz.openbmc_project.Common.Progress")
{
- for (auto& propertyMap : interfaceMap.second)
+ for (const auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Status")
{
@@ -467,7 +467,7 @@
"xyz.openbmc_project.Time.EpochTime")
{
- for (auto& propertyMap : interfaceMap.second)
+ for (const auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Elapsed")
{
@@ -564,7 +564,7 @@
std::string(boost::algorithm::to_lower_copy(dumpType)) +
"/entry/";
- for (auto& objectPath : resp)
+ for (const auto& objectPath : resp)
{
if (objectPath.first.str != dumpEntryPath + entryID)
{
@@ -576,17 +576,18 @@
uint64_t size = 0;
std::string dumpStatus;
- for (auto& interfaceMap : objectPath.second)
+ for (const auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first ==
"xyz.openbmc_project.Common.Progress")
{
- for (auto& propertyMap : interfaceMap.second)
+ for (const auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Status")
{
- auto status = std::get_if<std::string>(
- &propertyMap.second);
+ const std::string* status =
+ std::get_if<std::string>(
+ &propertyMap.second);
if (status == nullptr)
{
messages::internalError(asyncResp->res);
@@ -599,11 +600,11 @@
else if (interfaceMap.first ==
"xyz.openbmc_project.Dump.Entry")
{
- for (auto& propertyMap : interfaceMap.second)
+ for (const auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Size")
{
- auto sizePtr =
+ const uint64_t* sizePtr =
std::get_if<uint64_t>(&propertyMap.second);
if (sizePtr == nullptr)
{
@@ -618,7 +619,7 @@
else if (interfaceMap.first ==
"xyz.openbmc_project.Time.EpochTime")
{
- for (auto& propertyMap : interfaceMap.second)
+ for (const auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Elapsed")
{
@@ -1373,7 +1374,7 @@
nlohmann::json& entriesArray =
asyncResp->res.jsonValue["Members"];
entriesArray = nlohmann::json::array();
- for (auto& objectPath : resp)
+ for (const auto& objectPath : resp)
{
const uint32_t* id = nullptr;
const uint64_t* timestamp = nullptr;
@@ -1382,12 +1383,13 @@
const std::string* message = nullptr;
const std::string* filePath = nullptr;
bool resolved = false;
- for (auto& interfaceMap : objectPath.second)
+ for (const auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first ==
"xyz.openbmc_project.Logging.Entry")
{
- for (auto& propertyMap : interfaceMap.second)
+ for (const auto& propertyMap :
+ interfaceMap.second)
{
if (propertyMap.first == "Id")
{
@@ -1439,7 +1441,8 @@
else if (interfaceMap.first ==
"xyz.openbmc_project.Common.FilePath")
{
- for (auto& propertyMap : interfaceMap.second)
+ for (const auto& propertyMap :
+ interfaceMap.second)
{
if (propertyMap.first == "Path")
{
@@ -1536,7 +1539,7 @@
const std::string* filePath = nullptr;
bool resolved = false;
- for (auto& propertyMap : resp)
+ for (const auto& propertyMap : resp)
{
if (propertyMap.first == "Id")
{
@@ -3423,7 +3426,7 @@
return;
}
- auto& [tID, c] = postcodes[value];
+ const auto& [tID, c] = postcodes[value];
if (c.empty())
{
BMCWEB_LOG_INFO << "No found post code data";