mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 07:10:53 +00:00
refactor: Enable clang-tidy readability-identifier-naming check (#6571)
This commit is contained in:
@@ -39,7 +39,7 @@ Oracle::Oracle(Env& env, CreateArg const& arg, bool submit) : env_(env)
|
||||
// on testStartTime since XRPL epoch.
|
||||
auto const now = env_.timeKeeper().now();
|
||||
if (now.time_since_epoch().count() == 0 || arg.close)
|
||||
env_.close(now + testStartTime - epoch_offset);
|
||||
env_.close(now + kTEST_START_TIME - kEPOCH_OFFSET);
|
||||
if (arg.owner)
|
||||
owner_ = *arg.owner;
|
||||
if (arg.documentID && validDocumentID(*arg.documentID))
|
||||
@@ -51,7 +51,7 @@ Oracle::Oracle(Env& env, CreateArg const& arg, bool submit) : env_(env)
|
||||
void
|
||||
Oracle::remove(RemoveArg const& arg)
|
||||
{
|
||||
Json::Value jv;
|
||||
json::Value jv;
|
||||
jv[jss::TransactionType] = jss::OracleDelete;
|
||||
jv[jss::Account] = to_string(arg.owner.value_or(owner_));
|
||||
toJson(jv[jss::OracleDocumentID], arg.documentID.value_or(documentID_));
|
||||
@@ -74,10 +74,10 @@ Oracle::remove(RemoveArg const& arg)
|
||||
|
||||
void
|
||||
Oracle::submit(
|
||||
Json::Value const& jv,
|
||||
std::optional<jtx::msig> const& msig,
|
||||
std::optional<jtx::seq> const& seq,
|
||||
std::optional<ter> const& err)
|
||||
json::Value const& jv,
|
||||
std::optional<jtx::Msig> const& msig,
|
||||
std::optional<jtx::Seq> const& seq,
|
||||
std::optional<Ter> const& err)
|
||||
{
|
||||
if (msig)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ Oracle::expectLastUpdateTime(std::uint32_t lastUpdateTime) const
|
||||
return sle && (*sle)[sfLastUpdateTime] == lastUpdateTime;
|
||||
}
|
||||
|
||||
Json::Value
|
||||
json::Value
|
||||
Oracle::aggregatePrice(
|
||||
Env& env,
|
||||
std::optional<AnyValue> const& baseAsset,
|
||||
@@ -166,13 +166,13 @@ Oracle::aggregatePrice(
|
||||
std::optional<AnyValue> const& trim,
|
||||
std::optional<AnyValue> const& timeThreshold)
|
||||
{
|
||||
Json::Value jv;
|
||||
Json::Value jvOracles(Json::arrayValue);
|
||||
json::Value jv;
|
||||
json::Value jvOracles(json::ArrayValue);
|
||||
if (oracles)
|
||||
{
|
||||
for (auto const& id : *oracles)
|
||||
{
|
||||
Json::Value oracle;
|
||||
json::Value oracle;
|
||||
if (id.first)
|
||||
oracle[jss::account] = to_string((*id.first).id());
|
||||
if (id.second)
|
||||
@@ -191,7 +191,7 @@ Oracle::aggregatePrice(
|
||||
toJson(jv[jss::time_threshold], *timeThreshold);
|
||||
// Convert "%None%" to None
|
||||
auto str = to_string(jv);
|
||||
str = boost::regex_replace(str, boost::regex(NonePattern), UnquotedNone);
|
||||
str = boost::regex_replace(str, boost::regex(kNONE_PATTERN), kUNQUOTED_NONE);
|
||||
auto jr = env.rpc("json", "get_aggregate_price", str);
|
||||
|
||||
if (jr.isObject())
|
||||
@@ -205,14 +205,14 @@ Oracle::aggregatePrice(
|
||||
return jr;
|
||||
}
|
||||
}
|
||||
return Json::nullValue;
|
||||
return json::NullValue;
|
||||
}
|
||||
|
||||
void
|
||||
Oracle::set(UpdateArg const& arg)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
Json::Value jv;
|
||||
json::Value jv;
|
||||
if (arg.owner)
|
||||
owner_ = *arg.owner;
|
||||
if (arg.documentID && std::holds_alternative<std::uint32_t>(*arg.documentID))
|
||||
@@ -256,7 +256,7 @@ Oracle::set(UpdateArg const& arg)
|
||||
if (std::holds_alternative<std::uint32_t>(*arg.lastUpdateTime))
|
||||
{
|
||||
jv[jss::LastUpdateTime] =
|
||||
to_string(testStartTime.count() + std::get<std::uint32_t>(*arg.lastUpdateTime));
|
||||
to_string(kTEST_START_TIME.count() + std::get<std::uint32_t>(*arg.lastUpdateTime));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -267,9 +267,9 @@ Oracle::set(UpdateArg const& arg)
|
||||
{
|
||||
jv[jss::LastUpdateTime] = to_string(
|
||||
duration_cast<seconds>(env_.current()->header().closeTime.time_since_epoch()).count() +
|
||||
epoch_offset.count());
|
||||
kEPOCH_OFFSET.count());
|
||||
}
|
||||
Json::Value dataSeries(Json::arrayValue);
|
||||
json::Value dataSeries(json::ArrayValue);
|
||||
auto assetToStr = [](std::string const& s) {
|
||||
// assume standard currency
|
||||
if (s.size() == 3)
|
||||
@@ -280,8 +280,8 @@ Oracle::set(UpdateArg const& arg)
|
||||
};
|
||||
for (auto const& data : arg.series)
|
||||
{
|
||||
Json::Value priceData;
|
||||
Json::Value price;
|
||||
json::Value priceData;
|
||||
json::Value price;
|
||||
price[jss::BaseAsset] = assetToStr(std::get<0>(data));
|
||||
price[jss::QuoteAsset] = assetToStr(std::get<1>(data));
|
||||
if (std::get<2>(data))
|
||||
@@ -316,14 +316,14 @@ Oracle::set(CreateArg const& arg)
|
||||
.err = arg.err});
|
||||
}
|
||||
|
||||
Json::Value
|
||||
json::Value
|
||||
Oracle::ledgerEntry(
|
||||
Env& env,
|
||||
std::optional<std::variant<AccountID, std::string>> const& account,
|
||||
std::optional<AnyValue> const& documentID,
|
||||
std::optional<std::string> const& index)
|
||||
{
|
||||
Json::Value jvParams;
|
||||
json::Value jvParams;
|
||||
if (account)
|
||||
{
|
||||
if (std::holds_alternative<AccountID>(*account))
|
||||
@@ -351,7 +351,7 @@ Oracle::ledgerEntry(
|
||||
}
|
||||
// Convert "%None%" to None
|
||||
auto str = to_string(jvParams);
|
||||
str = boost::regex_replace(str, boost::regex(NonePattern), UnquotedNone);
|
||||
str = boost::regex_replace(str, boost::regex(kNONE_PATTERN), kUNQUOTED_NONE);
|
||||
auto jr = env.rpc("json", "ledger_entry", str);
|
||||
|
||||
if (jr.isObject())
|
||||
@@ -361,17 +361,17 @@ Oracle::ledgerEntry(
|
||||
if (jr.isMember(jss::result) && jr[jss::result].isMember(jss::status))
|
||||
return jr[jss::result];
|
||||
}
|
||||
return Json::nullValue;
|
||||
return json::NullValue;
|
||||
}
|
||||
|
||||
void
|
||||
toJson(Json::Value& jv, AnyValue const& v)
|
||||
toJson(json::Value& jv, AnyValue const& v)
|
||||
{
|
||||
std::visit([&](auto&& arg) { jv = arg; }, v);
|
||||
}
|
||||
|
||||
void
|
||||
toJsonHex(Json::Value& jv, AnyValue const& v)
|
||||
toJsonHex(json::Value& jv, AnyValue const& v)
|
||||
{
|
||||
std::visit(
|
||||
[&]<typename T>(T&& arg) {
|
||||
@@ -397,7 +397,7 @@ toJsonHex(Json::Value& jv, AnyValue const& v)
|
||||
std::uint32_t
|
||||
asUInt(AnyValue const& v)
|
||||
{
|
||||
Json::Value jv;
|
||||
json::Value jv;
|
||||
toJson(jv, v);
|
||||
return jv.asUInt();
|
||||
}
|
||||
@@ -407,7 +407,7 @@ validDocumentID(AnyValue const& v)
|
||||
{
|
||||
try
|
||||
{
|
||||
Json::Value jv;
|
||||
json::Value jv;
|
||||
toJson(jv, v);
|
||||
[[maybe_unused]] auto unused1 = jv.asUInt();
|
||||
[[maybe_unused]] auto unused2 = jv.isNumeric();
|
||||
|
||||
Reference in New Issue
Block a user