Skip to content

Commit a4d6caf

Browse files
style: Update pre-commit hooks (#2968)
Co-authored-by: mathbunnyru <12270691+mathbunnyru@users.noreply.github.com>
1 parent b9ee518 commit a4d6caf

File tree

13 files changed

+52
-39
lines changed

13 files changed

+52
-39
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ repos:
9494
language: script
9595

9696
- repo: https://github.com/pre-commit/mirrors-clang-format
97-
rev: 75ca4ad908dc4a99f57921f29b7e6c1521e10b26 # frozen: v21.1.8
97+
rev: cd481d7b0bfb5c7b3090c21846317f9a8262e891 # frozen: v22.1.0
9898
hooks:
9999
- id: clang-format
100100
args: [--style=file]

src/data/cassandra/impl/Statement.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ class Statement : public ManagedObject<CassStatement> {
115115
using UintByteTupleType = std::tuple<uint32_t, ripple::uint256>;
116116
using ByteVectorType = std::vector<ripple::uint256>;
117117

118-
if constexpr (std::is_same_v<DecayedType, ripple::uint256> ||
119-
std::is_same_v<DecayedType, ripple::uint192>) {
118+
if constexpr (
119+
std::is_same_v<DecayedType, ripple::uint256> ||
120+
std::is_same_v<DecayedType, ripple::uint192>
121+
) {
120122
auto const rc = bindBytes(value.data(), value.size());
121123
throwErrorIfNeeded(rc, "Bind ripple::base_uint");
122124
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) {
@@ -134,8 +136,10 @@ class Statement : public ManagedObject<CassStatement> {
134136
auto const rc =
135137
cass_statement_bind_string_n(*this, idx, value.text.c_str(), value.text.size());
136138
throwErrorIfNeeded(rc, "Bind string (as TEXT)");
137-
} else if constexpr (std::is_same_v<DecayedType, UintTupleType> ||
138-
std::is_same_v<DecayedType, UintByteTupleType>) {
139+
} else if constexpr (
140+
std::is_same_v<DecayedType, UintTupleType> ||
141+
std::is_same_v<DecayedType, UintByteTupleType>
142+
) {
139143
auto const rc = cass_statement_bind_tuple(*this, idx, Tuple{std::forward<Type>(value)});
140144
throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, ripple::uint256>");
141145
} else if constexpr (std::is_same_v<DecayedType, ByteVectorType>) {

src/etl/impl/Monitor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ Monitor::doWork()
161161

162162
if (dbProgressedThisCycle) {
163163
lck->lastDbCheckTime = std::chrono::steady_clock::now();
164-
} else if (std::chrono::steady_clock::now() - lck->lastDbCheckTime >
165-
lck->dbStalledReportDelay) {
164+
} else if (
165+
std::chrono::steady_clock::now() - lck->lastDbCheckTime > lck->dbStalledReportDelay
166+
) {
166167
LOG(
167168
log_.info()
168169
) << "No DB update detected for "

src/etl/impl/SubscriptionSource.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,14 @@ SubscriptionSource::handleMessage(std::string const& message)
257257
if (object.contains(JS(transaction)) and !object.contains(JS(meta))) {
258258
LOG(log_.debug()) << "Forwarding proposed transaction: " << object;
259259
subscriptions_->forwardProposedTransaction(object);
260-
} else if (object.contains(JS(type)) &&
261-
object.at(JS(type)) == kJS_VALIDATION_RECEIVED) {
260+
} else if (
261+
object.contains(JS(type)) && object.at(JS(type)) == kJS_VALIDATION_RECEIVED
262+
) {
262263
LOG(log_.debug()) << "Forwarding validation: " << object;
263264
subscriptions_->forwardValidation(object);
264-
} else if (object.contains(JS(type)) &&
265-
object.at(JS(type)) == kJS_MANIFEST_RECEIVED) {
265+
} else if (
266+
object.contains(JS(type)) && object.at(JS(type)) == kJS_MANIFEST_RECEIVED
267+
) {
266268
LOG(log_.debug()) << "Forwarding manifest: " << object;
267269
subscriptions_->forwardManifest(object);
268270
}

src/rpc/common/MetaProcessors.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ class IfType final {
124124
if (auto const res = req->verify(j, key); not res)
125125
firstFailure = res.error();
126126
}(),
127-
...
128-
);
127+
...);
129128

130129
if (firstFailure)
131130
return Error{firstFailure.value()};

src/rpc/common/Specs.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ struct FieldSpec final {
4848
*/
4949
template <SomeProcessor... Processors>
5050
FieldSpec(std::string const& key, Processors&&... processors)
51-
: processor_{impl::makeFieldProcessor<Processors...>(
52-
key,
53-
std::forward<Processors>(processors)...
54-
)}
51+
: processor_{
52+
impl::makeFieldProcessor<Processors...>(key, std::forward<Processors>(processors)...)
53+
}
5554
, checker_{impl::kEMPTY_FIELD_CHECKER}
5655
{
5756
}

src/rpc/common/ValidationHelpers.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ checkType(boost::json::value const& value)
9494
} else if constexpr (std::is_same_v<Expected, boost::json::object>) {
9595
if (not value.is_object())
9696
hasError = true;
97-
} else if constexpr (std::is_convertible_v<Expected, uint64_t> or
98-
std::is_convertible_v<Expected, int64_t>) {
97+
} else if constexpr (
98+
std::is_convertible_v<Expected, uint64_t> or std::is_convertible_v<Expected, int64_t>
99+
) {
99100
if (not value.is_int64() && not value.is_uint64())
100101
hasError = true;
101102
// if the type specified is unsigned, it should not be negative

src/rpc/common/impl/Factories.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ makeFieldProcessor(std::string const& key, Processors&&... procs)
6868
static_assert(util::Unsupported<decltype(*req)>);
6969
}
7070
}(),
71-
...
72-
);
71+
...);
7372

7473
if (firstFailure)
7574
return std::unexpected{std::move(firstFailure).value()};
@@ -98,8 +97,7 @@ makeFieldChecker(std::string const& key, Checks&&... checks)
9897
if (auto res = req->check(j, key); res)
9998
warnings.push_back(std::move(res).value());
10099
}(),
101-
...
102-
);
100+
...);
103101
return warnings;
104102
};
105103
}

src/util/async/impl/ErasedOperation.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ class ErasedOperation {
128128
void
129129
abort() override
130130
{
131-
if constexpr (not SomeCancellableOperation<OpType> and
132-
not SomeStoppableOperation<OpType> and not SomeAbortable<OpType>) {
131+
if constexpr (
132+
not SomeCancellableOperation<OpType> and not SomeStoppableOperation<OpType> and
133+
not SomeAbortable<OpType>
134+
) {
133135
ASSERT(
134136
false,
135137
"Called abort() on an operation that can't be aborted, cancelled nor stopped"

tests/common/util/MockPrometheus.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ struct MockPrometheusImpl : PrometheusInterface {
205205
} else if constexpr (std::is_same_v<MetricType, CounterInt>) {
206206
auto& impl = counterUintImpls[key];
207207
metric = std::make_unique<MetricType>(name, labelsString, impl);
208-
} else if constexpr (std::is_same_v<MetricType, GaugeDouble> ||
209-
std::is_same_v<MetricType, CounterDouble>) {
208+
} else if constexpr (
209+
std::is_same_v<MetricType, GaugeDouble> || std::is_same_v<MetricType, CounterDouble>
210+
) {
210211
auto& impl = counterDoubleImpls[key];
211212
metric = std::make_unique<MetricType>(name, labelsString, impl);
212213
} else if constexpr (std::is_same_v<MetricType, HistogramInt>) {
@@ -289,8 +290,9 @@ struct WithMockPrometheus : virtual ::testing::Test {
289290
return mockPrometheusPtr->counterIntImpls[key];
290291
} else if constexpr (std::is_same_v<MetricType, CounterInt>) {
291292
return mockPrometheusPtr->counterUintImpls[key];
292-
} else if constexpr (std::is_same_v<MetricType, GaugeDouble> ||
293-
std::is_same_v<MetricType, CounterDouble>) {
293+
} else if constexpr (
294+
std::is_same_v<MetricType, GaugeDouble> || std::is_same_v<MetricType, CounterDouble>
295+
) {
294296
return mockPrometheusPtr->counterDoubleImpls[key];
295297
} else if constexpr (std::is_same_v<MetricType, HistogramInt>) {
296298
return mockPrometheusPtr->histogramIntImpls[key];

0 commit comments

Comments
 (0)