diff options
author | Ed Tanous <edtanous@google.com> | 2022-05-31 18:59:27 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-06-01 19:10:35 +0300 |
commit | 002d39b4a7a5ed7166e2acad84e0943c3def9492 (patch) | |
tree | 4307dd5161ec9779d59308a9b933e408cc2c6ca7 /include/ibm | |
parent | 62c416fb0d2f62e09d7f60754ff359ac2389e749 (diff) | |
download | bmcweb-002d39b4a7a5ed7166e2acad84e0943c3def9492.tar.xz |
Try to fix the lambda formatting issue
clang-tidy has a setting, LambdaBodyIndentation, which it says:
"For callback-heavy code, it may improve readability to have the
signature indented two levels and to use OuterScope."
bmcweb is very callback heavy code. Try to enable it and see if that
improves things. There are many cases where the length of a lambda call
will change, and reindent the entire lambda function. This is really
bad for code reviews, as it's difficult to see the lines changed. This
commit should resolve it. This does have the downside of reindenting a
lot of functions, which is unfortunate, but probably worth it in the
long run.
All changes except for the .clang-format file were made by the robot.
Tested: Code compiles, whitespace changes only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib4aa2f1391fada981febd25b67dcdb9143827f43
Diffstat (limited to 'include/ibm')
-rw-r--r-- | include/ibm/management_console_rest.hpp | 154 |
1 files changed, 75 insertions, 79 deletions
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp index 0fbd2e22c1..dd33fd4793 100644 --- a/include/ibm/management_console_rest.hpp +++ b/include/ibm/management_console_rest.hpp @@ -685,26 +685,26 @@ inline void requestRoutes(App& app) .methods(boost::beast::http::verb::get)( [](const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - asyncResp->res.jsonValue["@odata.type"] = - "#ibmServiceRoot.v1_0_0.ibmServiceRoot"; - asyncResp->res.jsonValue["@odata.id"] = "/ibm/v1/"; - asyncResp->res.jsonValue["Id"] = "IBM Rest RootService"; - asyncResp->res.jsonValue["Name"] = "IBM Service Root"; - asyncResp->res.jsonValue["ConfigFiles"]["@odata.id"] = - "/ibm/v1/Host/ConfigFiles"; - asyncResp->res.jsonValue["LockService"]["@odata.id"] = - "/ibm/v1/HMC/LockService"; - asyncResp->res.jsonValue["BroadcastService"]["@odata.id"] = - "/ibm/v1/HMC/BroadcastService"; - }); + asyncResp->res.jsonValue["@odata.type"] = + "#ibmServiceRoot.v1_0_0.ibmServiceRoot"; + asyncResp->res.jsonValue["@odata.id"] = "/ibm/v1/"; + asyncResp->res.jsonValue["Id"] = "IBM Rest RootService"; + asyncResp->res.jsonValue["Name"] = "IBM Service Root"; + asyncResp->res.jsonValue["ConfigFiles"]["@odata.id"] = + "/ibm/v1/Host/ConfigFiles"; + asyncResp->res.jsonValue["LockService"]["@odata.id"] = + "/ibm/v1/HMC/LockService"; + asyncResp->res.jsonValue["BroadcastService"]["@odata.id"] = + "/ibm/v1/HMC/BroadcastService"; + }); BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles") .privileges({{"ConfigureComponents", "ConfigureManager"}}) .methods(boost::beast::http::verb::get)( [](const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - handleConfigFileList(asyncResp); - }); + handleConfigFileList(asyncResp); + }); BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll") @@ -712,8 +712,8 @@ inline void requestRoutes(App& app) .methods(boost::beast::http::verb::post)( [](const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - deleteConfigFiles(asyncResp); - }); + deleteConfigFiles(asyncResp); + }); BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles/<str>") .privileges({{"ConfigureComponents", "ConfigureManager"}}) @@ -722,97 +722,93 @@ inline void requestRoutes(App& app) [](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& fileName) { - BMCWEB_LOG_DEBUG << "ConfigFile : " << fileName; - // Validate the incoming fileName - if (!isValidConfigFileName(fileName, asyncResp->res)) - { - asyncResp->res.result( - boost::beast::http::status::bad_request); - return; - } - handleFileUrl(req, asyncResp, fileName); - }); + BMCWEB_LOG_DEBUG << "ConfigFile : " << fileName; + // Validate the incoming fileName + if (!isValidConfigFileName(fileName, asyncResp->res)) + { + asyncResp->res.result(boost::beast::http::status::bad_request); + return; + } + handleFileUrl(req, asyncResp, fileName); + }); BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService") .privileges({{"ConfigureComponents", "ConfigureManager"}}) .methods(boost::beast::http::verb::get)( [](const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - getLockServiceData(asyncResp); - }); + getLockServiceData(asyncResp); + }); BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.AcquireLock") .privileges({{"ConfigureComponents", "ConfigureManager"}}) .methods(boost::beast::http::verb::post)( [](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - std::vector<nlohmann::json> body; - if (!redfish::json_util::readJsonAction(req, asyncResp->res, - "Request", body)) - { - BMCWEB_LOG_DEBUG << "Not a Valid JSON"; - asyncResp->res.result( - boost::beast::http::status::bad_request); - return; - } - handleAcquireLockAPI(req, asyncResp, body); - }); + std::vector<nlohmann::json> body; + if (!redfish::json_util::readJsonAction(req, asyncResp->res, "Request", + body)) + { + BMCWEB_LOG_DEBUG << "Not a Valid JSON"; + asyncResp->res.result(boost::beast::http::status::bad_request); + return; + } + handleAcquireLockAPI(req, asyncResp, body); + }); BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock") .privileges({{"ConfigureComponents", "ConfigureManager"}}) .methods(boost::beast::http::verb::post)( [](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - std::string type; - std::vector<uint32_t> listTransactionIds; - - if (!redfish::json_util::readJsonPatch( - req, asyncResp->res, "Type", type, "TransactionIDs", - listTransactionIds)) - { - asyncResp->res.result( - boost::beast::http::status::bad_request); - return; - } - if (type == "Transaction") - { - handleReleaseLockAPI(req, asyncResp, listTransactionIds); - } - else if (type == "Session") - { - handleRelaseAllAPI(req, asyncResp); - } - else - { - BMCWEB_LOG_DEBUG << " Value of Type : " << type - << "is Not a Valid key"; - redfish::messages::propertyValueNotInList(asyncResp->res, - type, "Type"); - } - }); + std::string type; + std::vector<uint32_t> listTransactionIds; + + if (!redfish::json_util::readJsonPatch(req, asyncResp->res, "Type", + type, "TransactionIDs", + listTransactionIds)) + { + asyncResp->res.result(boost::beast::http::status::bad_request); + return; + } + if (type == "Transaction") + { + handleReleaseLockAPI(req, asyncResp, listTransactionIds); + } + else if (type == "Session") + { + handleRelaseAllAPI(req, asyncResp); + } + else + { + BMCWEB_LOG_DEBUG << " Value of Type : " << type + << "is Not a Valid key"; + redfish::messages::propertyValueNotInList(asyncResp->res, type, + "Type"); + } + }); BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.GetLockList") .privileges({{"ConfigureComponents", "ConfigureManager"}}) .methods(boost::beast::http::verb::post)( [](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - ListOfSessionIds listSessionIds; - - if (!redfish::json_util::readJsonPatch( - req, asyncResp->res, "SessionIDs", listSessionIds)) - { - asyncResp->res.result( - boost::beast::http::status::bad_request); - return; - } - handleGetLockListAPI(asyncResp, listSessionIds); - }); + ListOfSessionIds listSessionIds; + + if (!redfish::json_util::readJsonPatch(req, asyncResp->res, + "SessionIDs", listSessionIds)) + { + asyncResp->res.result(boost::beast::http::status::bad_request); + return; + } + handleGetLockListAPI(asyncResp, listSessionIds); + }); BMCWEB_ROUTE(app, "/ibm/v1/HMC/BroadcastService") .privileges({{"ConfigureComponents", "ConfigureManager"}}) .methods(boost::beast::http::verb::post)( [](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - handleBroadcastService(req, asyncResp); - }); + handleBroadcastService(req, asyncResp); + }); } } // namespace ibm_mc |