Compare commits

...

1 Commits

Author SHA1 Message Date
mathbunnyru
b8314f530f style: Update pre-commit hooks 2026-03-01 01:22:59 +00:00
13 changed files with 52 additions and 39 deletions

View File

@@ -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]

View File

@@ -115,8 +115,10 @@ public:
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>) {
@@ -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<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>) {

View File

@@ -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 "

View File

@@ -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);
}

View File

@@ -124,8 +124,7 @@ public:
if (auto const res = req->verify(j, key); not res)
firstFailure = res.error();
}(),
...
);
...);
if (firstFailure)
return Error{firstFailure.value()};

View File

@@ -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}
{
}

View File

@@ -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

View File

@@ -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()};
@@ -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;
};
}

View File

@@ -128,8 +128,10 @@ private:
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"

View File

@@ -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>) {
@@ -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];

View File

@@ -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)}

View File

@@ -147,11 +147,13 @@ private:
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{

View File

@@ -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");