refactor: Enable more clang-tidy readability checks (#6595)

Co-authored-by: Sergey Kuznetsov <kuzzz99@gmail.com>
This commit is contained in:
Alex Kremer
2026-03-24 15:42:12 +00:00
committed by GitHub
parent 8b986e4ab0
commit 0eedefbf45
248 changed files with 948 additions and 935 deletions

View File

@@ -443,7 +443,7 @@ AMM::deposit(
// If including asset1In and asset2In or tokens as
// deposit min amounts then must set the flags
// explicitly instead of relying on this logic.
if (!(jvFlags & tfDepositSubTx))
if ((jvFlags & tfDepositSubTx) == 0u)
{
if (tokens && !asset1In)
{
@@ -573,7 +573,7 @@ AMM::withdraw(
std::uint32_t jvFlags = 0;
if (flags)
jvFlags = *flags;
if (!(jvFlags & tfWithdrawSubTx))
if ((jvFlags & tfWithdrawSubTx) == 0u)
{
if (tokens && !asset1Out)
{

View File

@@ -149,13 +149,13 @@ AMMTestBase::testAMM(std::function<void(jtx::AMM&, jtx::Env&)> const& cb, TestAM
}
XRPAmount
AMMTest::reserve(jtx::Env& env, std::uint32_t count) const
AMMTest::reserve(jtx::Env& env, std::uint32_t count)
{
return env.current()->fees().accountReserve(count);
}
XRPAmount
AMMTest::ammCrtFee(jtx::Env& env) const
AMMTest::ammCrtFee(jtx::Env& env)
{
return env.current()->fees().increment;
}

View File

@@ -76,7 +76,7 @@ Env::AppBundle::~AppBundle()
client.reset();
// Make sure all jobs finish, otherwise tests
// might not get the coverage they expect.
if (app)
if (app != nullptr)
{
app->getJobQueue().rendezvous();
app->signalStop("~AppBundle");
@@ -218,6 +218,7 @@ Env::balance(Account const& account, MPTIssue const& mptIssue) const
}
PrettyAmount
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
Env::balance(Account const& account, Asset const& asset) const
{
return std::visit([&](auto const& issue) { return balance(account, issue); }, asset.value());
@@ -468,7 +469,7 @@ Env::postconditions(
// we didn't get the expected result.
return;
}
if (trace_)
if (trace_ != 0)
{
if (trace_ > 0)
--trace_;

View File

@@ -258,7 +258,7 @@ Oracle::set(UpdateArg const& arg)
return s;
assert(s.size() <= 20);
// anything else must be 160-bit hex string
return strHex(s).append(40 - s.size() * 2, '0');
return strHex(s).append(40 - (s.size() * 2), '0');
};
for (auto const& data : arg.series)
{

View File

@@ -370,7 +370,7 @@ MPTTester::set(MPTSet const& arg)
.metadata = arg.metadata,
.delegate = arg.delegate,
.domainID = arg.domainID});
if (submit(arg, jv) == tesSUCCESS && (arg.flags.value_or(0) || arg.mutableFlags))
if (submit(arg, jv) == tesSUCCESS && ((arg.flags.value_or(0) != 0u) || arg.mutableFlags))
{
auto require = [&](std::optional<Account> const& holder, bool unchanged) {
auto flags = getFlags(holder);

View File

@@ -83,7 +83,7 @@ msig::operator()(Env& env, JTx& jt) const
jo[sfTxnSignature.getJsonName()] = strHex(Slice{sig.data(), sig.size()});
}
};
if (!subField)
if (subField == nullptr)
{
jt.mainSigners.emplace_back(callback);
}

View File

@@ -17,7 +17,7 @@ offer(
jv[jss::Account] = account.human();
jv[jss::TakerPays] = takerPays.getJson(JsonOptions::none);
jv[jss::TakerGets] = takerGets.getJson(JsonOptions::none);
if (flags)
if (flags != 0u)
jv[jss::Flags] = flags;
jv[jss::TransactionType] = jss::OfferCreate;
return jv;

View File

@@ -10,7 +10,7 @@ sig::operator()(Env&, JTx& jt) const
{
if (!manual_)
return;
if (!subField_)
if (subField_ == nullptr)
jt.fill_sig = false;
if (account_)
{
@@ -22,7 +22,7 @@ sig::operator()(Env&, JTx& jt) const
jtx::sign(jtx.jv, account, sigObject);
};
if (!subField_)
if (subField_ == nullptr)
{
jt.mainSigners.emplace_back(callback);
}