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
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index c7676db..4c93b14 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -349,11 +349,10 @@
         "xyz.openbmc_project.Sensor.Value"};
 
     // Response handler for parsing objects subtree
-    auto respHandler = [callback{std::forward<Callback>(callback)},
-                        sensorsAsyncResp, sensorNames](
-                           const boost::system::error_code ec,
-                           const dbus::utility::MapperGetSubTreeResponse&
-                               subtree) {
+    auto respHandler =
+        [callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
+         sensorNames](const boost::system::error_code ec,
+                      const dbus::utility::MapperGetSubTreeResponse& subtree) {
         BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler enter";
         if (ec)
         {
@@ -544,11 +543,10 @@
     const std::array<const char*, 2> interfaces = {
         "xyz.openbmc_project.Inventory.Item.Board",
         "xyz.openbmc_project.Inventory.Item.Chassis"};
-    auto respHandler = [callback{std::forward<Callback>(callback)},
-                        sensorsAsyncResp](
-                           const boost::system::error_code ec,
-                           const dbus::utility::MapperGetSubTreePathsResponse&
-                               chassisPaths) {
+    auto respHandler =
+        [callback{std::forward<Callback>(callback)}, sensorsAsyncResp](
+            const boost::system::error_code ec,
+            const dbus::utility::MapperGetSubTreePathsResponse& chassisPaths) {
         BMCWEB_LOG_DEBUG << "getChassis respHandler enter";
         if (ec)
         {
@@ -626,21 +624,20 @@
              callback{std::forward<const Callback>(callback)}](
                 const boost::system::error_code& e,
                 const std::vector<std::string>& nodeSensorList) {
-                if (e)
+            if (e)
+            {
+                if (e.value() != EBADR)
                 {
-                    if (e.value() != EBADR)
-                    {
-                        messages::internalError(
-                            sensorsAsyncResp->asyncResp->res);
-                        return;
-                    }
+                    messages::internalError(sensorsAsyncResp->asyncResp->res);
+                    return;
                 }
-                const std::shared_ptr<boost::container::flat_set<std::string>>
-                    culledSensorList = std::make_shared<
-                        boost::container::flat_set<std::string>>();
-                reduceSensorList(sensorsAsyncResp, &nodeSensorList,
-                                 culledSensorList);
-                callback(culledSensorList);
+            }
+            const std::shared_ptr<boost::container::flat_set<std::string>>
+                culledSensorList =
+                    std::make_shared<boost::container::flat_set<std::string>>();
+            reduceSensorList(sensorsAsyncResp, &nodeSensorList,
+                             culledSensorList);
+            callback(culledSensorList);
             });
     };
 
@@ -680,11 +677,10 @@
         "org.freedesktop.DBus.ObjectManager"};
 
     // Response handler for GetSubTree DBus method
-    auto respHandler = [callback{std::forward<Callback>(callback)},
-                        sensorsAsyncResp](
-                           const boost::system::error_code ec,
-                           const dbus::utility::MapperGetSubTreeResponse&
-                               subtree) {
+    auto respHandler =
+        [callback{std::forward<Callback>(callback)}, sensorsAsyncResp](
+            const boost::system::error_code ec,
+            const dbus::utility::MapperGetSubTreeResponse& subtree) {
         BMCWEB_LOG_DEBUG << "getObjectManagerPaths respHandler enter";
         if (ec)
         {
@@ -1147,193 +1143,177 @@
         [sensorsAsyncResp](
             const boost::system::error_code ec,
             const dbus::utility::MapperGetSubTreeResponse& resp) {
-            if (ec)
+        if (ec)
+        {
+            return; // don't have to have this interface
+        }
+        for (const std::pair<
+                 std::string,
+                 std::vector<std::pair<std::string, std::vector<std::string>>>>&
+                 pathPair : resp)
+        {
+            const std::string& path = pathPair.first;
+            const std::vector<std::pair<std::string, std::vector<std::string>>>&
+                objDict = pathPair.second;
+            if (objDict.empty())
             {
-                return; // don't have to have this interface
+                continue; // this should be impossible
             }
-            for (const std::pair<std::string,
-                                 std::vector<std::pair<
-                                     std::string, std::vector<std::string>>>>&
-                     pathPair : resp)
-            {
-                const std::string& path = pathPair.first;
-                const std::vector<
-                    std::pair<std::string, std::vector<std::string>>>& objDict =
-                    pathPair.second;
-                if (objDict.empty())
+
+            const std::string& owner = objDict.begin()->first;
+            sdbusplus::asio::getProperty<std::vector<std::string>>(
+                *crow::connections::systemBus,
+                "xyz.openbmc_project.ObjectMapper", path + "/chassis",
+                "xyz.openbmc_project.Association", "endpoints",
+                [path, owner,
+                 sensorsAsyncResp](const boost::system::error_code e,
+                                   const std::vector<std::string>& endpoints) {
+                if (e)
                 {
-                    continue; // this should be impossible
+                    return; // if they don't have an association we
+                            // can't tell what chassis is
                 }
+                auto found =
+                    std::find_if(endpoints.begin(), endpoints.end(),
+                                 [sensorsAsyncResp](const std::string& entry) {
+                    return entry.find(sensorsAsyncResp->chassisId) !=
+                           std::string::npos;
+                    });
 
-                const std::string& owner = objDict.begin()->first;
-                sdbusplus::asio::getProperty<std::vector<std::string>>(
-                    *crow::connections::systemBus,
-                    "xyz.openbmc_project.ObjectMapper", path + "/chassis",
-                    "xyz.openbmc_project.Association", "endpoints",
-                    [path, owner, sensorsAsyncResp](
-                        const boost::system::error_code e,
-                        const std::vector<std::string>& endpoints) {
-                        if (e)
+                if (found == endpoints.end())
+                {
+                    return;
+                }
+                crow::connections::systemBus->async_method_call(
+                    [path, sensorsAsyncResp](
+                        const boost::system::error_code& err,
+                        const boost::container::flat_map<
+                            std::string, dbus::utility::DbusVariantType>& ret) {
+                    if (err)
+                    {
+                        return; // don't have to have this
+                                // interface
+                    }
+                    auto findFailures = ret.find("AllowedFailures");
+                    auto findCollection = ret.find("Collection");
+                    auto findStatus = ret.find("Status");
+
+                    if (findFailures == ret.end() ||
+                        findCollection == ret.end() || findStatus == ret.end())
+                    {
+                        BMCWEB_LOG_ERROR << "Invalid redundancy interface";
+                        messages::internalError(
+                            sensorsAsyncResp->asyncResp->res);
+                        return;
+                    }
+
+                    const uint8_t* allowedFailures =
+                        std::get_if<uint8_t>(&(findFailures->second));
+                    const std::vector<std::string>* collection =
+                        std::get_if<std::vector<std::string>>(
+                            &(findCollection->second));
+                    const std::string* status =
+                        std::get_if<std::string>(&(findStatus->second));
+
+                    if (allowedFailures == nullptr || collection == nullptr ||
+                        status == nullptr)
+                    {
+
+                        BMCWEB_LOG_ERROR
+                            << "Invalid redundancy interface types";
+                        messages::internalError(
+                            sensorsAsyncResp->asyncResp->res);
+                        return;
+                    }
+                    sdbusplus::message::object_path objectPath(path);
+                    std::string name = objectPath.filename();
+                    if (name.empty())
+                    {
+                        // this should be impossible
+                        messages::internalError(
+                            sensorsAsyncResp->asyncResp->res);
+                        return;
+                    }
+                    std::replace(name.begin(), name.end(), '_', ' ');
+
+                    std::string health;
+
+                    if (boost::ends_with(*status, "Full"))
+                    {
+                        health = "OK";
+                    }
+                    else if (boost::ends_with(*status, "Degraded"))
+                    {
+                        health = "Warning";
+                    }
+                    else
+                    {
+                        health = "Critical";
+                    }
+                    nlohmann::json::array_t redfishCollection;
+                    const auto& fanRedfish =
+                        sensorsAsyncResp->asyncResp->res.jsonValue["Fans"];
+                    for (const std::string& item : *collection)
+                    {
+                        sdbusplus::message::object_path path(item);
+                        std::string itemName = path.filename();
+                        if (itemName.empty())
                         {
-                            return; // if they don't have an association we
-                                    // can't tell what chassis is
+                            continue;
                         }
-                        auto found = std::find_if(
-                            endpoints.begin(), endpoints.end(),
-                            [sensorsAsyncResp](const std::string& entry) {
-                                return entry.find(
-                                           sensorsAsyncResp->chassisId) !=
-                                       std::string::npos;
+                        /*
+                        todo(ed): merge patch that fixes the names
+                        std::replace(itemName.begin(),
+                                     itemName.end(), '_', ' ');*/
+                        auto schemaItem =
+                            std::find_if(fanRedfish.begin(), fanRedfish.end(),
+                                         [itemName](const nlohmann::json& fan) {
+                            return fan["MemberId"] == itemName;
                             });
-
-                        if (found == endpoints.end())
+                        if (schemaItem != fanRedfish.end())
                         {
+                            nlohmann::json::object_t collection;
+                            collection["@odata.id"] =
+                                (*schemaItem)["@odata.id"];
+                            redfishCollection.emplace_back(
+                                std::move(collection));
+                        }
+                        else
+                        {
+                            BMCWEB_LOG_ERROR << "failed to find fan in schema";
+                            messages::internalError(
+                                sensorsAsyncResp->asyncResp->res);
                             return;
                         }
-                        crow::connections::systemBus->async_method_call(
-                            [path, sensorsAsyncResp](
-                                const boost::system::error_code& err,
-                                const boost::container::flat_map<
-                                    std::string,
-                                    dbus::utility::DbusVariantType>& ret) {
-                                if (err)
-                                {
-                                    return; // don't have to have this
-                                            // interface
-                                }
-                                auto findFailures = ret.find("AllowedFailures");
-                                auto findCollection = ret.find("Collection");
-                                auto findStatus = ret.find("Status");
+                    }
 
-                                if (findFailures == ret.end() ||
-                                    findCollection == ret.end() ||
-                                    findStatus == ret.end())
-                                {
-                                    BMCWEB_LOG_ERROR
-                                        << "Invalid redundancy interface";
-                                    messages::internalError(
-                                        sensorsAsyncResp->asyncResp->res);
-                                    return;
-                                }
+                    size_t minNumNeeded =
+                        collection->empty()
+                            ? 0
+                            : collection->size() - *allowedFailures;
+                    nlohmann::json& jResp = sensorsAsyncResp->asyncResp->res
+                                                .jsonValue["Redundancy"];
 
-                                const uint8_t* allowedFailures =
-                                    std::get_if<uint8_t>(
-                                        &(findFailures->second));
-                                const std::vector<std::string>* collection =
-                                    std::get_if<std::vector<std::string>>(
-                                        &(findCollection->second));
-                                const std::string* status =
-                                    std::get_if<std::string>(
-                                        &(findStatus->second));
+                    nlohmann::json::object_t redundancy;
+                    redundancy["@odata.id"] =
+                        "/redfish/v1/Chassis/" + sensorsAsyncResp->chassisId +
+                        "/" + sensorsAsyncResp->chassisSubNode +
+                        "#/Redundancy/" + std::to_string(jResp.size());
+                    redundancy["@odata.type"] = "#Redundancy.v1_3_2.Redundancy";
+                    redundancy["MinNumNeeded"] = minNumNeeded;
+                    redundancy["MemberId"] = name;
+                    redundancy["Mode"] = "N+m";
+                    redundancy["Name"] = name;
+                    redundancy["RedundancySet"] = redfishCollection;
+                    redundancy["Status"]["Health"] = health;
+                    redundancy["Status"]["State"] = "Enabled";
 
-                                if (allowedFailures == nullptr ||
-                                    collection == nullptr || status == nullptr)
-                                {
-
-                                    BMCWEB_LOG_ERROR
-                                        << "Invalid redundancy interface types";
-                                    messages::internalError(
-                                        sensorsAsyncResp->asyncResp->res);
-                                    return;
-                                }
-                                sdbusplus::message::object_path objectPath(
-                                    path);
-                                std::string name = objectPath.filename();
-                                if (name.empty())
-                                {
-                                    // this should be impossible
-                                    messages::internalError(
-                                        sensorsAsyncResp->asyncResp->res);
-                                    return;
-                                }
-                                std::replace(name.begin(), name.end(), '_',
-                                             ' ');
-
-                                std::string health;
-
-                                if (boost::ends_with(*status, "Full"))
-                                {
-                                    health = "OK";
-                                }
-                                else if (boost::ends_with(*status, "Degraded"))
-                                {
-                                    health = "Warning";
-                                }
-                                else
-                                {
-                                    health = "Critical";
-                                }
-                                nlohmann::json::array_t redfishCollection;
-                                const auto& fanRedfish =
-                                    sensorsAsyncResp->asyncResp->res
-                                        .jsonValue["Fans"];
-                                for (const std::string& item : *collection)
-                                {
-                                    sdbusplus::message::object_path path(item);
-                                    std::string itemName = path.filename();
-                                    if (itemName.empty())
-                                    {
-                                        continue;
-                                    }
-                                    /*
-                                    todo(ed): merge patch that fixes the names
-                                    std::replace(itemName.begin(),
-                                                 itemName.end(), '_', ' ');*/
-                                    auto schemaItem = std::find_if(
-                                        fanRedfish.begin(), fanRedfish.end(),
-                                        [itemName](const nlohmann::json& fan) {
-                                            return fan["MemberId"] == itemName;
-                                        });
-                                    if (schemaItem != fanRedfish.end())
-                                    {
-                                        nlohmann::json::object_t collection;
-                                        collection["@odata.id"] =
-                                            (*schemaItem)["@odata.id"];
-                                        redfishCollection.emplace_back(
-                                            std::move(collection));
-                                    }
-                                    else
-                                    {
-                                        BMCWEB_LOG_ERROR
-                                            << "failed to find fan in schema";
-                                        messages::internalError(
-                                            sensorsAsyncResp->asyncResp->res);
-                                        return;
-                                    }
-                                }
-
-                                size_t minNumNeeded =
-                                    collection->empty()
-                                        ? 0
-                                        : collection->size() - *allowedFailures;
-                                nlohmann::json& jResp =
-                                    sensorsAsyncResp->asyncResp->res
-                                        .jsonValue["Redundancy"];
-
-                                nlohmann::json::object_t redundancy;
-                                redundancy["@odata.id"] =
-                                    "/redfish/v1/Chassis/" +
-                                    sensorsAsyncResp->chassisId + "/" +
-                                    sensorsAsyncResp->chassisSubNode +
-                                    "#/Redundancy/" +
-                                    std::to_string(jResp.size());
-                                redundancy["@odata.type"] =
-                                    "#Redundancy.v1_3_2.Redundancy";
-                                redundancy["MinNumNeeded"] = minNumNeeded;
-                                redundancy["MemberId"] = name;
-                                redundancy["Mode"] = "N+m";
-                                redundancy["Name"] = name;
-                                redundancy["RedundancySet"] = redfishCollection;
-                                redundancy["Status"]["Health"] = health;
-                                redundancy["Status"]["State"] = "Enabled";
-
-                                jResp.push_back(std::move(redundancy));
-                            },
-                            owner, path, "org.freedesktop.DBus.Properties",
-                            "GetAll",
-                            "xyz.openbmc_project.Control.FanRedundancy");
-                    });
-            }
+                    jResp.push_back(std::move(redundancy));
+                    },
+                    owner, path, "org.freedesktop.DBus.Properties", "GetAll",
+                    "xyz.openbmc_project.Control.FanRedundancy");
+                });
+        }
         },
         "xyz.openbmc_project.ObjectMapper",
         "/xyz/openbmc_project/object_mapper",
@@ -1359,8 +1339,8 @@
         {
             std::sort(entry->begin(), entry->end(),
                       [](nlohmann::json& c1, nlohmann::json& c2) {
-                          return c1["Name"] < c2["Name"];
-                      });
+                return c1["Name"] < c2["Name"];
+            });
 
             // add the index counts to the end of each entry
             size_t count = 0;
@@ -1637,12 +1617,11 @@
         const std::string& invConnection = *it;
 
         // Response handler for GetManagedObjects
-        auto respHandler = [sensorsAsyncResp, inventoryItems, invConnections,
-                            objectMgrPaths,
-                            callback{std::forward<Callback>(callback)},
-                            invConnectionsIndex](
-                               const boost::system::error_code ec,
-                               dbus::utility::ManagedObjectType& resp) {
+        auto respHandler =
+            [sensorsAsyncResp, inventoryItems, invConnections, objectMgrPaths,
+             callback{std::forward<Callback>(callback)},
+             invConnectionsIndex](const boost::system::error_code ec,
+                                  dbus::utility::ManagedObjectType& resp) {
             BMCWEB_LOG_DEBUG << "getInventoryItemsData respHandler enter";
             if (ec)
             {
@@ -1728,11 +1707,11 @@
         "xyz.openbmc_project.State.Decorator.OperationalStatus"};
 
     // Response handler for parsing output from GetSubTree
-    auto respHandler = [callback{std::forward<Callback>(callback)},
-                        sensorsAsyncResp, inventoryItems](
-                           const boost::system::error_code ec,
-                           const dbus::utility::MapperGetSubTreeResponse&
-                               subtree) {
+    auto respHandler =
+        [callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
+         inventoryItems](
+            const boost::system::error_code ec,
+            const dbus::utility::MapperGetSubTreeResponse& subtree) {
         BMCWEB_LOG_DEBUG << "getInventoryItemsConnections respHandler enter";
         if (ec)
         {
@@ -1997,47 +1976,47 @@
             [sensorsAsyncResp, inventoryItems, ledConnections, ledPath,
              callback{std::forward<Callback>(callback)}, ledConnectionsIndex](
                 const boost::system::error_code ec, const std::string& state) {
-                BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler enter";
-                if (ec)
+            BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler enter";
+            if (ec)
+            {
+                BMCWEB_LOG_ERROR
+                    << "getInventoryLedData respHandler DBus error " << ec;
+                messages::internalError(sensorsAsyncResp->asyncResp->res);
+                return;
+            }
+
+            BMCWEB_LOG_DEBUG << "Led state: " << state;
+            // Find inventory item with this LED object path
+            InventoryItem* inventoryItem =
+                findInventoryItemForLed(*inventoryItems, ledPath);
+            if (inventoryItem != nullptr)
+            {
+                // Store LED state in InventoryItem
+                if (boost::ends_with(state, "On"))
                 {
-                    BMCWEB_LOG_ERROR
-                        << "getInventoryLedData respHandler DBus error " << ec;
-                    messages::internalError(sensorsAsyncResp->asyncResp->res);
-                    return;
+                    inventoryItem->ledState = LedState::ON;
                 }
-
-                BMCWEB_LOG_DEBUG << "Led state: " << state;
-                // Find inventory item with this LED object path
-                InventoryItem* inventoryItem =
-                    findInventoryItemForLed(*inventoryItems, ledPath);
-                if (inventoryItem != nullptr)
+                else if (boost::ends_with(state, "Blink"))
                 {
-                    // Store LED state in InventoryItem
-                    if (boost::ends_with(state, "On"))
-                    {
-                        inventoryItem->ledState = LedState::ON;
-                    }
-                    else if (boost::ends_with(state, "Blink"))
-                    {
-                        inventoryItem->ledState = LedState::BLINK;
-                    }
-                    else if (boost::ends_with(state, "Off"))
-                    {
-                        inventoryItem->ledState = LedState::OFF;
-                    }
-                    else
-                    {
-                        inventoryItem->ledState = LedState::UNKNOWN;
-                    }
+                    inventoryItem->ledState = LedState::BLINK;
                 }
+                else if (boost::ends_with(state, "Off"))
+                {
+                    inventoryItem->ledState = LedState::OFF;
+                }
+                else
+                {
+                    inventoryItem->ledState = LedState::UNKNOWN;
+                }
+            }
 
-                // Recurse to get LED data from next connection
-                getInventoryLedData(sensorsAsyncResp, inventoryItems,
-                                    ledConnections, std::move(callback),
-                                    ledConnectionsIndex + 1);
+            // Recurse to get LED data from next connection
+            getInventoryLedData(sensorsAsyncResp, inventoryItems,
+                                ledConnections, std::move(callback),
+                                ledConnectionsIndex + 1);
 
-                BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler exit";
-            };
+            BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler exit";
+        };
 
         // Get the State property for the current LED
         sdbusplus::asio::getProperty<std::string>(
@@ -2084,11 +2063,11 @@
         "xyz.openbmc_project.Led.Physical"};
 
     // Response handler for parsing output from GetSubTree
-    auto respHandler = [callback{std::forward<Callback>(callback)},
-                        sensorsAsyncResp, inventoryItems](
-                           const boost::system::error_code ec,
-                           const dbus::utility::MapperGetSubTreeResponse&
-                               subtree) {
+    auto respHandler =
+        [callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
+         inventoryItems](
+            const boost::system::error_code ec,
+            const dbus::utility::MapperGetSubTreeResponse& subtree) {
         BMCWEB_LOG_DEBUG << "getInventoryLeds respHandler enter";
         if (ec)
         {
@@ -2182,10 +2161,10 @@
     const std::string& psAttributesConnection = (*it).second;
 
     // Response handler for Get DeratingFactor property
-    auto respHandler = [sensorsAsyncResp, inventoryItems,
-                        callback{std::forward<Callback>(callback)}](
-                           const boost::system::error_code ec,
-                           const uint32_t value) {
+    auto respHandler =
+        [sensorsAsyncResp, inventoryItems,
+         callback{std::forward<Callback>(callback)}](
+            const boost::system::error_code ec, const uint32_t value) {
         BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData respHandler enter";
         if (ec)
         {
@@ -2268,53 +2247,53 @@
          inventoryItems](
             const boost::system::error_code ec,
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
-            BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler enter";
-            if (ec)
-            {
-                messages::internalError(sensorsAsyncResp->asyncResp->res);
-                BMCWEB_LOG_ERROR
-                    << "getPowerSupplyAttributes respHandler DBus error " << ec;
-                return;
-            }
-            if (subtree.empty())
-            {
-                BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
-                callback(inventoryItems);
-                return;
-            }
+        BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler enter";
+        if (ec)
+        {
+            messages::internalError(sensorsAsyncResp->asyncResp->res);
+            BMCWEB_LOG_ERROR
+                << "getPowerSupplyAttributes respHandler DBus error " << ec;
+            return;
+        }
+        if (subtree.empty())
+        {
+            BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
+            callback(inventoryItems);
+            return;
+        }
 
-            // Currently we only support 1 power supply attribute, use this for
-            // all the power supplies. Build map of object path to connection.
-            // Assume just 1 connection and 1 path for now.
-            boost::container::flat_map<std::string, std::string>
-                psAttributesConnections;
+        // Currently we only support 1 power supply attribute, use this for
+        // all the power supplies. Build map of object path to connection.
+        // Assume just 1 connection and 1 path for now.
+        boost::container::flat_map<std::string, std::string>
+            psAttributesConnections;
 
-            if (subtree[0].first.empty() || subtree[0].second.empty())
-            {
-                BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
-                callback(inventoryItems);
-                return;
-            }
+        if (subtree[0].first.empty() || subtree[0].second.empty())
+        {
+            BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+            callback(inventoryItems);
+            return;
+        }
 
-            const std::string& psAttributesPath = subtree[0].first;
-            const std::string& connection = subtree[0].second.begin()->first;
+        const std::string& psAttributesPath = subtree[0].first;
+        const std::string& connection = subtree[0].second.begin()->first;
 
-            if (connection.empty())
-            {
-                BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
-                callback(inventoryItems);
-                return;
-            }
+        if (connection.empty())
+        {
+            BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+            callback(inventoryItems);
+            return;
+        }
 
-            psAttributesConnections[psAttributesPath] = connection;
-            BMCWEB_LOG_DEBUG << "Added mapping " << psAttributesPath << " -> "
-                             << connection;
+        psAttributesConnections[psAttributesPath] = connection;
+        BMCWEB_LOG_DEBUG << "Added mapping " << psAttributesPath << " -> "
+                         << connection;
 
-            getPowerSupplyAttributesData(sensorsAsyncResp, inventoryItems,
-                                         psAttributesConnections,
-                                         std::move(callback));
-            BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler exit";
-        };
+        getPowerSupplyAttributesData(sensorsAsyncResp, inventoryItems,
+                                     psAttributesConnections,
+                                     std::move(callback));
+        BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler exit";
+    };
     // Make call to ObjectMapper to find the PowerSupplyAttributes service
     crow::connections::systemBus->async_method_call(
         std::move(respHandler), "xyz.openbmc_project.ObjectMapper",
@@ -2360,50 +2339,45 @@
         [sensorsAsyncResp, objectMgrPaths,
          callback{std::forward<Callback>(callback)}](
             std::shared_ptr<std::vector<InventoryItem>> inventoryItems) {
-            BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb enter";
-            auto getInventoryItemsConnectionsCb =
-                [sensorsAsyncResp, inventoryItems, objectMgrPaths,
-                 callback{std::forward<const Callback>(callback)}](
-                    std::shared_ptr<boost::container::flat_set<std::string>>
-                        invConnections) {
-                    BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb enter";
-                    auto getInventoryItemsDataCb =
-                        [sensorsAsyncResp, inventoryItems,
-                         callback{std::move(callback)}]() {
-                            BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb enter";
+        BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb enter";
+        auto getInventoryItemsConnectionsCb =
+            [sensorsAsyncResp, inventoryItems, objectMgrPaths,
+             callback{std::forward<const Callback>(callback)}](
+                std::shared_ptr<boost::container::flat_set<std::string>>
+                    invConnections) {
+            BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb enter";
+            auto getInventoryItemsDataCb = [sensorsAsyncResp, inventoryItems,
+                                            callback{std::move(callback)}]() {
+                BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb enter";
 
-                            auto getInventoryLedsCb = [sensorsAsyncResp,
-                                                       inventoryItems,
-                                                       callback{std::move(
-                                                           callback)}]() {
-                                BMCWEB_LOG_DEBUG << "getInventoryLedsCb enter";
-                                // Find Power Supply Attributes and get the data
-                                getPowerSupplyAttributes(sensorsAsyncResp,
-                                                         inventoryItems,
-                                                         std::move(callback));
-                                BMCWEB_LOG_DEBUG << "getInventoryLedsCb exit";
-                            };
-
-                            // Find led connections and get the data
-                            getInventoryLeds(sensorsAsyncResp, inventoryItems,
-                                             std::move(getInventoryLedsCb));
-                            BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb exit";
-                        };
-
-                    // Get inventory item data from connections
-                    getInventoryItemsData(sensorsAsyncResp, inventoryItems,
-                                          invConnections, objectMgrPaths,
-                                          std::move(getInventoryItemsDataCb));
-                    BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb exit";
+                auto getInventoryLedsCb = [sensorsAsyncResp, inventoryItems,
+                                           callback{std::move(callback)}]() {
+                    BMCWEB_LOG_DEBUG << "getInventoryLedsCb enter";
+                    // Find Power Supply Attributes and get the data
+                    getPowerSupplyAttributes(sensorsAsyncResp, inventoryItems,
+                                             std::move(callback));
+                    BMCWEB_LOG_DEBUG << "getInventoryLedsCb exit";
                 };
 
-            // Get connections that provide inventory item data
-            getInventoryItemsConnections(
-                sensorsAsyncResp, inventoryItems,
-                std::move(getInventoryItemsConnectionsCb));
-            BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb exit";
+                // Find led connections and get the data
+                getInventoryLeds(sensorsAsyncResp, inventoryItems,
+                                 std::move(getInventoryLedsCb));
+                BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb exit";
+            };
+
+            // Get inventory item data from connections
+            getInventoryItemsData(sensorsAsyncResp, inventoryItems,
+                                  invConnections, objectMgrPaths,
+                                  std::move(getInventoryItemsDataCb));
+            BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb exit";
         };
 
+        // Get connections that provide inventory item data
+        getInventoryItemsConnections(sensorsAsyncResp, inventoryItems,
+                                     std::move(getInventoryItemsConnectionsCb));
+        BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb exit";
+    };
+
     // Get associations from sensors to inventory items
     getInventoryItemAssociations(sensorsAsyncResp, sensorNames, objectMgrPaths,
                                  std::move(getInventoryItemAssociationsCb));
@@ -2507,10 +2481,10 @@
     for (const std::string& connection : connections)
     {
         // Response handler to process managed objects
-        auto getManagedObjectsCb = [sensorsAsyncResp, sensorNames,
-                                    inventoryItems](
-                                       const boost::system::error_code ec,
-                                       dbus::utility::ManagedObjectType& resp) {
+        auto getManagedObjectsCb =
+            [sensorsAsyncResp, sensorNames,
+             inventoryItems](const boost::system::error_code ec,
+                             dbus::utility::ManagedObjectType& resp) {
             BMCWEB_LOG_DEBUG << "getManagedObjectsCb enter";
             if (ec)
             {
@@ -2712,40 +2686,37 @@
     auto getConnectionCb =
         [sensorsAsyncResp, sensorNames](
             const boost::container::flat_set<std::string>& connections) {
-            BMCWEB_LOG_DEBUG << "getConnectionCb enter";
-            auto getObjectManagerPathsCb =
-                [sensorsAsyncResp, sensorNames,
-                 connections](const std::shared_ptr<boost::container::flat_map<
-                                  std::string, std::string>>& objectMgrPaths) {
-                    BMCWEB_LOG_DEBUG << "getObjectManagerPathsCb enter";
-                    auto getInventoryItemsCb =
-                        [sensorsAsyncResp, sensorNames, connections,
-                         objectMgrPaths](
-                            const std::shared_ptr<std::vector<InventoryItem>>&
-                                inventoryItems) {
-                            BMCWEB_LOG_DEBUG << "getInventoryItemsCb enter";
-                            // Get sensor data and store results in JSON
-                            getSensorData(sensorsAsyncResp, sensorNames,
-                                          connections, objectMgrPaths,
-                                          inventoryItems);
-                            BMCWEB_LOG_DEBUG << "getInventoryItemsCb exit";
-                        };
+        BMCWEB_LOG_DEBUG << "getConnectionCb enter";
+        auto getObjectManagerPathsCb =
+            [sensorsAsyncResp, sensorNames,
+             connections](const std::shared_ptr<boost::container::flat_map<
+                              std::string, std::string>>& objectMgrPaths) {
+            BMCWEB_LOG_DEBUG << "getObjectManagerPathsCb enter";
+            auto getInventoryItemsCb =
+                [sensorsAsyncResp, sensorNames, connections, objectMgrPaths](
+                    const std::shared_ptr<std::vector<InventoryItem>>&
+                        inventoryItems) {
+                BMCWEB_LOG_DEBUG << "getInventoryItemsCb enter";
+                // Get sensor data and store results in JSON
+                getSensorData(sensorsAsyncResp, sensorNames, connections,
+                              objectMgrPaths, inventoryItems);
+                BMCWEB_LOG_DEBUG << "getInventoryItemsCb exit";
+            };
 
-                    // Get inventory items associated with sensors
-                    getInventoryItems(sensorsAsyncResp, sensorNames,
-                                      objectMgrPaths,
-                                      std::move(getInventoryItemsCb));
+            // Get inventory items associated with sensors
+            getInventoryItems(sensorsAsyncResp, sensorNames, objectMgrPaths,
+                              std::move(getInventoryItemsCb));
 
-                    BMCWEB_LOG_DEBUG << "getObjectManagerPathsCb exit";
-                };
-
-            // Get mapping from connection names to the DBus object
-            // paths that implement the ObjectManager interface
-            getObjectManagerPaths(sensorsAsyncResp,
-                                  std::move(getObjectManagerPathsCb));
-            BMCWEB_LOG_DEBUG << "getConnectionCb exit";
+            BMCWEB_LOG_DEBUG << "getObjectManagerPathsCb exit";
         };
 
+        // Get mapping from connection names to the DBus object
+        // paths that implement the ObjectManager interface
+        getObjectManagerPaths(sensorsAsyncResp,
+                              std::move(getObjectManagerPathsCb));
+        BMCWEB_LOG_DEBUG << "getConnectionCb exit";
+    };
+
     // Get set of connections that provide sensor values
     getConnections(sensorsAsyncResp, sensorNames, std::move(getConnectionCb));
 }
@@ -2763,10 +2734,10 @@
         [sensorsAsyncResp](
             const std::shared_ptr<boost::container::flat_set<std::string>>&
                 sensorNames) {
-            BMCWEB_LOG_DEBUG << "getChassisCb enter";
-            processSensorList(sensorsAsyncResp, sensorNames);
-            BMCWEB_LOG_DEBUG << "getChassisCb exit";
-        };
+        BMCWEB_LOG_DEBUG << "getChassisCb enter";
+        processSensorList(sensorsAsyncResp, sensorNames);
+        BMCWEB_LOG_DEBUG << "getChassisCb exit";
+    };
     // SensorCollection doesn't contain the Redundancy property
     if (sensorsAsyncResp->chassisSubNode != sensors::node::sensors)
     {
@@ -2855,10 +2826,10 @@
         }
     }
 
-    auto getChassisSensorListCb = [sensorAsyncResp, overrideMap](
-                                      const std::shared_ptr<
-                                          boost::container::flat_set<
-                                              std::string>>& sensorsList) {
+    auto getChassisSensorListCb =
+        [sensorAsyncResp, overrideMap](
+            const std::shared_ptr<boost::container::flat_set<std::string>>&
+                sensorsList) {
         // Match sensor names in the PATCH request to those managed by the
         // chassis node
         const std::shared_ptr<boost::container::flat_set<std::string>>
@@ -2877,12 +2848,11 @@
             }
         }
         // Get the connection to which the memberId belongs
-        auto getObjectsWithConnectionCb = [sensorAsyncResp, overrideMap](
-                                              const boost::container::flat_set<
-                                                  std::string>& /*connections*/,
-                                              const std::set<std::pair<
-                                                  std::string, std::string>>&
-                                                  objectsWithConnection) {
+        auto getObjectsWithConnectionCb =
+            [sensorAsyncResp, overrideMap](
+                const boost::container::flat_set<std::string>& /*connections*/,
+                const std::set<std::pair<std::string, std::string>>&
+                    objectsWithConnection) {
             if (objectsWithConnection.size() != overrideMap.size())
             {
                 BMCWEB_LOG_INFO
@@ -2917,24 +2887,24 @@
                 }
                 crow::connections::systemBus->async_method_call(
                     [sensorAsyncResp](const boost::system::error_code ec) {
-                        if (ec)
+                    if (ec)
+                    {
+                        if (ec.value() ==
+                            boost::system::errc::permission_denied)
                         {
-                            if (ec.value() ==
-                                boost::system::errc::permission_denied)
-                            {
-                                BMCWEB_LOG_WARNING
-                                    << "Manufacturing mode is not Enabled...can't "
-                                       "Override the sensor value. ";
+                            BMCWEB_LOG_WARNING
+                                << "Manufacturing mode is not Enabled...can't "
+                                   "Override the sensor value. ";
 
-                                messages::insufficientPrivilege(
-                                    sensorAsyncResp->asyncResp->res);
-                                return;
-                            }
-                            BMCWEB_LOG_DEBUG
-                                << "setOverrideValueStatus DBUS error: " << ec;
-                            messages::internalError(
+                            messages::insufficientPrivilege(
                                 sensorAsyncResp->asyncResp->res);
+                            return;
                         }
+                        BMCWEB_LOG_DEBUG
+                            << "setOverrideValueStatus DBUS error: " << ec;
+                        messages::internalError(
+                            sensorAsyncResp->asyncResp->res);
+                    }
                     },
                     item.second, item.first, "org.freedesktop.DBus.Properties",
                     "Set", "xyz.openbmc_project.Sensor.Value", "Value",
@@ -3027,47 +2997,45 @@
 {
     BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/Sensors/")
         .privileges(redfish::privileges::getSensorCollection)
-        .methods(
-            boost::beast::http::verb::get)([&app](
-                                               const crow::Request& req,
-                                               const std::shared_ptr<
-                                                   bmcweb::AsyncResp>& aResp,
-                                               const std::string& chassisId) {
-            query_param::QueryCapabilities capabilities = {
-                .canDelegateExpandLevel = 1,
-            };
-            query_param::Query delegatedQuery;
-            if (!redfish::setUpRedfishRouteWithDelegation(
-                    app, req, aResp->res, delegatedQuery, capabilities))
-            {
-                return;
-            }
+        .methods(boost::beast::http::verb::get)(
+            [&app](const crow::Request& req,
+                   const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+                   const std::string& chassisId) {
+        query_param::QueryCapabilities capabilities = {
+            .canDelegateExpandLevel = 1,
+        };
+        query_param::Query delegatedQuery;
+        if (!redfish::setUpRedfishRouteWithDelegation(
+                app, req, aResp->res, delegatedQuery, capabilities))
+        {
+            return;
+        }
 
-            if (delegatedQuery.expandType != query_param::ExpandType::None)
-            {
-                // we perform efficient expand.
-                auto asyncResp = std::make_shared<SensorsAsyncResp>(
-                    aResp, chassisId, sensors::dbus::sensorPaths,
-                    sensors::node::sensors,
-                    /*efficientExpand=*/true);
-                getChassisData(asyncResp);
-
-                BMCWEB_LOG_DEBUG
-                    << "SensorCollection doGet exit via efficient expand handler";
-                return;
-            };
-
-            // if there's no efficient expand available, we use the default
-            // Query Parameters route
+        if (delegatedQuery.expandType != query_param::ExpandType::None)
+        {
+            // we perform efficient expand.
             auto asyncResp = std::make_shared<SensorsAsyncResp>(
                 aResp, chassisId, sensors::dbus::sensorPaths,
-                sensors::node::sensors);
+                sensors::node::sensors,
+                /*efficientExpand=*/true);
+            getChassisData(asyncResp);
 
-            // We get all sensors as hyperlinkes in the chassis (this
-            // implies we reply on the default query parameters handler)
-            getChassis(asyncResp,
-                       std::bind_front(sensors::getChassisCallback, asyncResp));
-            BMCWEB_LOG_DEBUG << "SensorCollection doGet exit";
+            BMCWEB_LOG_DEBUG
+                << "SensorCollection doGet exit via efficient expand handler";
+            return;
+        };
+
+        // if there's no efficient expand available, we use the default
+        // Query Parameters route
+        auto asyncResp = std::make_shared<SensorsAsyncResp>(
+            aResp, chassisId, sensors::dbus::sensorPaths,
+            sensors::node::sensors);
+
+        // We get all sensors as hyperlinkes in the chassis (this
+        // implies we reply on the default query parameters handler)
+        getChassis(asyncResp,
+                   std::bind_front(sensors::getChassisCallback, asyncResp));
+        BMCWEB_LOG_DEBUG << "SensorCollection doGet exit";
         });
 }
 
@@ -3075,89 +3043,83 @@
 {
     BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/Sensors/<str>/")
         .privileges(redfish::privileges::getSensor)
-        .methods(
-            boost::beast::http::verb::get)([&app](
-                                               const crow::Request& req,
-                                               const std::shared_ptr<
-                                                   bmcweb::AsyncResp>& aResp,
-                                               const std::string& chassisId,
-                                               const std::string& sensorName) {
-            if (!redfish::setUpRedfishRoute(app, req, aResp->res))
+        .methods(boost::beast::http::verb::get)(
+            [&app](const crow::Request& req,
+                   const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+                   const std::string& chassisId,
+                   const std::string& sensorName) {
+        if (!redfish::setUpRedfishRoute(app, req, aResp->res))
+        {
+            return;
+        }
+        BMCWEB_LOG_DEBUG << "Sensor doGet enter";
+        std::shared_ptr<SensorsAsyncResp> asyncResp =
+            std::make_shared<SensorsAsyncResp>(aResp, chassisId,
+                                               std::span<std::string_view>(),
+                                               sensors::node::sensors);
+
+        const std::array<const char*, 1> interfaces = {
+            "xyz.openbmc_project.Sensor.Value"};
+
+        // Get a list of all of the sensors that implement Sensor.Value
+        // and get the path and service name associated with the sensor
+        crow::connections::systemBus->async_method_call(
+            [asyncResp, sensorName](
+                const boost::system::error_code ec,
+                const dbus::utility::MapperGetSubTreeResponse& subtree) {
+            BMCWEB_LOG_DEBUG << "respHandler1 enter";
+            if (ec)
             {
+                messages::internalError(asyncResp->asyncResp->res);
+                BMCWEB_LOG_ERROR << "Sensor getSensorPaths resp_handler: "
+                                 << "Dbus error " << ec;
                 return;
             }
-            BMCWEB_LOG_DEBUG << "Sensor doGet enter";
-            std::shared_ptr<SensorsAsyncResp> asyncResp =
-                std::make_shared<SensorsAsyncResp>(
-                    aResp, chassisId, std::span<std::string_view>(),
-                    sensors::node::sensors);
 
-            const std::array<const char*, 1> interfaces = {
-                "xyz.openbmc_project.Sensor.Value"};
+            dbus::utility::MapperGetSubTreeResponse::const_iterator it =
+                std::find_if(
+                    subtree.begin(), subtree.end(),
+                    [sensorName](
+                        const std::pair<
+                            std::string,
+                            std::vector<std::pair<std::string,
+                                                  std::vector<std::string>>>>&
+                            object) {
+                sdbusplus::message::object_path path(object.first);
+                std::string name = path.filename();
+                if (name.empty())
+                {
+                    BMCWEB_LOG_ERROR << "Invalid sensor path: " << object.first;
+                    return false;
+                }
 
-            // Get a list of all of the sensors that implement Sensor.Value
-            // and get the path and service name associated with the sensor
-            crow::connections::systemBus->async_method_call(
-                [asyncResp, sensorName](
-                    const boost::system::error_code ec,
-                    const dbus::utility::MapperGetSubTreeResponse& subtree) {
-                    BMCWEB_LOG_DEBUG << "respHandler1 enter";
-                    if (ec)
-                    {
-                        messages::internalError(asyncResp->asyncResp->res);
-                        BMCWEB_LOG_ERROR
-                            << "Sensor getSensorPaths resp_handler: "
-                            << "Dbus error " << ec;
-                        return;
-                    }
+                return name == sensorName;
+                    });
 
-                    dbus::utility::MapperGetSubTreeResponse::const_iterator it =
-                        std::find_if(
-                            subtree.begin(), subtree.end(),
-                            [sensorName](
-                                const std::pair<std::string,
-                                                std::vector<std::pair<
-                                                    std::string,
-                                                    std::vector<std::string>>>>&
-                                    object) {
-                                sdbusplus::message::object_path path(
-                                    object.first);
-                                std::string name = path.filename();
-                                if (name.empty())
-                                {
-                                    BMCWEB_LOG_ERROR << "Invalid sensor path: "
-                                                     << object.first;
-                                    return false;
-                                }
+            if (it == subtree.end())
+            {
+                BMCWEB_LOG_ERROR << "Could not find path for sensor: "
+                                 << sensorName;
+                messages::resourceNotFound(asyncResp->asyncResp->res, "Sensor",
+                                           sensorName);
+                return;
+            }
+            std::string_view sensorPath = (*it).first;
+            BMCWEB_LOG_DEBUG << "Found sensor path for sensor '" << sensorName
+                             << "': " << sensorPath;
 
-                                return name == sensorName;
-                            });
+            const std::shared_ptr<boost::container::flat_set<std::string>>
+                sensorList =
+                    std::make_shared<boost::container::flat_set<std::string>>();
 
-                    if (it == subtree.end())
-                    {
-                        BMCWEB_LOG_ERROR << "Could not find path for sensor: "
-                                         << sensorName;
-                        messages::resourceNotFound(asyncResp->asyncResp->res,
-                                                   "Sensor", sensorName);
-                        return;
-                    }
-                    std::string_view sensorPath = (*it).first;
-                    BMCWEB_LOG_DEBUG << "Found sensor path for sensor '"
-                                     << sensorName << "': " << sensorPath;
-
-                    const std::shared_ptr<
-                        boost::container::flat_set<std::string>>
-                        sensorList = std::make_shared<
-                            boost::container::flat_set<std::string>>();
-
-                    sensorList->emplace(sensorPath);
-                    processSensorList(asyncResp, sensorList);
-                    BMCWEB_LOG_DEBUG << "respHandler1 exit";
-                },
-                "xyz.openbmc_project.ObjectMapper",
-                "/xyz/openbmc_project/object_mapper",
-                "xyz.openbmc_project.ObjectMapper", "GetSubTree",
-                "/xyz/openbmc_project/sensors", 2, interfaces);
+            sensorList->emplace(sensorPath);
+            processSensorList(asyncResp, sensorList);
+            BMCWEB_LOG_DEBUG << "respHandler1 exit";
+            },
+            "xyz.openbmc_project.ObjectMapper",
+            "/xyz/openbmc_project/object_mapper",
+            "xyz.openbmc_project.ObjectMapper", "GetSubTree",
+            "/xyz/openbmc_project/sensors", 2, interfaces);
         });
 }