From b5da61931f4572102aa2c5a64f4e8ad897e7c91a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:28:17 +0000 Subject: [PATCH] style: clang-tidy auto fixes (#1749) Fixes #1748. --- src/etlng/impl/GrpcSource.cpp | 4 +--- src/web/ng/Server.cpp | 1 - src/web/ng/SubscriptionContext.cpp | 1 - src/web/ng/impl/ConnectionHandler.cpp | 4 ---- tests/common/util/TestHttpClient.cpp | 1 - tests/unit/etlng/GrpcSourceTests.cpp | 7 +++---- tests/unit/web/impl/ErrorHandlingTests.cpp | 18 ++++++++---------- tests/unit/web/ng/RPCServerHandlerTests.cpp | 4 ++-- tests/unit/web/ng/SubscriptionContextTests.cpp | 2 +- tests/unit/web/ng/impl/ErrorHandlingTests.cpp | 7 +++---- tests/unit/web/ng/impl/HttpConnectionTests.cpp | 1 - .../unit/web/ng/impl/ServerSslContextTests.cpp | 3 --- 12 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/etlng/impl/GrpcSource.cpp b/src/etlng/impl/GrpcSource.cpp index 126eb713..67791a38 100644 --- a/src/etlng/impl/GrpcSource.cpp +++ b/src/etlng/impl/GrpcSource.cpp @@ -25,8 +25,6 @@ #include "util/log/Logger.hpp" #include "web/Resolver.hpp" -#include -#include #include #include #include @@ -38,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/web/ng/Server.cpp b/src/web/ng/Server.cpp index 083e3b7b..1628ba33 100644 --- a/src/web/ng/Server.cpp +++ b/src/web/ng/Server.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include diff --git a/src/web/ng/SubscriptionContext.cpp b/src/web/ng/SubscriptionContext.cpp index 8820334a..2803cf01 100644 --- a/src/web/ng/SubscriptionContext.cpp +++ b/src/web/ng/SubscriptionContext.cpp @@ -22,7 +22,6 @@ #include "util/Taggable.hpp" #include "web/SubscriptionContextInterface.hpp" -#include #include #include diff --git a/src/web/ng/impl/ConnectionHandler.cpp b/src/web/ng/impl/ConnectionHandler.cpp index 02e79b1a..60a09e34 100644 --- a/src/web/ng/impl/ConnectionHandler.cpp +++ b/src/web/ng/impl/ConnectionHandler.cpp @@ -32,13 +32,9 @@ #include "web/ng/Response.hpp" #include "web/ng/SubscriptionContext.hpp" -#include -#include #include #include #include -#include -#include #include #include #include diff --git a/tests/common/util/TestHttpClient.cpp b/tests/common/util/TestHttpClient.cpp index 0a82648e..6c7a4f2a 100644 --- a/tests/common/util/TestHttpClient.cpp +++ b/tests/common/util/TestHttpClient.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/unit/etlng/GrpcSourceTests.cpp b/tests/unit/etlng/GrpcSourceTests.cpp index 1b573a55..fb0d544e 100644 --- a/tests/unit/etlng/GrpcSourceTests.cpp +++ b/tests/unit/etlng/GrpcSourceTests.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -91,7 +90,7 @@ struct GrpcSourceNgTests : NoLoggerFixture, tests::util::WithMockXrpLedgerAPISer std::optional next(std::string const& marker) { - std::scoped_lock lock(mtx_); + std::scoped_lock const lock(mtx_); auto const mapKey = ripple::strHex(marker).substr(0, 2); auto it = store_.lower_bound(mapKey); @@ -110,7 +109,7 @@ struct GrpcSourceNgTests : NoLoggerFixture, tests::util::WithMockXrpLedgerAPISer std::optional peek(std::string const& marker) { - std::scoped_lock lock(mtx_); + std::scoped_lock const lock(mtx_); auto const mapKey = ripple::strHex(marker).substr(0, 2); auto it = store_.lower_bound(mapKey); @@ -264,7 +263,7 @@ TEST_F(GrpcSourceNgLoadInitialLedgerTests, DataTransferredAndObserverCalledCorre }); std::atomic_uint total = 0u; - [[maybe_unused]] testing::InSequence seqGuard; + [[maybe_unused]] testing::InSequence const seqGuard; EXPECT_CALL(observer_, onInitialLoadGotMoreObjects) .Times(numMarkers_) diff --git a/tests/unit/web/impl/ErrorHandlingTests.cpp b/tests/unit/web/impl/ErrorHandlingTests.cpp index d2c514d0..d1d214d1 100644 --- a/tests/unit/web/impl/ErrorHandlingTests.cpp +++ b/tests/unit/web/impl/ErrorHandlingTests.cpp @@ -22,9 +22,7 @@ #include "util/NameGenerator.hpp" #include "util/Taggable.hpp" #include "util/config/Config.hpp" -#include "web/SubscriptionContextInterface.hpp" #include "web/impl/ErrorHandling.hpp" -#include "web/interface/ConnectionBase.hpp" #include "web/interface/ConnectionBaseMock.hpp" #include @@ -60,7 +58,7 @@ struct ErrorHandlingComposeErrorTest : ErrorHandlingTests, TEST_P(ErrorHandlingComposeErrorTest, composeError) { connection_->upgraded = GetParam().connectionUpgraded; - ErrorHelper errorHelper{connection_, GetParam().request}; + ErrorHelper const errorHelper{connection_, GetParam().request}; auto const result = errorHelper.composeError(rpc::RippledError::rpcNOT_READY); EXPECT_EQ(boost::json::serialize(result), boost::json::serialize(GetParam().expectedResult)); } @@ -134,7 +132,7 @@ struct ErrorHandlingSendErrorTest : ErrorHandlingTests, TEST_P(ErrorHandlingSendErrorTest, sendError) { connection_->upgraded = GetParam().connectionUpgraded; - ErrorHelper errorHelper{connection_}; + ErrorHelper const errorHelper{connection_}; EXPECT_CALL(*connection_, send(std::string{GetParam().expectedMessage}, GetParam().expectedStatus)); errorHelper.sendError(GetParam().status); @@ -199,7 +197,7 @@ INSTANTIATE_TEST_CASE_P( TEST_F(ErrorHandlingTests, sendInternalError) { - ErrorHelper errorHelper{connection_}; + ErrorHelper const errorHelper{connection_}; EXPECT_CALL( *connection_, @@ -215,7 +213,7 @@ TEST_F(ErrorHandlingTests, sendInternalError) TEST_F(ErrorHandlingTests, sendNotReadyError) { - ErrorHelper errorHelper{connection_}; + ErrorHelper const errorHelper{connection_}; EXPECT_CALL( *connection_, send( @@ -231,7 +229,7 @@ TEST_F(ErrorHandlingTests, sendNotReadyError) TEST_F(ErrorHandlingTests, sendTooBusyError_UpgradedConnection) { connection_->upgraded = true; - ErrorHelper errorHelper{connection_}; + ErrorHelper const errorHelper{connection_}; EXPECT_CALL( *connection_, send( @@ -247,7 +245,7 @@ TEST_F(ErrorHandlingTests, sendTooBusyError_UpgradedConnection) TEST_F(ErrorHandlingTests, sendTooBusyError_NotUpgradedConnection) { connection_->upgraded = false; - ErrorHelper errorHelper{connection_}; + ErrorHelper const errorHelper{connection_}; EXPECT_CALL( *connection_, send( @@ -263,7 +261,7 @@ TEST_F(ErrorHandlingTests, sendTooBusyError_NotUpgradedConnection) TEST_F(ErrorHandlingTests, sendJsonParsingError_UpgradedConnection) { connection_->upgraded = true; - ErrorHelper errorHelper{connection_}; + ErrorHelper const errorHelper{connection_}; EXPECT_CALL( *connection_, send( @@ -279,7 +277,7 @@ TEST_F(ErrorHandlingTests, sendJsonParsingError_UpgradedConnection) TEST_F(ErrorHandlingTests, sendJsonParsingError_NotUpgradedConnection) { connection_->upgraded = false; - ErrorHelper errorHelper{connection_}; + ErrorHelper const errorHelper{connection_}; EXPECT_CALL( *connection_, send(std::string{"Unable to parse JSON from the request"}, boost::beast::http::status::bad_request) diff --git a/tests/unit/web/ng/RPCServerHandlerTests.cpp b/tests/unit/web/ng/RPCServerHandlerTests.cpp index 8a1e7a7d..6bbbf41d 100644 --- a/tests/unit/web/ng/RPCServerHandlerTests.cpp +++ b/tests/unit/web/ng/RPCServerHandlerTests.cpp @@ -380,7 +380,7 @@ TEST_F(ng_RPCServerHandlerWsTest, HandleRequest_Successful_WsRequest) { backend->setRange(0, 1); runSpawn([&](boost::asio::yield_context yield) { - Request::HttpHeaders headers; + Request::HttpHeaders const headers; auto const request = Request(R"json({"method":"some_method", "id": 1234, "api_version": 1})json", headers); EXPECT_CALL(*rpcEngine_, post).WillOnce([&](auto&& fn, auto&&) { @@ -411,7 +411,7 @@ TEST_F(ng_RPCServerHandlerWsTest, HandleRequest_Successful_WsRequest_HasError) { backend->setRange(0, 1); runSpawn([&](boost::asio::yield_context yield) { - Request::HttpHeaders headers; + Request::HttpHeaders const headers; auto const request = Request(R"json({"method":"some_method", "id": 1234, "api_version": 1})json", headers); EXPECT_CALL(*rpcEngine_, post).WillOnce([&](auto&& fn, auto&&) { diff --git a/tests/unit/web/ng/SubscriptionContextTests.cpp b/tests/unit/web/ng/SubscriptionContextTests.cpp index 6b3c4515..cb87ac98 100644 --- a/tests/unit/web/ng/SubscriptionContextTests.cpp +++ b/tests/unit/web/ng/SubscriptionContextTests.cpp @@ -76,7 +76,7 @@ TEST_F(ng_SubscriptionContextTests, SendOrder) auto const message1 = std::make_shared("message1"); auto const message2 = std::make_shared("message2"); - testing::Sequence sequence; + testing::Sequence const sequence; EXPECT_CALL(connection_, sendBuffer) .InSequence(sequence) .WillOnce([&message1](boost::asio::const_buffer buffer, auto, auto) { diff --git a/tests/unit/web/ng/impl/ErrorHandlingTests.cpp b/tests/unit/web/ng/impl/ErrorHandlingTests.cpp index 86d326c0..a1d3e7a1 100644 --- a/tests/unit/web/ng/impl/ErrorHandlingTests.cpp +++ b/tests/unit/web/ng/impl/ErrorHandlingTests.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -68,7 +67,7 @@ struct ng_ErrorHandlingMakeErrorTest : ng_ErrorHandlingTests, TEST_P(ng_ErrorHandlingMakeErrorTest, MakeError) { auto const request = makeRequest(GetParam().isHttp); - ErrorHelper errorHelper{request}; + ErrorHelper const errorHelper{request}; auto response = errorHelper.makeError(GetParam().status); EXPECT_EQ(response.message(), GetParam().expectedMessage); @@ -158,7 +157,7 @@ TEST_P(ng_ErrorHandlingMakeInternalErrorTest, ComposeError) std::optional const requestJson = GetParam().request.has_value() ? std::make_optional(boost::json::parse(*GetParam().request).as_object()) : std::nullopt; - ErrorHelper errorHelper{request, requestJson}; + ErrorHelper const errorHelper{request, requestJson}; auto response = errorHelper.makeInternalError(); @@ -314,7 +313,7 @@ struct ng_ErrorHandlingComposeErrorTest : ng_ErrorHandlingTests, TEST_P(ng_ErrorHandlingComposeErrorTest, ComposeError) { auto const request = makeRequest(GetParam().isHttp); - ErrorHelper errorHelper{request, GetParam().request}; + ErrorHelper const errorHelper{request, GetParam().request}; auto const response = errorHelper.composeError(rpc::Status{rpc::RippledError::rpcINTERNAL}); EXPECT_EQ(boost::json::serialize(response), GetParam().expectedMessage); } diff --git a/tests/unit/web/ng/impl/HttpConnectionTests.cpp b/tests/unit/web/ng/impl/HttpConnectionTests.cpp index c6c504c1..e4ef2070 100644 --- a/tests/unit/web/ng/impl/HttpConnectionTests.cpp +++ b/tests/unit/web/ng/impl/HttpConnectionTests.cpp @@ -27,7 +27,6 @@ #include "web/ng/Response.hpp" #include "web/ng/impl/HttpConnection.hpp" -#include #include #include #include diff --git a/tests/unit/web/ng/impl/ServerSslContextTests.cpp b/tests/unit/web/ng/impl/ServerSslContextTests.cpp index 550d3eff..be878ebf 100644 --- a/tests/unit/web/ng/impl/ServerSslContextTests.cpp +++ b/tests/unit/web/ng/impl/ServerSslContextTests.cpp @@ -23,10 +23,7 @@ #include "web/ng/impl/ServerSslContext.hpp" #include -#include #include -#include -#include #include #include #include