refactor: Enable clang-tidy readability-identifier-naming check (#6571)

This commit is contained in:
Alex Kremer
2026-05-03 11:31:53 +01:00
committed by GitHub
parent 182d844996
commit 8995564ed6
1498 changed files with 58858 additions and 58914 deletions

View File

@@ -70,7 +70,7 @@ namespace xrpl::test::jtx {
//------------------------------------------------------------------------------
Env::AppBundle::AppBundle(
beast::unit_test::suite& suite,
beast::unit_test::Suite& suite,
std::unique_ptr<Config> config,
std::unique_ptr<Logs> logs,
beast::severities::Severity thresh)
@@ -79,20 +79,20 @@ Env::AppBundle::AppBundle(
using namespace beast::severities;
if (logs)
{
setDebugLogSink(logs->makeSink("Debug", kFatal));
setDebugLogSink(logs->makeSink("Debug", KFatal));
}
else
{
logs = std::make_unique<SuiteLogs>(suite);
// Use kFatal threshold to reduce noise from STObject.
setDebugLogSink(std::make_unique<SuiteJournalSink>("Debug", kFatal, suite));
setDebugLogSink(std::make_unique<SuiteJournalSink>("Debug", KFatal, suite));
}
auto timeKeeper_ = std::make_unique<ManualTimeKeeper>();
timeKeeper = timeKeeper_.get();
auto tk = std::make_unique<ManualTimeKeeper>();
timeKeeper = tk.get();
// Hack so we don't have to call Config::setup
HTTPClient::initializeSSLContext(
config->SSL_VERIFY_DIR, config->SSL_VERIFY_FILE, config->SSL_VERIFY, debugLog());
owned = make_Application(std::move(config), std::move(logs), std::move(timeKeeper_));
owned = makeApplication(std::move(config), std::move(logs), std::move(tk));
app = owned.get();
app->getLogs().threshold(thresh);
if (!app->setup({}))
@@ -301,26 +301,26 @@ Env::fund(bool setDefaultRipple, STAmount const& amount, Account const& account)
// VFALCO NOTE Is the fee formula correct?
apply(
pay(master, account, amount + drops(current()->fees().base)),
jtx::seq(jtx::autofill),
fee(jtx::autofill),
sig(jtx::autofill));
jtx::Seq(jtx::kAUTOFILL),
Fee(jtx::kAUTOFILL),
Sig(jtx::kAUTOFILL));
apply(
fset(account, asfDefaultRipple),
jtx::seq(jtx::autofill),
fee(jtx::autofill),
sig(jtx::autofill));
require(flags(account, asfDefaultRipple));
jtx::Seq(jtx::kAUTOFILL),
Fee(jtx::kAUTOFILL),
Sig(jtx::kAUTOFILL));
require(Flags(account, asfDefaultRipple));
}
else
{
apply(
pay(master, account, amount),
jtx::seq(jtx::autofill),
fee(jtx::autofill),
sig(jtx::autofill));
require(nflags(account, asfDefaultRipple));
jtx::Seq(jtx::kAUTOFILL),
Fee(jtx::kAUTOFILL),
Sig(jtx::kAUTOFILL));
require(Nflags(account, asfDefaultRipple));
}
require(jtx::balance(account, amount));
require(jtx::Balance(account, amount));
}
void
@@ -331,21 +331,21 @@ Env::trust(STAmount const& amount, Account const& account)
auto const start = balance(account);
apply(
jtx::trust(account, amount),
jtx::seq(jtx::autofill),
fee(jtx::autofill),
sig(jtx::autofill));
jtx::Seq(jtx::kAUTOFILL),
Fee(jtx::kAUTOFILL),
Sig(jtx::kAUTOFILL));
apply(
pay(master, account, drops(current()->fees().base)),
jtx::seq(jtx::autofill),
fee(jtx::autofill),
sig(jtx::autofill));
jtx::Seq(jtx::kAUTOFILL),
Fee(jtx::kAUTOFILL),
Sig(jtx::kAUTOFILL));
test.expect(balance(account) == start);
}
Env::ParsedResult
Env::parseResult(Json::Value const& jr)
Env::parseResult(json::Value const& jr)
{
auto error = [](ParsedResult& parsed, Json::Value const& object) {
auto error = [](ParsedResult& parsed, json::Value const& object) {
// Use an error code that is not used anywhere in the transaction
// engine to distinguish this case.
parsed.ter = telENV_RPC_FAILED;
@@ -353,7 +353,7 @@ Env::parseResult(Json::Value const& jr)
if (!object.isObject())
return;
if (object.isMember(jss::error_code))
parsed.rpcCode = safe_cast<error_code_i>(object[jss::error_code].asInt());
parsed.rpcCode = safeCast<ErrorCodeI>(object[jss::error_code].asInt());
if (object.isMember(jss::error_message))
parsed.rpcMessage = object[jss::error_message].asString();
if (object.isMember(jss::error))
@@ -368,7 +368,7 @@ Env::parseResult(Json::Value const& jr)
if (result.isMember(jss::engine_result_code))
{
parsed.ter = TER::fromInt(result[jss::engine_result_code].asInt());
parsed.rpcCode.emplace(rpcSUCCESS);
parsed.rpcCode.emplace(RpcSuccess);
}
else
{
@@ -406,18 +406,18 @@ Env::submit(JTx const& jt, std::source_location const& loc)
// otherwise missing the stx field.
parsedResult.ter = ter_ = temMALFORMED;
return Json::Value();
return json::Value();
}();
postconditions(jt, parsedResult, jr, loc);
}
void
Env::sign_and_submit(JTx const& jt, Json::Value params, std::source_location const& loc)
Env::signAndSubmit(JTx const& jt, json::Value params, std::source_location const& loc)
{
auto const account = lookup(jt.jv[jss::Account].asString());
auto const& passphrase = account.name();
Json::Value jr;
json::Value jr;
if (params.isNull())
{
// Use the command line interface
@@ -453,7 +453,7 @@ void
Env::postconditions(
JTx const& jt,
ParsedResult const& parsed,
Json::Value const& jr,
json::Value const& jr,
std::source_location const& loc)
{
auto const locStr = std::string("(") + loc.file_name() + ":" + to_string(loc.line()) + ")";
@@ -466,15 +466,15 @@ Env::postconditions(
transHuman(*parsed.ter) + "); Expected " + transToken(*jt.ter) + " (" +
transHuman(*jt.ter) + ")"));
using namespace std::string_literals;
bad = (jt.rpcCode &&
!test.expect(
parsed.rpcCode == jt.rpcCode->first && parsed.rpcMessage == jt.rpcCode->second,
"apply " + locStr + ": Got RPC result "s +
(parsed.rpcCode ? RPC::get_error_info(*parsed.rpcCode).token.c_str()
: "NO RESULT") +
" (" + parsed.rpcMessage + "); Expected " +
RPC::get_error_info(jt.rpcCode->first).token.c_str() + " (" +
jt.rpcCode->second + ")")) ||
bad =
(jt.rpcCode &&
!test.expect(
parsed.rpcCode == jt.rpcCode->first && parsed.rpcMessage == jt.rpcCode->second,
"apply " + locStr + ": Got RPC result "s +
(parsed.rpcCode ? RPC::getErrorInfo(*parsed.rpcCode).token.cStr() : "NO RESULT") +
" (" + parsed.rpcMessage + "); Expected " +
RPC::getErrorInfo(jt.rpcCode->first).token.cStr() + " (" + jt.rpcCode->second +
")")) ||
bad;
// If we have an rpcCode (just checked), then the rpcException check is
// optional - the 'error' field may not be defined, but if it is, it must
@@ -536,11 +536,11 @@ Env::tx() const
}
void
Env::autofill_sig(JTx& jt)
Env::autofillSig(JTx& jt)
{
auto& jv = jt.jv;
scope_success const success([&]() {
ScopeSuccess const success([&]() {
// Call all the post-signers after the main signers or autofill are done
for (auto const& signer : jt.postSigners)
signer(*this, jt);
@@ -555,7 +555,7 @@ Env::autofill_sig(JTx& jt)
}
// If the sig is still needed, get it here.
if (!jt.fill_sig)
if (!jt.fillSig)
return;
auto const account = jv.isMember(sfDelegate.jsonName)
? lookup(jv[sfDelegate.jsonName].asString())
@@ -582,12 +582,12 @@ void
Env::autofill(JTx& jt)
{
auto& jv = jt.jv;
if (jt.fill_fee)
jtx::fill_fee(jv, *current());
if (jt.fill_seq)
jtx::fill_seq(jv, *current());
if (jt.fillFee)
jtx::fillFee(jv, *current());
if (jt.fillSeq)
jtx::fillSeq(jv, *current());
if (jt.fill_netid)
if (jt.fillNetid)
{
uint32_t const networkID = app().getNetworkIDService().getNetworkID();
if (!jv.isMember(jss::NetworkID) && networkID > 1024)
@@ -597,13 +597,13 @@ Env::autofill(JTx& jt)
// Must come last
try
{
autofill_sig(jt);
autofillSig(jt);
}
catch (parse_error const&)
catch (ParseError const&)
{
if (!parseFailureExpected_)
test.log << "parse failed:\n" << pretty(jv) << std::endl;
Rethrow();
rethrow();
}
}
@@ -617,10 +617,10 @@ Env::st(JTx const& jt)
{
obj = jtx::parse(jt.jv);
}
catch (jtx::parse_error const&)
catch (jtx::ParseError const&)
{
test.log << "Exception: parse_error\n" << pretty(jt.jv) << std::endl;
Rethrow();
test.log << "Exception: ParseError\n" << pretty(jt.jv) << std::endl;
rethrow();
}
try
@@ -643,10 +643,10 @@ Env::ust(JTx const& jt)
{
obj = jtx::parse(jt.jv);
}
catch (jtx::parse_error const&)
catch (jtx::ParseError const&)
{
test.log << "Exception: parse_error\n" << pretty(jt.jv) << std::endl;
Rethrow();
test.log << "Exception: ParseError\n" << pretty(jt.jv) << std::endl;
rethrow();
}
try
@@ -659,17 +659,17 @@ Env::ust(JTx const& jt)
}
}
Json::Value
Env::do_rpc(
json::Value
Env::doRpc(
unsigned apiVersion,
std::vector<std::string> const& args,
std::unordered_map<std::string, std::string> const& headers)
{
auto response = rpcClient(args, app().config(), app().getLogs(), apiVersion, headers);
for (unsigned ctr = 0; (ctr < retries_) and (response.first == rpcINTERNAL); ++ctr)
for (unsigned ctr = 0; (ctr < retries_) and (response.first == RpcInternal); ++ctr)
{
JLOG(journal.error()) << "Env::do_rpc error, retrying, attempt #" << ctr + 1 << " ...";
JLOG(journal.error()) << "Env::doRpc error, retrying, attempt #" << ctr + 1 << " ...";
std::this_thread::sleep_for(std::chrono::milliseconds(500));
response = rpcClient(args, app().config(), app().getLogs(), apiVersion, headers);