Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
12 changes: 8 additions & 4 deletions src/data/cassandra/impl/Statement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ class Statement : public ManagedObject<CassStatement> {
using UintByteTupleType = std::tuple<uint32_t, ripple::uint256>;
using ByteVectorType = std::vector<ripple::uint256>;

if constexpr (std::is_same_v<DecayedType, ripple::uint256> ||
std::is_same_v<DecayedType, ripple::uint192>) {
if constexpr (
std::is_same_v<DecayedType, ripple::uint256> ||
std::is_same_v<DecayedType, ripple::uint192>
) {
auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind ripple::base_uint");
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) {
Expand All @@ -134,8 +136,10 @@ class Statement : public ManagedObject<CassStatement> {
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<DecayedType, UintTupleType> ||
std::is_same_v<DecayedType, UintByteTupleType>) {
} else if constexpr (
std::is_same_v<DecayedType, UintTupleType> ||
std::is_same_v<DecayedType, UintByteTupleType>
) {
auto const rc = cass_statement_bind_tuple(*this, idx, Tuple{std::forward<Type>(value)});
throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, ripple::uint256>");
} else if constexpr (std::is_same_v<DecayedType, ByteVectorType>) {
Expand Down
5 changes: 3 additions & 2 deletions src/etl/impl/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
10 changes: 6 additions & 4 deletions src/etl/impl/SubscriptionSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions src/rpc/common/MetaProcessors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ class IfType final {
if (auto const res = req->verify(j, key); not res)
firstFailure = res.error();
}(),
...
);
...);

if (firstFailure)
return Error{firstFailure.value()};
Expand Down
7 changes: 3 additions & 4 deletions src/rpc/common/Specs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ struct FieldSpec final {
*/
template <SomeProcessor... Processors>
FieldSpec(std::string const& key, Processors&&... processors)
: processor_{impl::makeFieldProcessor<Processors...>(
key,
std::forward<Processors>(processors)...
)}
: processor_{
impl::makeFieldProcessor<Processors...>(key, std::forward<Processors>(processors)...)
}
, checker_{impl::kEMPTY_FIELD_CHECKER}
{
}
Expand Down
5 changes: 3 additions & 2 deletions src/rpc/common/ValidationHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ checkType(boost::json::value const& value)
} else if constexpr (std::is_same_v<Expected, boost::json::object>) {
if (not value.is_object())
hasError = true;
} else if constexpr (std::is_convertible_v<Expected, uint64_t> or
std::is_convertible_v<Expected, int64_t>) {
} else if constexpr (
std::is_convertible_v<Expected, uint64_t> or std::is_convertible_v<Expected, int64_t>
) {
if (not value.is_int64() && not value.is_uint64())
hasError = true;
// if the type specified is unsigned, it should not be negative
Expand Down
6 changes: 2 additions & 4 deletions src/rpc/common/impl/Factories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ makeFieldProcessor(std::string const& key, Processors&&... procs)
static_assert(util::Unsupported<decltype(*req)>);
}
}(),
...
);
...);

if (firstFailure)
return std::unexpected{std::move(firstFailure).value()};
Expand Down Expand Up @@ -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;
};
}
Expand Down
6 changes: 4 additions & 2 deletions src/util/async/impl/ErasedOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ class ErasedOperation {
void
abort() override
{
if constexpr (not SomeCancellableOperation<OpType> and
not SomeStoppableOperation<OpType> and not SomeAbortable<OpType>) {
if constexpr (
not SomeCancellableOperation<OpType> and not SomeStoppableOperation<OpType> and
not SomeAbortable<OpType>
) {
ASSERT(
false,
"Called abort() on an operation that can't be aborted, cancelled nor stopped"
Expand Down
10 changes: 6 additions & 4 deletions tests/common/util/MockPrometheus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ struct MockPrometheusImpl : PrometheusInterface {
} else if constexpr (std::is_same_v<MetricType, CounterInt>) {
auto& impl = counterUintImpls[key];
metric = std::make_unique<MetricType>(name, labelsString, impl);
} else if constexpr (std::is_same_v<MetricType, GaugeDouble> ||
std::is_same_v<MetricType, CounterDouble>) {
} else if constexpr (
std::is_same_v<MetricType, GaugeDouble> || std::is_same_v<MetricType, CounterDouble>
) {
auto& impl = counterDoubleImpls[key];
metric = std::make_unique<MetricType>(name, labelsString, impl);
} else if constexpr (std::is_same_v<MetricType, HistogramInt>) {
Expand Down Expand Up @@ -289,8 +290,9 @@ struct WithMockPrometheus : virtual ::testing::Test {
return mockPrometheusPtr->counterIntImpls[key];
} else if constexpr (std::is_same_v<MetricType, CounterInt>) {
return mockPrometheusPtr->counterUintImpls[key];
} else if constexpr (std::is_same_v<MetricType, GaugeDouble> ||
std::is_same_v<MetricType, CounterDouble>) {
} else if constexpr (
std::is_same_v<MetricType, GaugeDouble> || std::is_same_v<MetricType, CounterDouble>
) {
return mockPrometheusPtr->counterDoubleImpls[key];
} else if constexpr (std::is_same_v<MetricType, HistogramInt>) {
return mockPrometheusPtr->histogramIntImpls[key];
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/rpc/WorkQueueTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
12 changes: 7 additions & 5 deletions tests/unit/rpc/handlers/AllHandlerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ struct AllHandlersAssertTest : common::util::WithMockAssert,
HandlerType
initHandler()
{
if constexpr (std::is_same_v<HandlerType, AccountInfoHandler> ||
std::is_same_v<HandlerType, AMMInfoHandler> ||
std::is_same_v<HandlerType, LedgerHandler> ||
std::is_same_v<HandlerType, BookOffersHandler> ||
std::is_same_v<HandlerType, FeatureHandler>) {
if constexpr (
std::is_same_v<HandlerType, AccountInfoHandler> ||
std::is_same_v<HandlerType, AMMInfoHandler> ||
std::is_same_v<HandlerType, LedgerHandler> ||
std::is_same_v<HandlerType, BookOffersHandler> ||
std::is_same_v<HandlerType, FeatureHandler>
) {
return HandlerType{this->backend_, this->mockAmendmentCenterPtr_};
} else if constexpr (std::is_same_v<HandlerType, SubscribeHandler>) {
return HandlerType{
Expand Down
10 changes: 6 additions & 4 deletions tests/unit/web/ng/impl/ConnectionHandlerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ struct ConnectionHandlerTest : prometheus::WithPrometheus, SyncAsioContextTest {
return std::unexpected{http::make_error_code(error)};
} else if constexpr (std::same_as<BoostErrorType, websocket::error>) {
return std::unexpected{websocket::make_error_code(error)};
} else if constexpr (std::same_as<BoostErrorType, boost::asio::error::basic_errors> ||
std::same_as<BoostErrorType, boost::asio::error::misc_errors> ||
std::same_as<BoostErrorType, boost::asio::error::addrinfo_errors> ||
std::same_as<BoostErrorType, boost::asio::error::netdb_errors>) {
} else if constexpr (
std::same_as<BoostErrorType, boost::asio::error::basic_errors> ||
std::same_as<BoostErrorType, boost::asio::error::misc_errors> ||
std::same_as<BoostErrorType, boost::asio::error::addrinfo_errors> ||
std::same_as<BoostErrorType, boost::asio::error::netdb_errors>
) {
return std::unexpected{boost::asio::error::make_error_code(error)};
} else {
static_assert(util::Unsupported<BoostErrorType>, "Wrong error type");
Expand Down
Loading