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/task.hpp b/redfish-core/lib/task.hpp
index 0c2eee4..fc334a9 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -169,26 +169,26 @@
         timer.expires_after(timeout);
         timer.async_wait(
             [self = shared_from_this()](boost::system::error_code ec) {
-                if (ec == boost::asio::error::operation_aborted)
-                {
-                    return; // completed successfully
-                }
-                if (!ec)
-                {
-                    // change ec to error as timer expired
-                    ec = boost::asio::error::operation_aborted;
-                }
-                self->match.reset();
-                sdbusplus::message::message msg;
-                self->finishTask();
-                self->state = "Cancelled";
-                self->status = "Warning";
-                self->messages.emplace_back(
-                    messages::taskAborted(std::to_string(self->index)));
-                // Send event :TaskAborted
-                self->sendTaskEvent(self->state, self->index);
-                self->callback(ec, msg, self);
-            });
+            if (ec == boost::asio::error::operation_aborted)
+            {
+                return; // completed successfully
+            }
+            if (!ec)
+            {
+                // change ec to error as timer expired
+                ec = boost::asio::error::operation_aborted;
+            }
+            self->match.reset();
+            sdbusplus::message::message msg;
+            self->finishTask();
+            self->state = "Cancelled";
+            self->status = "Warning";
+            self->messages.emplace_back(
+                messages::taskAborted(std::to_string(self->index)));
+            // Send event :TaskAborted
+            self->sendTaskEvent(self->state, self->index);
+            self->callback(ec, msg, self);
+        });
     }
 
     static void sendTaskEvent(const std::string_view state, size_t index)
@@ -272,24 +272,24 @@
             static_cast<sdbusplus::bus::bus&>(*crow::connections::systemBus),
             matchStr,
             [self = shared_from_this()](sdbusplus::message::message& message) {
-                boost::system::error_code ec;
+            boost::system::error_code ec;
 
-                // callback to return True if callback is done, callback needs
-                // to update status itself if needed
-                if (self->callback(ec, message, self) == task::completed)
-                {
-                    self->timer.cancel();
-                    self->finishTask();
+            // callback to return True if callback is done, callback needs
+            // to update status itself if needed
+            if (self->callback(ec, message, self) == task::completed)
+            {
+                self->timer.cancel();
+                self->finishTask();
 
-                    // Send event
-                    self->sendTaskEvent(self->state, self->index);
+                // Send event
+                self->sendTaskEvent(self->state, self->index);
 
-                    // reset the match after the callback was successful
-                    boost::asio::post(
-                        crow::connections::systemBus->get_io_context(),
-                        [self] { self->match.reset(); });
-                    return;
-                }
+                // reset the match after the callback was successful
+                boost::asio::post(
+                    crow::connections::systemBus->get_io_context(),
+                    [self] { self->match.reset(); });
+                return;
+            }
             });
 
         extendTimer(timeout);
@@ -325,39 +325,37 @@
             [&app](const crow::Request& req,
                    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                    const std::string& strParam) {
-                if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
-                {
-                    return;
-                }
-                auto find = std::find_if(
-                    task::tasks.begin(), task::tasks.end(),
-                    [&strParam](const std::shared_ptr<task::TaskData>& task) {
-                        if (!task)
-                        {
-                            return false;
-                        }
+        if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+        {
+            return;
+        }
+        auto find = std::find_if(
+            task::tasks.begin(), task::tasks.end(),
+            [&strParam](const std::shared_ptr<task::TaskData>& task) {
+            if (!task)
+            {
+                return false;
+            }
 
-                        // we compare against the string version as on failure
-                        // strtoul returns 0
-                        return std::to_string(task->index) == strParam;
-                    });
-
-                if (find == task::tasks.end())
-                {
-                    messages::resourceNotFound(asyncResp->res, "Monitor",
-                                               strParam);
-                    return;
-                }
-                std::shared_ptr<task::TaskData>& ptr = *find;
-                // monitor expires after 204
-                if (ptr->gave204)
-                {
-                    messages::resourceNotFound(asyncResp->res, "Monitor",
-                                               strParam);
-                    return;
-                }
-                ptr->populateResp(asyncResp->res);
+            // we compare against the string version as on failure
+            // strtoul returns 0
+            return std::to_string(task->index) == strParam;
             });
+
+        if (find == task::tasks.end())
+        {
+            messages::resourceNotFound(asyncResp->res, "Monitor", strParam);
+            return;
+        }
+        std::shared_ptr<task::TaskData>& ptr = *find;
+        // monitor expires after 204
+        if (ptr->gave204)
+        {
+            messages::resourceNotFound(asyncResp->res, "Monitor", strParam);
+            return;
+        }
+        ptr->populateResp(asyncResp->res);
+        });
 }
 
 inline void requestRoutesTask(App& app)
@@ -368,70 +366,63 @@
             [&app](const crow::Request& req,
                    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                    const std::string& strParam) {
-                if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
-                {
-                    return;
-                }
-                auto find = std::find_if(
-                    task::tasks.begin(), task::tasks.end(),
-                    [&strParam](const std::shared_ptr<task::TaskData>& task) {
-                        if (!task)
-                        {
-                            return false;
-                        }
+        if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+        {
+            return;
+        }
+        auto find = std::find_if(
+            task::tasks.begin(), task::tasks.end(),
+            [&strParam](const std::shared_ptr<task::TaskData>& task) {
+            if (!task)
+            {
+                return false;
+            }
 
-                        // we compare against the string version as on failure
-                        // strtoul returns 0
-                        return std::to_string(task->index) == strParam;
-                    });
-
-                if (find == task::tasks.end())
-                {
-                    messages::resourceNotFound(asyncResp->res, "Tasks",
-                                               strParam);
-                    return;
-                }
-
-                std::shared_ptr<task::TaskData>& ptr = *find;
-
-                asyncResp->res.jsonValue["@odata.type"] = "#Task.v1_4_3.Task";
-                asyncResp->res.jsonValue["Id"] = strParam;
-                asyncResp->res.jsonValue["Name"] = "Task " + strParam;
-                asyncResp->res.jsonValue["TaskState"] = ptr->state;
-                asyncResp->res.jsonValue["StartTime"] =
-                    crow::utility::getDateTimeStdtime(ptr->startTime);
-                if (ptr->endTime)
-                {
-                    asyncResp->res.jsonValue["EndTime"] =
-                        crow::utility::getDateTimeStdtime(*(ptr->endTime));
-                }
-                asyncResp->res.jsonValue["TaskStatus"] = ptr->status;
-                asyncResp->res.jsonValue["Messages"] = ptr->messages;
-                asyncResp->res.jsonValue["@odata.id"] =
-                    "/redfish/v1/TaskService/Tasks/" + strParam;
-                if (!ptr->gave204)
-                {
-                    asyncResp->res.jsonValue["TaskMonitor"] =
-                        "/redfish/v1/TaskService/Tasks/" + strParam +
-                        "/Monitor";
-                }
-                if (ptr->payload)
-                {
-                    const task::Payload& p = *(ptr->payload);
-                    asyncResp->res.jsonValue["Payload"]["TargetUri"] =
-                        p.targetUri;
-                    asyncResp->res.jsonValue["Payload"]["HttpOperation"] =
-                        p.httpOperation;
-                    asyncResp->res.jsonValue["Payload"]["HttpHeaders"] =
-                        p.httpHeaders;
-                    asyncResp->res.jsonValue["Payload"]["JsonBody"] =
-                        p.jsonBody.dump(
-                            2, ' ', true,
-                            nlohmann::json::error_handler_t::replace);
-                }
-                asyncResp->res.jsonValue["PercentComplete"] =
-                    ptr->percentComplete;
+            // we compare against the string version as on failure
+            // strtoul returns 0
+            return std::to_string(task->index) == strParam;
             });
+
+        if (find == task::tasks.end())
+        {
+            messages::resourceNotFound(asyncResp->res, "Tasks", strParam);
+            return;
+        }
+
+        std::shared_ptr<task::TaskData>& ptr = *find;
+
+        asyncResp->res.jsonValue["@odata.type"] = "#Task.v1_4_3.Task";
+        asyncResp->res.jsonValue["Id"] = strParam;
+        asyncResp->res.jsonValue["Name"] = "Task " + strParam;
+        asyncResp->res.jsonValue["TaskState"] = ptr->state;
+        asyncResp->res.jsonValue["StartTime"] =
+            crow::utility::getDateTimeStdtime(ptr->startTime);
+        if (ptr->endTime)
+        {
+            asyncResp->res.jsonValue["EndTime"] =
+                crow::utility::getDateTimeStdtime(*(ptr->endTime));
+        }
+        asyncResp->res.jsonValue["TaskStatus"] = ptr->status;
+        asyncResp->res.jsonValue["Messages"] = ptr->messages;
+        asyncResp->res.jsonValue["@odata.id"] =
+            "/redfish/v1/TaskService/Tasks/" + strParam;
+        if (!ptr->gave204)
+        {
+            asyncResp->res.jsonValue["TaskMonitor"] =
+                "/redfish/v1/TaskService/Tasks/" + strParam + "/Monitor";
+        }
+        if (ptr->payload)
+        {
+            const task::Payload& p = *(ptr->payload);
+            asyncResp->res.jsonValue["Payload"]["TargetUri"] = p.targetUri;
+            asyncResp->res.jsonValue["Payload"]["HttpOperation"] =
+                p.httpOperation;
+            asyncResp->res.jsonValue["Payload"]["HttpHeaders"] = p.httpHeaders;
+            asyncResp->res.jsonValue["Payload"]["JsonBody"] = p.jsonBody.dump(
+                2, ' ', true, nlohmann::json::error_handler_t::replace);
+        }
+        asyncResp->res.jsonValue["PercentComplete"] = ptr->percentComplete;
+        });
 }
 
 inline void requestRoutesTaskCollection(App& app)
@@ -441,31 +432,29 @@
         .methods(boost::beast::http::verb::get)(
             [&app](const crow::Request& req,
                    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
-                if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
-                {
-                    return;
-                }
-                asyncResp->res.jsonValue["@odata.type"] =
-                    "#TaskCollection.TaskCollection";
-                asyncResp->res.jsonValue["@odata.id"] =
-                    "/redfish/v1/TaskService/Tasks";
-                asyncResp->res.jsonValue["Name"] = "Task Collection";
-                asyncResp->res.jsonValue["Members@odata.count"] =
-                    task::tasks.size();
-                nlohmann::json& members = asyncResp->res.jsonValue["Members"];
-                members = nlohmann::json::array();
+        if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+        {
+            return;
+        }
+        asyncResp->res.jsonValue["@odata.type"] =
+            "#TaskCollection.TaskCollection";
+        asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/TaskService/Tasks";
+        asyncResp->res.jsonValue["Name"] = "Task Collection";
+        asyncResp->res.jsonValue["Members@odata.count"] = task::tasks.size();
+        nlohmann::json& members = asyncResp->res.jsonValue["Members"];
+        members = nlohmann::json::array();
 
-                for (const std::shared_ptr<task::TaskData>& task : task::tasks)
-                {
-                    if (task == nullptr)
-                    {
-                        continue; // shouldn't be possible
-                    }
-                    members.emplace_back(nlohmann::json{
-                        {"@odata.id", "/redfish/v1/TaskService/Tasks/" +
-                                          std::to_string(task->index)}});
-                }
-            });
+        for (const std::shared_ptr<task::TaskData>& task : task::tasks)
+        {
+            if (task == nullptr)
+            {
+                continue; // shouldn't be possible
+            }
+            members.emplace_back(
+                nlohmann::json{{"@odata.id", "/redfish/v1/TaskService/Tasks/" +
+                                                 std::to_string(task->index)}});
+        }
+        });
 }
 
 inline void requestRoutesTaskService(App& app)
@@ -475,31 +464,28 @@
         .methods(boost::beast::http::verb::get)(
             [&app](const crow::Request& req,
                    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
-                if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
-                {
-                    return;
-                }
-                asyncResp->res.jsonValue["@odata.type"] =
-                    "#TaskService.v1_1_4.TaskService";
-                asyncResp->res.jsonValue["@odata.id"] =
-                    "/redfish/v1/TaskService";
-                asyncResp->res.jsonValue["Name"] = "Task Service";
-                asyncResp->res.jsonValue["Id"] = "TaskService";
-                asyncResp->res.jsonValue["DateTime"] =
-                    crow::utility::getDateTimeOffsetNow().first;
-                asyncResp->res.jsonValue["CompletedTaskOverWritePolicy"] =
-                    "Oldest";
+        if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+        {
+            return;
+        }
+        asyncResp->res.jsonValue["@odata.type"] =
+            "#TaskService.v1_1_4.TaskService";
+        asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/TaskService";
+        asyncResp->res.jsonValue["Name"] = "Task Service";
+        asyncResp->res.jsonValue["Id"] = "TaskService";
+        asyncResp->res.jsonValue["DateTime"] =
+            crow::utility::getDateTimeOffsetNow().first;
+        asyncResp->res.jsonValue["CompletedTaskOverWritePolicy"] = "Oldest";
 
-                asyncResp->res.jsonValue["LifeCycleEventOnTaskStateChange"] =
-                    true;
+        asyncResp->res.jsonValue["LifeCycleEventOnTaskStateChange"] = true;
 
-                auto health = std::make_shared<HealthPopulate>(asyncResp);
-                health->populate();
-                asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
-                asyncResp->res.jsonValue["ServiceEnabled"] = true;
-                asyncResp->res.jsonValue["Tasks"]["@odata.id"] =
-                    "/redfish/v1/TaskService/Tasks";
-            });
+        auto health = std::make_shared<HealthPopulate>(asyncResp);
+        health->populate();
+        asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+        asyncResp->res.jsonValue["ServiceEnabled"] = true;
+        asyncResp->res.jsonValue["Tasks"]["@odata.id"] =
+            "/redfish/v1/TaskService/Tasks";
+        });
 }
 
 } // namespace redfish