mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 09:16:47 +00:00
refactor: Add simple clang-tidy readability checks (#6556)
This change enables the following clang-tidy checks: - readability-avoid-nested-conditional-operator, - readability-avoid-return-with-void-value, - readability-braces-around-statements, - readability-const-return-type, - readability-container-contains, - readability-container-size-empty, - readability-else-after-return, - readability-make-member-function-const, - readability-redundant-casting, - readability-redundant-inline-specifier, - readability-redundant-member-init, - readability-redundant-string-init, - readability-reference-to-constructed-temporary, - readability-static-definition
This commit is contained in:
@@ -1208,7 +1208,7 @@ public:
|
||||
{
|
||||
auto acctOffers = offersOnAccount(env, account_to_test);
|
||||
|
||||
BEAST_EXPECT(acctOffers.size() == 0);
|
||||
BEAST_EXPECT(acctOffers.empty());
|
||||
for (auto const& offerPtr : acctOffers)
|
||||
{
|
||||
auto const& offer = *offerPtr;
|
||||
@@ -1926,9 +1926,13 @@ public:
|
||||
{
|
||||
Env env{*this, features};
|
||||
if (NumberSwitchOver)
|
||||
{
|
||||
env.enableFeature(fixUniversalNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
env.disableFeature(fixUniversalNumber);
|
||||
}
|
||||
|
||||
auto const gw = Account{"gateway"};
|
||||
auto const alice = Account{"alice"};
|
||||
@@ -2281,7 +2285,7 @@ public:
|
||||
|
||||
auto acctOffers = offersOnAccount(env, acct);
|
||||
BEAST_EXPECT(acctOffers.size() == t.offers);
|
||||
if (acctOffers.size() && t.offers)
|
||||
if (!acctOffers.empty() && t.offers)
|
||||
{
|
||||
auto const& acctOffer = *(acctOffers.front());
|
||||
|
||||
@@ -2592,7 +2596,7 @@ public:
|
||||
|
||||
// In pre-flow code alice's offer is left empty in the ledger.
|
||||
auto const aliceOffers = offersOnAccount(env, alice);
|
||||
if (aliceOffers.size() != 0)
|
||||
if (!aliceOffers.empty())
|
||||
{
|
||||
BEAST_EXPECT(aliceOffers.size() == 1);
|
||||
auto const& aliceOffer = *(aliceOffers.front());
|
||||
@@ -2772,7 +2776,7 @@ public:
|
||||
if (t.offers)
|
||||
{
|
||||
auto const acctOffers = offersOnAccount(env, acct);
|
||||
if (acctOffers.size() > 0)
|
||||
if (!acctOffers.empty())
|
||||
{
|
||||
BEAST_EXPECT(acctOffers.size() == 1);
|
||||
auto const& acctOffer = *(acctOffers.front());
|
||||
@@ -2984,7 +2988,7 @@ public:
|
||||
env.require(balance(eve, XRP(18000)));
|
||||
auto const evesOffers = offersOnAccount(env, eve);
|
||||
BEAST_EXPECT(evesOffers.size() == 1);
|
||||
if (evesOffers.size() != 0)
|
||||
if (!evesOffers.empty())
|
||||
{
|
||||
auto const& evesOffer = *(evesOffers.front());
|
||||
BEAST_EXPECT(evesOffer[sfLedgerEntryType] == ltOFFER);
|
||||
@@ -3160,7 +3164,7 @@ public:
|
||||
|
||||
// In pre-flow code ova's offer is left empty in the ledger.
|
||||
auto const ovasOffers = offersOnAccount(env, ova);
|
||||
if (ovasOffers.size() != 0)
|
||||
if (!ovasOffers.empty())
|
||||
{
|
||||
BEAST_EXPECT(ovasOffers.size() == 1);
|
||||
auto const& ovasOffer = *(ovasOffers.front());
|
||||
@@ -4593,8 +4597,10 @@ public:
|
||||
std::map<std::uint32_t, std::pair<STAmount, STAmount>> offers;
|
||||
forEachItem(*env.current(), alice, [&](std::shared_ptr<SLE const> const& sle) {
|
||||
if (sle->getType() == ltOFFER)
|
||||
{
|
||||
offers.emplace(
|
||||
(*sle)[sfSequence], std::make_pair((*sle)[sfTakerPays], (*sle)[sfTakerGets]));
|
||||
}
|
||||
});
|
||||
|
||||
// first offer
|
||||
@@ -4749,7 +4755,7 @@ public:
|
||||
// Verify that the third offer alice created was consumed.
|
||||
{
|
||||
auto offers = sortedOffersOnAccount(env, alice);
|
||||
BEAST_EXPECT(offers.size() == 0);
|
||||
BEAST_EXPECT(offers.empty());
|
||||
}
|
||||
env.require(balance(alice, USD(0)));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
Reference in New Issue
Block a user