style: clang-tidy auto fixes (#1796)

Fixes #1795. Turning off noisy clang-tidy check.
This commit is contained in:
github-actions[bot]
2024-12-18 13:51:39 +00:00
committed by GitHub
parent 64b50b419f
commit 017cf2adc9
12 changed files with 28 additions and 53 deletions

View File

@@ -95,7 +95,6 @@ Checks: '-*,
misc-throw-by-value-catch-by-reference, misc-throw-by-value-catch-by-reference,
misc-unused-alias-decls, misc-unused-alias-decls,
misc-unused-using-decls, misc-unused-using-decls,
misc-use-internal-linkage,
modernize-concat-nested-namespaces, modernize-concat-nested-namespaces,
modernize-deprecated-headers, modernize-deprecated-headers,
modernize-make-shared, modernize-make-shared,

View File

@@ -71,8 +71,8 @@ CliArgs::parse(int argc, char const* argv[])
if (parsed.count("migrate") != 0u) { if (parsed.count("migrate") != 0u) {
auto const opt = parsed["migrate"].as<std::string>(); auto const opt = parsed["migrate"].as<std::string>();
if (opt == "status") if (opt == "status")
return Action{Action::Migrate{.configPath=std::move(configPath), .subCmd=MigrateSubCmd::status()}}; return Action{Action::Migrate{.configPath = std::move(configPath), .subCmd = MigrateSubCmd::status()}};
return Action{Action::Migrate{.configPath=std::move(configPath), .subCmd=MigrateSubCmd::migration(opt)}}; return Action{Action::Migrate{.configPath = std::move(configPath), .subCmd = MigrateSubCmd::migration(opt)}};
} }
return Action{Action::Run{.configPath = std::move(configPath), .useNgWebServer = parsed.count("ng-web-server") != 0} return Action{Action::Run{.configPath = std::move(configPath), .useNgWebServer = parsed.count("ng-web-server") != 0}

View File

@@ -43,7 +43,6 @@ namespace etl {
* @return MPT and holder account pair * @return MPT and holder account pair
*/ */
std::optional<MPTHolderData> std::optional<MPTHolderData>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getMPTokenAuthorize(ripple::TxMeta const& txMeta) getMPTokenAuthorize(ripple::TxMeta const& txMeta)
{ {
for (ripple::STObject const& node : txMeta.getNodes()) { for (ripple::STObject const& node : txMeta.getNodes()) {
@@ -61,7 +60,6 @@ getMPTokenAuthorize(ripple::TxMeta const& txMeta)
} }
std::optional<MPTHolderData> std::optional<MPTHolderData>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getMPTHolderFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getMPTHolderFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
{ {
if (txMeta.getResultTER() != ripple::tesSUCCESS || sttx.getTxnType() != ripple::TxType::ttMPTOKEN_AUTHORIZE) if (txMeta.getResultTER() != ripple::tesSUCCESS || sttx.getTxnType() != ripple::TxType::ttMPTOKEN_AUTHORIZE)
@@ -71,7 +69,6 @@ getMPTHolderFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
} }
std::optional<MPTHolderData> std::optional<MPTHolderData>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getMPTHolderFromObj(std::string const& key, std::string const& blob) getMPTHolderFromObj(std::string const& key, std::string const& blob)
{ {
ripple::STLedgerEntry const sle = ripple::STLedgerEntry const sle =

View File

@@ -48,7 +48,6 @@
namespace etl { namespace etl {
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
{ {
// To find the minted token ID, we put all tokenIDs referenced in the // To find the minted token ID, we put all tokenIDs referenced in the
@@ -139,7 +138,6 @@ getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
} }
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
{ {
ripple::uint256 const tokenID = sttx.getFieldH256(ripple::sfNFTokenID); ripple::uint256 const tokenID = sttx.getFieldH256(ripple::sfNFTokenID);
@@ -196,7 +194,6 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
} }
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
{ {
// If we have the buy offer from this tx, we can determine the owner // If we have the buy offer from this tx, we can determine the owner
@@ -286,7 +283,6 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// transaction using this feature. This transaction also never returns an // transaction using this feature. This transaction also never returns an
// NFTsData because it does not change the state of an NFT itself. // NFTsData because it does not change the state of an NFT itself.
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
{ {
std::vector<NFTTransactionsData> txs; std::vector<NFTTransactionsData> txs;
@@ -313,14 +309,12 @@ getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// This transaction never returns an NFTokensData because it does not // This transaction never returns an NFTokensData because it does not
// change the state of an NFT itself. // change the state of an NFT itself.
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
{ {
return {{NFTTransactionsData(sttx.getFieldH256(ripple::sfNFTokenID), txMeta, sttx.getTransactionID())}, {}}; return {{NFTTransactionsData(sttx.getFieldH256(ripple::sfNFTokenID), txMeta, sttx.getTransactionID())}, {}};
} }
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
{ {
if (txMeta.getResultTER() != ripple::tesSUCCESS) if (txMeta.getResultTER() != ripple::tesSUCCESS)
@@ -348,7 +342,6 @@ getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
} }
std::vector<NFTsData> std::vector<NFTsData>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string const& blob) getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string const& blob)
{ {
std::vector<NFTsData> nfts; std::vector<NFTsData> nfts;
@@ -366,7 +359,6 @@ getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string c
} }
std::vector<NFTsData> std::vector<NFTsData>
// NOLINTNEXTLINE(misc-use-internal-linkage)
getUniqueNFTsDatas(std::vector<NFTsData> const& nfts) getUniqueNFTsDatas(std::vector<NFTsData> const& nfts)
{ {
std::vector<NFTsData> results = nfts; std::vector<NFTsData> results = nfts;

View File

@@ -52,7 +52,7 @@ public:
*/ */
explicit MigrationManagerBase( explicit MigrationManagerBase(
std::shared_ptr<typename SupportedMigrators::BackendType> backend, std::shared_ptr<typename SupportedMigrators::BackendType> backend,
util::config::ObjectView config util::config::ObjectView config
) )
: migrators_{backend}, config_{std::move(config)} : migrators_{backend}, config_{std::move(config)}
{ {

View File

@@ -53,7 +53,6 @@
namespace rpc::credentials { namespace rpc::credentials {
bool bool
// NOLINTNEXTLINE(misc-use-internal-linkage)
checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger) checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger)
{ {
if (sleCred.isFieldPresent(ripple::sfExpiration)) { if (sleCred.isFieldPresent(ripple::sfExpiration)) {
@@ -65,7 +64,6 @@ checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger)
} }
std::set<std::pair<ripple::AccountID, ripple::Slice>> std::set<std::pair<ripple::AccountID, ripple::Slice>>
// NOLINTNEXTLINE(misc-use-internal-linkage)
createAuthCredentials(ripple::STArray const& in) createAuthCredentials(ripple::STArray const& in)
{ {
std::set<std::pair<ripple::AccountID, ripple::Slice>> out; std::set<std::pair<ripple::AccountID, ripple::Slice>> out;
@@ -76,7 +74,6 @@ createAuthCredentials(ripple::STArray const& in)
} }
ripple::STArray ripple::STArray
// NOLINTNEXTLINE(misc-use-internal-linkage)
parseAuthorizeCredentials(boost::json::array const& jv) parseAuthorizeCredentials(boost::json::array const& jv)
{ {
ripple::STArray arr; ripple::STArray arr;
@@ -111,7 +108,6 @@ parseAuthorizeCredentials(boost::json::array const& jv)
} }
std::expected<ripple::STArray, Status> std::expected<ripple::STArray, Status>
// NOLINTNEXTLINE(misc-use-internal-linkage)
fetchCredentialArray( fetchCredentialArray(
std::optional<boost::json::array> const& credID, std::optional<boost::json::array> const& credID,
ripple::AccountID const& srcAcc, ripple::AccountID const& srcAcc,

View File

@@ -34,7 +34,6 @@ namespace util {
* @return The transaction types in lowercase * @return The transaction types in lowercase
*/ */
[[nodiscard]] std::unordered_set<std::string> const& [[nodiscard]] std::unordered_set<std::string> const&
// NOLINTNEXTLINE(misc-use-internal-linkage)
getTxTypesInLowercase() getTxTypesInLowercase()
{ {
static std::unordered_set<std::string> const typesKeysInLowercase = []() { static std::unordered_set<std::string> const typesKeysInLowercase = []() {

View File

@@ -40,7 +40,6 @@
#include "util/newconfig/Types.hpp" #include "util/newconfig/Types.hpp"
#include <TestGlobals.hpp> #include <TestGlobals.hpp>
#include <algorithm>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <xrpl/basics/base_uint.h> #include <xrpl/basics/base_uint.h>

File diff suppressed because one or more lines are too long

View File

@@ -26,7 +26,7 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
static data::cassandra::ResultOrError data::cassandra::ResultOrError
writeTxFromCSVString(std::string const& space, std::string const& record, data::cassandra::Handle const& handler) writeTxFromCSVString(std::string const& space, std::string const& record, data::cassandra::Handle const& handler)
{ {
std::string const statement = fmt::format( std::string const statement = fmt::format(
@@ -36,22 +36,23 @@ writeTxFromCSVString(std::string const& space, std::string const& record, data::
return handler.execute(statement); return handler.execute(statement);
} }
static data::cassandra::ResultOrError data::cassandra::ResultOrError
writeObjectFromCSVString(std::string const& space, std::string const& record, data::cassandra::Handle const& handler) writeObjectFromCSVString(std::string const& space, std::string const& record, data::cassandra::Handle const& handler)
{ {
std::string const statement = fmt::format("INSERT INTO {}.objects (key, sequence, object) VALUES ({})", space, record); std::string const statement =
fmt::format("INSERT INTO {}.objects (key, sequence, object) VALUES ({})", space, record);
return handler.execute(statement); return handler.execute(statement);
} }
static data::cassandra::ResultOrError data::cassandra::ResultOrError
writeLedgerFromCSVString(std::string const& space, std::string const& record, data::cassandra::Handle const& handler) writeLedgerFromCSVString(std::string const& space, std::string const& record, data::cassandra::Handle const& handler)
{ {
std::string const statement = fmt::format("INSERT INTO {}.ledgers (sequence, header) VALUES ({})", space, record); std::string const statement = fmt::format("INSERT INTO {}.ledgers (sequence, header) VALUES ({})", space, record);
return handler.execute(statement); return handler.execute(statement);
} }
static data::cassandra::ResultOrError data::cassandra::ResultOrError
writeLedgerRange( writeLedgerRange(
std::string const& space, std::string const& space,
std::uint32_t minSeq, std::uint32_t minSeq,

View File

@@ -67,14 +67,12 @@ TEST_F(MigrationManagerBaseTest, AllStatus)
auto const status = migrationManager->allMigratorsStatusPairs(); auto const status = migrationManager->allMigratorsStatusPairs();
EXPECT_EQ(status.size(), 2); EXPECT_EQ(status.size(), 2);
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::Migrated)) !=
status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::Migrated) status.end()
) != status.end()
); );
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated)) !=
status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated) status.end()
) != status.end()
); );
} }

View File

@@ -88,14 +88,12 @@ TEST_F(MultipleMigratorRegisterTests, GetMigratorsStatusWhenError)
auto const status = migratorRegister->getMigratorsStatus(); auto const status = migratorRegister->getMigratorsStatus();
EXPECT_EQ(status.size(), 2); EXPECT_EQ(status.size(), 2);
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::NotMigrated)) !=
status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::NotMigrated) status.end()
) != status.end()
); );
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated)) !=
status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated) status.end()
) != status.end()
); );
} }
@@ -108,14 +106,12 @@ TEST_F(MultipleMigratorRegisterTests, GetMigratorsStatusWhenReturnInvalidStatus)
auto const status = migratorRegister->getMigratorsStatus(); auto const status = migratorRegister->getMigratorsStatus();
EXPECT_EQ(status.size(), 2); EXPECT_EQ(status.size(), 2);
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::NotMigrated)) !=
status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::NotMigrated) status.end()
) != status.end()
); );
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated)) !=
status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated) status.end()
) != status.end()
); );
} }
@@ -128,14 +124,12 @@ TEST_F(MultipleMigratorRegisterTests, GetMigratorsStatusWhenOneMigrated)
auto const status = migratorRegister->getMigratorsStatus(); auto const status = migratorRegister->getMigratorsStatus();
EXPECT_EQ(status.size(), 2); EXPECT_EQ(status.size(), 2);
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::Migrated)) !=
status, std::make_tuple("SimpleTestMigrator", migration::MigratorStatus::Migrated) status.end()
) != status.end()
); );
EXPECT_TRUE( EXPECT_TRUE(
std::ranges::find( std::ranges::find(status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated)) !=
status, std::make_tuple("SimpleTestMigrator2", migration::MigratorStatus::NotMigrated) status.end()
) != status.end()
); );
} }