Enable readability-named-parameter checks
We don't have too many violations here, probably because we don't have
many optional parameters. Fix the existing instances, and enable the
check.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I4d512f0ec90b060fb60a42fe3cd6ba72fb6c6bcb
diff --git a/.clang-tidy b/.clang-tidy
index 516ffef..ffb6b06 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -273,6 +273,7 @@
readability-delete-null-pointer,
readability-deleted-default,
readability-else-after-return,
+readability-named-parameter,
readability-identifier-naming'
WarningsAsErrors: '*'
diff --git a/http/routing.hpp b/http/routing.hpp
index a7c0ced..9cd3d7b 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -49,19 +49,19 @@
return {};
}
- virtual void handle(const Request&,
+ virtual void handle(const Request& /*req*/,
const std::shared_ptr<bmcweb::AsyncResp>&,
const RoutingParams&) = 0;
- virtual void handleUpgrade(const Request&, Response& res,
- boost::asio::ip::tcp::socket&&)
+ virtual void handleUpgrade(const Request& /*req*/, Response& res,
+ boost::asio::ip::tcp::socket&& /*adaptor*/)
{
res.result(boost::beast::http::status::not_found);
res.end();
}
#ifdef BMCWEB_ENABLE_SSL
- virtual void
- handleUpgrade(const Request&, Response& res,
- boost::beast::ssl_stream<boost::asio::ip::tcp::socket>&&)
+ virtual void handleUpgrade(
+ const Request& /*req*/, Response& res,
+ boost::beast::ssl_stream<boost::asio::ip::tcp::socket>&& /*adaptor*/)
{
res.result(boost::beast::http::status::not_found);
res.end();
@@ -211,7 +211,8 @@
!std::is_same<
typename std::tuple_element<0, std::tuple<Args..., void>>::type,
const Request&>::value,
- int>::type = 0)
+ int>::type /*enable*/
+ = 0)
{
handler = [f = std::forward<Func>(f)](
const Request&,
@@ -245,7 +246,8 @@
!std::is_same<typename std::tuple_element<
1, std::tuple<Args..., void, void>>::type,
const std::shared_ptr<bmcweb::AsyncResp>&>::value,
- int>::type = 0)
+ int>::type /*enable*/
+ = 0)
{
handler = ReqHandlerWrapper<Args...>(std::move(f));
/*handler = (
@@ -266,7 +268,8 @@
std::is_same<typename std::tuple_element<
1, std::tuple<Args..., void, void>>::type,
const std::shared_ptr<bmcweb::AsyncResp>&>::value,
- int>::type = 0)
+ int>::type /*enable*/
+ = 0)
{
handler = std::move(f);
}
@@ -275,8 +278,8 @@
struct HandlerTypeHelper
{
using type = std::function<void(
- const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>&,
- Args...)>;
+ const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>&, Args...)>;
using args_type =
black_magic::S<typename black_magic::PromoteT<Args>...>;
};
@@ -285,8 +288,8 @@
struct HandlerTypeHelper<const Request&, Args...>
{
using type = std::function<void(
- const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>&,
- Args...)>;
+ const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>&, Args...)>;
using args_type =
black_magic::S<typename black_magic::PromoteT<Args>...>;
};
@@ -296,8 +299,8 @@
const std::shared_ptr<bmcweb::AsyncResp>&, Args...>
{
using type = std::function<void(
- const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>&,
- Args...)>;
+ const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>&, Args...)>;
using args_type =
black_magic::S<typename black_magic::PromoteT<Args>...>;
};
@@ -330,14 +333,14 @@
void validate() override
{}
- void handle(const Request&,
+ void handle(const Request& /*req*/,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const RoutingParams&) override
+ const RoutingParams& /*params*/) override
{
asyncResp->res.result(boost::beast::http::status::not_found);
}
- void handleUpgrade(const Request& req, Response&,
+ void handleUpgrade(const Request& req, Response& /*res*/,
boost::asio::ip::tcp::socket&& adaptor) override
{
std::shared_ptr<
@@ -349,7 +352,7 @@
myConnection->start();
}
#ifdef BMCWEB_ENABLE_SSL
- void handleUpgrade(const Request& req, Response&,
+ void handleUpgrade(const Request& req, Response& /*res*/,
boost::beast::ssl_stream<boost::asio::ip::tcp::socket>&&
adaptor) override
{
@@ -499,7 +502,7 @@
std::function<void(const Request&,
const std::shared_ptr<bmcweb::AsyncResp>&,
const RoutingParams&)>
- wrap(Func f, std::integer_sequence<unsigned, Indices...>)
+ wrap(Func f, std::integer_sequence<unsigned, Indices...> /*is*/)
{
using function_t = crow::utility::function_traits<Func>;
diff --git a/include/cors_preflight.hpp b/include/cors_preflight.hpp
index 1cd8564..29d7475 100644
--- a/include/cors_preflight.hpp
+++ b/include/cors_preflight.hpp
@@ -10,8 +10,8 @@
{
BMCWEB_ROUTE(app, "<str>")
.methods(boost::beast::http::verb::options)(
- [](const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>&,
- const std::string&) {
+ [](const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>&, const std::string&) {
// An empty body handler that simply returns the headers bmcweb
// uses This allows browsers to do their CORS preflight checks
});
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 45525bf..4434e1f 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -51,7 +51,7 @@
* Returns : False (if not a Valid lock request)
*/
- virtual bool isValidLockRequest(const LockRequest&);
+ virtual bool isValidLockRequest(const LockRequest& refLockRecord);
/*
* This function implements the logic of checking if the incoming
@@ -61,7 +61,7 @@
* Returns : False (if not conflicting)
*/
- virtual bool isConflictRequest(const LockRequests&);
+ virtual bool isConflictRequest(const LockRequests& refLockRequestStructure);
/*
* Implements the core algorithm to find the conflicting
* lock requests.
@@ -72,7 +72,8 @@
* Returns : True (if conflicting)
* Returns : False (if not conflicting)
*/
- virtual bool isConflictRecord(const LockRequest&, const LockRequest&);
+ virtual bool isConflictRecord(const LockRequest& refLockRecord1,
+ const LockRequest& refLockRecord2);
/*
* This function implements the logic of checking the conflicting
@@ -81,7 +82,7 @@
*
*/
- virtual Rc isConflictWithTable(const LockRequests&);
+ virtual Rc isConflictWithTable(const LockRequests& refLockRequestStructure);
/*
* This function implements the logic of checking the ownership of the
* lock from the releaselock request.
@@ -90,22 +91,22 @@
* Returns : False (if the request HMC or Session does not own the lock(s))
*/
- virtual RcRelaseLock isItMyLock(const ListOfTransactionIds&,
- const SessionFlags&);
+ virtual RcRelaseLock isItMyLock(const ListOfTransactionIds& refRids,
+ const SessionFlags& ids);
/*
* This function validates the the list of transactionID's and returns false
* if the transaction ID is not valid & not present in the lock table
*/
- virtual bool validateRids(const ListOfTransactionIds&);
+ virtual bool validateRids(const ListOfTransactionIds& refRids);
/*
* This function releases the locks that are already obtained by the
* requesting Management console.
*/
- void releaseLock(const ListOfTransactionIds&);
+ void releaseLock(const ListOfTransactionIds& refRids);
Lock()
{
@@ -117,7 +118,8 @@
* bytes of the resource id based on the lock management algorithm.
*/
- bool checkByte(uint64_t, uint64_t, uint32_t);
+ static bool checkByte(uint64_t resourceId1, uint64_t resourceId2,
+ uint32_t position);
/*
* This functions implements a counter that generates a unique 32 bit
@@ -143,7 +145,7 @@
*
*/
- RcAcquireLock acquireLock(const LockRequests&);
+ RcAcquireLock acquireLock(const LockRequests& lockRequestStructure);
/*
* This function implements the logic for releasing the lock that are
@@ -156,21 +158,21 @@
* Client can choose either of the ways by using `Type` JSON key.
*
*/
- RcReleaseLockApi releaseLock(const ListOfTransactionIds&,
- const SessionFlags&);
+ RcReleaseLockApi releaseLock(const ListOfTransactionIds& p,
+ const SessionFlags& ids);
/*
* This function implements the logic for getting the list of locks obtained
* by a particular management console.
*/
- RcGetLockList getLockList(const ListOfSessionIds&);
+ RcGetLockList getLockList(const ListOfSessionIds& listSessionId);
/*
* This function is releases all the locks obtained by a particular
* session.
*/
- void releaseLock(const std::string&);
+ void releaseLock(const std::string& sessionId);
static Lock& getInstance()
{
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index 23eada6..f5bc8b6 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -294,25 +294,4 @@
return isOperationAllowedWithPrivileges(it->second, userPrivileges);
}
-/**
- * @brief Checks if a user is allowed to call an HTTP method
- *
- * @param[in] method HTTP method
- * @param[in] user Username
- *
- * @return True if method allowed, false otherwise
- *
- */
-inline bool isMethodAllowedForUser(const boost::beast::http::verb method,
- const OperationMap& operationMap,
- const std::string&)
-{
- // TODO: load user privileges from configuration as soon as its available
- // now we are granting all privileges to everyone.
- Privileges userPrivileges{"Login", "ConfigureManager", "ConfigureSelf",
- "ConfigureUsers", "ConfigureComponents"};
-
- return isMethodAllowedWithPrivileges(method, operationMap, userPrivileges);
-}
-
} // namespace redfish
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 0291fc9..22577ea 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -335,8 +335,8 @@
}
template <size_t Count, size_t Index>
-bool readJsonValues(const std::string& key, nlohmann::json&,
- crow::Response& res, std::bitset<Count>&)
+bool readJsonValues(const std::string& key, nlohmann::json& /*jsonValue*/,
+ crow::Response& res, std::bitset<Count>& /*handled*/)
{
BMCWEB_LOG_DEBUG << "Unable to find variable for key" << key;
messages::propertyUnknown(res, key);
@@ -368,7 +368,7 @@
}
template <size_t Index = 0, size_t Count>
-bool handleMissing(std::bitset<Count>&, crow::Response&)
+bool handleMissing(std::bitset<Count>& /*handled*/, crow::Response& /*res*/)
{
return true;
}
@@ -376,7 +376,8 @@
template <size_t Index = 0, size_t Count, typename ValueType,
typename... UnpackTypes>
bool handleMissing(std::bitset<Count>& handled, crow::Response& res,
- const char* key, ValueType&, UnpackTypes&... in)
+ const char* key, ValueType& /*unusedValue*/,
+ UnpackTypes&... in)
{
bool ret = true;
if (!handled.test(Index) && !IsOptional<ValueType>::value)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index c2fb284..d8475ae 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -9,7 +9,7 @@
* BiosService class supports handle get method for bios.
*/
inline void
- handleBiosServiceGet(const crow::Request&,
+ handleBiosServiceGet(const crow::Request& /*req*/,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Bios";
@@ -39,7 +39,7 @@
* Analyzes POST body message before sends Reset request data to D-Bus.
*/
inline void
- handleBiosResetPost(const crow::Request&,
+ handleBiosResetPost(const crow::Request& /*req*/,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
crow::connections::systemBus->async_method_call(
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index cfa2bf5..c2848c3 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -28,7 +28,8 @@
{
inline void handleMessageRegistryFileCollectionGet(
- const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
// Collections don't include the static data added by SubRoute
// because it has a duplicate entry for members
@@ -59,7 +60,8 @@
}
inline void handleMessageRoutesMessageRegistryFileGet(
- const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& registry)
{
const message_registries::Header* header = nullptr;
@@ -123,7 +125,8 @@
}
inline void handleMessageRegistryGet(
- const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& registry, const std::string& registryMatch)
{
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
index 62be63f..2a1803d 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -24,7 +24,7 @@
{
inline void
- handleServiceRootGet(const crow::Request&,
+ handleServiceRootGet(const crow::Request& /*req*/,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index c3082d7..5457530 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -10,7 +10,8 @@
{
inline void handleTelemetryServiceGet(
- const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const crow::Request& /*req*/,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
asyncResp->res.jsonValue["@odata.type"] =
"#TelemetryService.v1_2_1.TelemetryService";