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/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 10f0a9a..b39bada 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -245,7 +245,7 @@
// validate the lock request
- for (auto& lockRecord : lockRequestStructure)
+ for (const auto& lockRecord : lockRequestStructure)
{
bool status = isValidLockRequest(lockRecord);
if (!status)
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 876ceb3..e80e727 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -85,7 +85,7 @@
return;
}
std::uintmax_t saveAreaDirSize = 0;
- for (auto& it : iter)
+ for (const auto& it : iter)
{
if (!std::filesystem::is_directory(it, ec))
{
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 9233a27..8aab757 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2232,7 +2232,7 @@
}
std::filesystem::directory_iterator files(loc);
- for (auto& file : files)
+ for (const auto& file : files)
{
std::ifstream readFile(file.path());
if (!readFile.good())
diff --git a/include/random.hpp b/include/random.hpp
index 0e63391..082c4e3 100644
--- a/include/random.hpp
+++ b/include/random.hpp
@@ -29,7 +29,7 @@
return std::numeric_limits<uint8_t>::min();
}
- bool error()
+ bool error() const
{
return err;
}
diff --git a/include/sessions.hpp b/include/sessions.hpp
index b445915..85c0cb9 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -353,7 +353,7 @@
return authMethodsConfig;
}
- bool needsWrite()
+ bool needsWrite() const
{
return needWrite;
}