diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 334040761..249f48a38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -94,7 +94,7 @@ repos: language: script - repo: https://github.com/pre-commit/mirrors-clang-format - rev: 75ca4ad908dc4a99f57921f29b7e6c1521e10b26 # frozen: v21.1.8 + rev: cd481d7b0bfb5c7b3090c21846317f9a8262e891 # frozen: v22.1.0 hooks: - id: clang-format args: [--style=file] diff --git a/src/data/cassandra/impl/Statement.hpp b/src/data/cassandra/impl/Statement.hpp index d1706e960..85705adae 100644 --- a/src/data/cassandra/impl/Statement.hpp +++ b/src/data/cassandra/impl/Statement.hpp @@ -115,8 +115,10 @@ public: using UintByteTupleType = std::tuple; using ByteVectorType = std::vector; - if constexpr (std::is_same_v || - std::is_same_v) { + if constexpr ( + std::is_same_v || + std::is_same_v + ) { auto const rc = bindBytes(value.data(), value.size()); throwErrorIfNeeded(rc, "Bind ripple::base_uint"); } else if constexpr (std::is_same_v) { @@ -134,8 +136,10 @@ public: auto const rc = cass_statement_bind_string_n(*this, idx, value.text.c_str(), value.text.size()); throwErrorIfNeeded(rc, "Bind string (as TEXT)"); - } else if constexpr (std::is_same_v || - std::is_same_v) { + } else if constexpr ( + std::is_same_v || + std::is_same_v + ) { auto const rc = cass_statement_bind_tuple(*this, idx, Tuple{std::forward(value)}); throwErrorIfNeeded(rc, "Bind tuple or "); } else if constexpr (std::is_same_v) { diff --git a/src/etl/impl/Monitor.cpp b/src/etl/impl/Monitor.cpp index 0f6d64d9c..da1f5a14d 100644 --- a/src/etl/impl/Monitor.cpp +++ b/src/etl/impl/Monitor.cpp @@ -161,8 +161,9 @@ Monitor::doWork() if (dbProgressedThisCycle) { lck->lastDbCheckTime = std::chrono::steady_clock::now(); - } else if (std::chrono::steady_clock::now() - lck->lastDbCheckTime > - lck->dbStalledReportDelay) { + } else if ( + std::chrono::steady_clock::now() - lck->lastDbCheckTime > lck->dbStalledReportDelay + ) { LOG( log_.info() ) << "No DB update detected for " diff --git a/src/etl/impl/SubscriptionSource.cpp b/src/etl/impl/SubscriptionSource.cpp index d39108d07..0354d92aa 100644 --- a/src/etl/impl/SubscriptionSource.cpp +++ b/src/etl/impl/SubscriptionSource.cpp @@ -257,12 +257,14 @@ SubscriptionSource::handleMessage(std::string const& message) if (object.contains(JS(transaction)) and !object.contains(JS(meta))) { LOG(log_.debug()) << "Forwarding proposed transaction: " << object; subscriptions_->forwardProposedTransaction(object); - } else if (object.contains(JS(type)) && - object.at(JS(type)) == kJS_VALIDATION_RECEIVED) { + } else if ( + object.contains(JS(type)) && object.at(JS(type)) == kJS_VALIDATION_RECEIVED + ) { LOG(log_.debug()) << "Forwarding validation: " << object; subscriptions_->forwardValidation(object); - } else if (object.contains(JS(type)) && - object.at(JS(type)) == kJS_MANIFEST_RECEIVED) { + } else if ( + object.contains(JS(type)) && object.at(JS(type)) == kJS_MANIFEST_RECEIVED + ) { LOG(log_.debug()) << "Forwarding manifest: " << object; subscriptions_->forwardManifest(object); } diff --git a/src/rpc/common/MetaProcessors.hpp b/src/rpc/common/MetaProcessors.hpp index 2fb6e4f6b..a58d5bad3 100644 --- a/src/rpc/common/MetaProcessors.hpp +++ b/src/rpc/common/MetaProcessors.hpp @@ -124,8 +124,7 @@ public: if (auto const res = req->verify(j, key); not res) firstFailure = res.error(); }(), - ... - ); + ...); if (firstFailure) return Error{firstFailure.value()}; diff --git a/src/rpc/common/Specs.hpp b/src/rpc/common/Specs.hpp index a001b6f51..1791d33a6 100644 --- a/src/rpc/common/Specs.hpp +++ b/src/rpc/common/Specs.hpp @@ -48,10 +48,9 @@ struct FieldSpec final { */ template FieldSpec(std::string const& key, Processors&&... processors) - : processor_{impl::makeFieldProcessor( - key, - std::forward(processors)... - )} + : processor_{ + impl::makeFieldProcessor(key, std::forward(processors)...) + } , checker_{impl::kEMPTY_FIELD_CHECKER} { } diff --git a/src/rpc/common/ValidationHelpers.hpp b/src/rpc/common/ValidationHelpers.hpp index 26081c49c..cbc33190b 100644 --- a/src/rpc/common/ValidationHelpers.hpp +++ b/src/rpc/common/ValidationHelpers.hpp @@ -94,8 +94,9 @@ checkType(boost::json::value const& value) } else if constexpr (std::is_same_v) { if (not value.is_object()) hasError = true; - } else if constexpr (std::is_convertible_v or - std::is_convertible_v) { + } else if constexpr ( + std::is_convertible_v or std::is_convertible_v + ) { if (not value.is_int64() && not value.is_uint64()) hasError = true; // if the type specified is unsigned, it should not be negative diff --git a/src/rpc/common/impl/Factories.hpp b/src/rpc/common/impl/Factories.hpp index d52808c23..bc36585ba 100644 --- a/src/rpc/common/impl/Factories.hpp +++ b/src/rpc/common/impl/Factories.hpp @@ -68,8 +68,7 @@ makeFieldProcessor(std::string const& key, Processors&&... procs) static_assert(util::Unsupported); } }(), - ... - ); + ...); if (firstFailure) return std::unexpected{std::move(firstFailure).value()}; @@ -98,8 +97,7 @@ makeFieldChecker(std::string const& key, Checks&&... checks) if (auto res = req->check(j, key); res) warnings.push_back(std::move(res).value()); }(), - ... - ); + ...); return warnings; }; } diff --git a/src/util/async/impl/ErasedOperation.hpp b/src/util/async/impl/ErasedOperation.hpp index ecb97e991..664b920cf 100644 --- a/src/util/async/impl/ErasedOperation.hpp +++ b/src/util/async/impl/ErasedOperation.hpp @@ -128,8 +128,10 @@ private: void abort() override { - if constexpr (not SomeCancellableOperation and - not SomeStoppableOperation and not SomeAbortable) { + if constexpr ( + not SomeCancellableOperation and not SomeStoppableOperation and + not SomeAbortable + ) { ASSERT( false, "Called abort() on an operation that can't be aborted, cancelled nor stopped" diff --git a/tests/common/util/MockPrometheus.hpp b/tests/common/util/MockPrometheus.hpp index f0d40b49b..a01b27c6c 100644 --- a/tests/common/util/MockPrometheus.hpp +++ b/tests/common/util/MockPrometheus.hpp @@ -205,8 +205,9 @@ struct MockPrometheusImpl : PrometheusInterface { } else if constexpr (std::is_same_v) { auto& impl = counterUintImpls[key]; metric = std::make_unique(name, labelsString, impl); - } else if constexpr (std::is_same_v || - std::is_same_v) { + } else if constexpr ( + std::is_same_v || std::is_same_v + ) { auto& impl = counterDoubleImpls[key]; metric = std::make_unique(name, labelsString, impl); } else if constexpr (std::is_same_v) { @@ -289,8 +290,9 @@ struct WithMockPrometheus : virtual ::testing::Test { return mockPrometheusPtr->counterIntImpls[key]; } else if constexpr (std::is_same_v) { return mockPrometheusPtr->counterUintImpls[key]; - } else if constexpr (std::is_same_v || - std::is_same_v) { + } else if constexpr ( + std::is_same_v || std::is_same_v + ) { return mockPrometheusPtr->counterDoubleImpls[key]; } else if constexpr (std::is_same_v) { return mockPrometheusPtr->histogramIntImpls[key]; diff --git a/tests/unit/rpc/WorkQueueTests.cpp b/tests/unit/rpc/WorkQueueTests.cpp index e8a7adae6..3c5972238 100644 --- a/tests/unit/rpc/WorkQueueTests.cpp +++ b/tests/unit/rpc/WorkQueueTests.cpp @@ -49,7 +49,8 @@ struct RPCWorkQueueTestBase : public virtual ::testing::Test { RPCWorkQueueTestBase(uint32_t workers, uint32_t maxQueueSize) : cfg{ - {"server.max_queue_size", ConfigValue{ConfigType::Integer}.defaultValue(maxQueueSize)}, + {"server.max_queue_size", + ConfigValue{ConfigType::Integer}.defaultValue(maxQueueSize)}, {"workers", ConfigValue{ConfigType::Integer}.defaultValue(workers)}, } , queue{WorkQueue::makeWorkQueue(cfg)} diff --git a/tests/unit/rpc/handlers/AllHandlerTests.cpp b/tests/unit/rpc/handlers/AllHandlerTests.cpp index b454b1901..af05f49bb 100644 --- a/tests/unit/rpc/handlers/AllHandlerTests.cpp +++ b/tests/unit/rpc/handlers/AllHandlerTests.cpp @@ -147,11 +147,13 @@ private: HandlerType initHandler() { - if constexpr (std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v) { + if constexpr ( + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v + ) { return HandlerType{this->backend_, this->mockAmendmentCenterPtr_}; } else if constexpr (std::is_same_v) { return HandlerType{ diff --git a/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp b/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp index a00bfb29d..6ae4f3465 100644 --- a/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp +++ b/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp @@ -92,10 +92,12 @@ struct ConnectionHandlerTest : prometheus::WithPrometheus, SyncAsioContextTest { return std::unexpected{http::make_error_code(error)}; } else if constexpr (std::same_as) { return std::unexpected{websocket::make_error_code(error)}; - } else if constexpr (std::same_as || - std::same_as || - std::same_as || - std::same_as) { + } else if constexpr ( + std::same_as || + std::same_as || + std::same_as || + std::same_as + ) { return std::unexpected{boost::asio::error::make_error_code(error)}; } else { static_assert(util::Unsupported, "Wrong error type");