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

@@ -48,11 +48,11 @@ class WSClientImpl : public WSClient
{
using error_code = boost::system::error_code;
struct msg
struct Msg
{
Json::Value jv;
json::Value jv;
explicit msg(Json::Value&& jv_) : jv(std::move(jv_))
explicit Msg(json::Value&& jv) : jv(std::move(jv))
{
}
};
@@ -62,14 +62,14 @@ class WSClientImpl : public WSClient
{
auto& log = std::cerr;
ParsedPort common;
parse_Port(common, cfg["server"], log);
parsePort(common, cfg["server"], log);
auto const ps = v2 ? "ws2" : "ws";
for (auto const& name : cfg.section("server").values())
{
if (!cfg.exists(name))
continue;
ParsedPort pp;
parse_Port(pp, cfg[name], log);
parsePort(pp, cfg[name], log);
if (pp.protocol.count(ps) == 0)
continue;
using namespace boost::asio::ip;
@@ -90,7 +90,7 @@ class WSClientImpl : public WSClient
template <class ConstBuffers>
static std::string
buffer_string(ConstBuffers const& b)
bufferString(ConstBuffers const& b)
{
using boost::asio::buffer;
using boost::asio::buffer_size;
@@ -118,7 +118,7 @@ class WSClientImpl : public WSClient
// synchronize message queue
std::mutex m_;
std::condition_variable cv_;
std::list<std::shared_ptr<msg>> msgs_;
std::list<std::shared_ptr<Msg>> msgs_;
unsigned rpc_version_;
@@ -150,14 +150,14 @@ public:
WSClientImpl(
Config const& cfg,
bool v2,
unsigned rpc_version,
unsigned rpcVersion,
std::unordered_map<std::string, std::string> const& headers = {})
: work_(std::in_place, boost::asio::make_work_guard(ios_))
, strand_(boost::asio::make_strand(ios_))
, thread_([&] { ios_.run(); })
, stream_(ios_)
, ws_(stream_)
, rpc_version_(rpc_version)
, rpc_version_(rpcVersion)
{
try
{
@@ -173,12 +173,12 @@ public:
ws_.async_read(
rb_,
boost::asio::bind_executor(
strand_, std::bind(&WSClientImpl::on_read_msg, this, std::placeholders::_1)));
strand_, std::bind(&WSClientImpl::onReadMsg, this, std::placeholders::_1)));
}
catch (std::exception&)
{
cleanup();
Rethrow();
rethrow();
}
}
@@ -187,14 +187,14 @@ public:
cleanup();
}
Json::Value
invoke(std::string const& cmd, Json::Value const& params) override
json::Value
invoke(std::string const& cmd, json::Value const& params) override
{
using boost::asio::buffer;
using namespace std::chrono_literals;
{
Json::Value jp;
json::Value jp;
if (params)
jp = params;
if (rpc_version_ == 2)
@@ -220,14 +220,14 @@ public:
}
auto jv =
findMsg(5s, [&](Json::Value const& jval) { return jval[jss::type] == jss::response; });
findMsg(5s, [&](json::Value const& jval) { return jval[jss::type] == jss::response; });
if (jv)
{
// Normalize JSON output
jv->removeMember(jss::type);
if ((*jv).isMember(jss::status) && (*jv)[jss::status] == jss::error)
{
Json::Value ret;
json::Value ret;
ret[jss::result] = *jv;
if ((*jv).isMember(jss::error))
ret[jss::error] = (*jv)[jss::error];
@@ -241,10 +241,10 @@ public:
return {};
}
std::optional<Json::Value>
std::optional<json::Value>
getMsg(std::chrono::milliseconds const& timeout) override
{
std::shared_ptr<msg> m;
std::shared_ptr<Msg> m;
{
std::unique_lock<std::mutex> lock(m_);
if (!cv_.wait_for(lock, timeout, [&] { return !msgs_.empty(); }))
@@ -255,11 +255,11 @@ public:
return std::move(m->jv);
}
std::optional<Json::Value>
findMsg(std::chrono::milliseconds const& timeout, std::function<bool(Json::Value const&)> pred)
std::optional<json::Value>
findMsg(std::chrono::milliseconds const& timeout, std::function<bool(json::Value const&)> pred)
override
{
std::shared_ptr<msg> m;
std::shared_ptr<Msg> m;
{
std::unique_lock<std::mutex> lock(m_);
if (!cv_.wait_for(lock, timeout, [&] {
@@ -289,7 +289,7 @@ public:
private:
void
on_read_msg(error_code const& ec)
onReadMsg(error_code const& ec)
{
if (ec)
{
@@ -298,11 +298,11 @@ private:
return;
}
Json::Value jv;
Json::Reader jr;
jr.parse(buffer_string(rb_.data()), jv);
json::Value jv;
json::Reader jr;
jr.parse(bufferString(rb_.data()), jv);
rb_.consume(rb_.size());
auto m = std::make_shared<msg>(std::move(jv));
auto m = std::make_shared<Msg>(std::move(jv));
{
std::scoped_lock const lock(m_);
msgs_.push_front(m);
@@ -311,12 +311,12 @@ private:
ws_.async_read(
rb_,
boost::asio::bind_executor(
strand_, std::bind(&WSClientImpl::on_read_msg, this, std::placeholders::_1)));
strand_, std::bind(&WSClientImpl::onReadMsg, this, std::placeholders::_1)));
}
// Called when the read op terminates
void
on_read_done()
onReadDone()
{
std::scoped_lock const lock(m0_);
b0_ = true;
@@ -328,10 +328,10 @@ std::unique_ptr<WSClient>
makeWSClient(
Config const& cfg,
bool v2,
unsigned rpc_version,
unsigned rpcVersion,
std::unordered_map<std::string, std::string> const& headers)
{
return std::make_unique<WSClientImpl>(cfg, v2, rpc_version, headers);
return std::make_unique<WSClientImpl>(cfg, v2, rpcVersion, headers);
}
} // namespace xrpl::test