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 /redfish-core/lib/thermal.hpp | |
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 'redfish-core/lib/thermal.hpp')
-rw-r--r-- | redfish-core/lib/thermal.hpp | 90 |
1 files changed, 44 insertions, 46 deletions
diff --git a/redfish-core/lib/thermal.hpp b/redfish-core/lib/thermal.hpp index e58e86fa4b..021134b8d4 100644 --- a/redfish-core/lib/thermal.hpp +++ b/redfish-core/lib/thermal.hpp @@ -32,18 +32,18 @@ inline void requestRoutesThermal(App& app) [&app](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& chassisName) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp->res)) - { - return; - } + if (!redfish::setUpRedfishRoute(app, req, asyncResp->res)) + { + return; + } - auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>( - asyncResp, chassisName, sensors::dbus::thermalPaths, - sensors::node::thermal); + auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>( + asyncResp, chassisName, sensors::dbus::thermalPaths, + sensors::node::thermal); - // TODO Need to get Chassis Redundancy information. - getChassisData(sensorAsyncResp); - }); + // TODO Need to get Chassis Redundancy information. + getChassisData(sensorAsyncResp); + }); BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/Thermal/") .privileges(redfish::privileges::patchThermal) @@ -51,45 +51,43 @@ inline void requestRoutesThermal(App& app) [&app](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& chassisName) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp->res)) - { - return; - } + if (!redfish::setUpRedfishRoute(app, req, asyncResp->res)) + { + return; + } - std::optional<std::vector<nlohmann::json>> - temperatureCollections; - std::optional<std::vector<nlohmann::json>> fanCollections; - std::unordered_map<std::string, std::vector<nlohmann::json>> - allCollections; + std::optional<std::vector<nlohmann::json>> temperatureCollections; + std::optional<std::vector<nlohmann::json>> fanCollections; + std::unordered_map<std::string, std::vector<nlohmann::json>> + allCollections; - auto sensorsAsyncResp = std::make_shared<SensorsAsyncResp>( - asyncResp, chassisName, sensors::dbus::thermalPaths, - sensors::node::thermal); + auto sensorsAsyncResp = std::make_shared<SensorsAsyncResp>( + asyncResp, chassisName, sensors::dbus::thermalPaths, + sensors::node::thermal); - if (!json_util::readJsonPatch( - req, sensorsAsyncResp->asyncResp->res, "Temperatures", - temperatureCollections, "Fans", fanCollections)) - { - return; - } - if (!temperatureCollections && !fanCollections) - { - messages::resourceNotFound(sensorsAsyncResp->asyncResp->res, - "Thermal", - "Temperatures / Voltages"); - return; - } - if (temperatureCollections) - { - allCollections.emplace("Temperatures", - *std::move(temperatureCollections)); - } - if (fanCollections) - { - allCollections.emplace("Fans", *std::move(fanCollections)); - } - setSensorsOverride(sensorsAsyncResp, allCollections); - }); + if (!json_util::readJsonPatch(req, sensorsAsyncResp->asyncResp->res, + "Temperatures", temperatureCollections, + "Fans", fanCollections)) + { + return; + } + if (!temperatureCollections && !fanCollections) + { + messages::resourceNotFound(sensorsAsyncResp->asyncResp->res, + "Thermal", "Temperatures / Voltages"); + return; + } + if (temperatureCollections) + { + allCollections.emplace("Temperatures", + *std::move(temperatureCollections)); + } + if (fanCollections) + { + allCollections.emplace("Fans", *std::move(fanCollections)); + } + setSensorsOverride(sensorsAsyncResp, allCollections); + }); } } // namespace redfish |