Fix .clang-tidy
camelLower is not a type, camelBack is.
Changes were made automatically with clang-tidy --fix-errors
To be able to apply changes automatically, the only way I've found that
works was to build the version of clang/clang-tidy that yocto has, and
run the fix script within bitbake -c devshell bmcweb. Unfortunately,
yocto has clang-tidy 11, which can apparently find a couple extra errors
in tests we already had enabled. As such, a couple of those are also
included.
Tested:
Ran clang-tidy-11 and got a clean result.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I9d1080b67f0342229c2f267160849445c065ca51
diff --git a/http/app.hpp b/http/app.hpp
index 9a4eb20..023eabb 100644
--- a/http/app.hpp
+++ b/http/app.hpp
@@ -65,9 +65,9 @@
return router.newRuleTagged<Tag>(std::move(rule));
}
- App& socket(int existing_socket)
+ App& socket(int existingSocket)
{
- socketFd = existing_socket;
+ socketFd = existingSocket;
return *this;
}
@@ -143,14 +143,13 @@
}
#ifdef BMCWEB_ENABLE_SSL
- App& sslFile(const std::string& crt_filename,
- const std::string& key_filename)
+ App& sslFile(const std::string& crtFilename, const std::string& keyFilename)
{
sslContext = std::make_shared<ssl_context_t>(
boost::asio::ssl::context::tls_server);
sslContext->set_verify_mode(boost::asio::ssl::verify_peer);
- sslContext->use_certificate_file(crt_filename, ssl_context_t::pem);
- sslContext->use_private_key_file(key_filename, ssl_context_t::pem);
+ sslContext->use_certificate_file(crtFilename, ssl_context_t::pem);
+ sslContext->use_private_key_file(keyFilename, ssl_context_t::pem);
sslContext->set_options(boost::asio::ssl::context::default_workarounds |
boost::asio::ssl::context::no_sslv2 |
boost::asio::ssl::context::no_sslv3 |
@@ -159,12 +158,12 @@
return *this;
}
- App& sslFile(const std::string& pem_filename)
+ App& sslFile(const std::string& pemFilename)
{
sslContext = std::make_shared<ssl_context_t>(
boost::asio::ssl::context::tls_server);
sslContext->set_verify_mode(boost::asio::ssl::verify_peer);
- sslContext->load_verify_file(pem_filename);
+ sslContext->load_verify_file(pemFilename);
sslContext->set_options(boost::asio::ssl::context::default_workarounds |
boost::asio::ssl::context::no_sslv2 |
boost::asio::ssl::context::no_sslv3 |
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 506f132..39ac39e 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -60,10 +60,10 @@
{
public:
Connection(Handler* handlerIn,
- std::function<std::string()>& get_cached_date_str_f,
+ std::function<std::string()>& getCachedDateStrF,
detail::TimerQueue& timerQueueIn, Adaptor adaptorIn) :
adaptor(std::move(adaptorIn)),
- handler(handlerIn), getCachedDateStr(get_cached_date_str_f),
+ handler(handlerIn), getCachedDateStr(getCachedDateStrF),
timerQueue(timerQueueIn)
{
parser.emplace(std::piecewise_construct, std::make_tuple());
@@ -498,9 +498,9 @@
adaptor, buffer, *parser,
[this,
self(shared_from_this())](const boost::system::error_code& ec,
- std::size_t bytes_transferred) {
+ std::size_t bytesTransferred) {
BMCWEB_LOG_ERROR << this << " async_read_header "
- << bytes_transferred << " Bytes";
+ << bytesTransferred << " Bytes";
bool errorWhileReading = false;
if (ec)
{
@@ -599,8 +599,8 @@
adaptor, buffer, *parser,
[this,
self(shared_from_this())](const boost::system::error_code& ec,
- std::size_t bytes_transferred) {
- BMCWEB_LOG_DEBUG << this << " async_read " << bytes_transferred
+ std::size_t bytesTransferred) {
+ BMCWEB_LOG_DEBUG << this << " async_read " << bytesTransferred
<< " Bytes";
bool errorWhileReading = false;
@@ -659,8 +659,8 @@
adaptor, *serializer,
[this,
self(shared_from_this())](const boost::system::error_code& ec,
- std::size_t bytes_transferred) {
- BMCWEB_LOG_DEBUG << this << " async_write " << bytes_transferred
+ std::size_t bytesTransferred) {
+ BMCWEB_LOG_DEBUG << this << " async_write " << bytesTransferred
<< " bytes";
cancelDeadlineTimer();
diff --git a/http/http_response.hpp b/http/http_response.hpp
index 7b8b5d9..cd00ec8 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -102,9 +102,9 @@
completed = false;
}
- void write(std::string_view body_part)
+ void write(std::string_view bodyPart)
{
- stringResponse->body() += std::string(body_part);
+ stringResponse->body() += std::string(bodyPart);
}
void end()
@@ -123,9 +123,9 @@
}
}
- void end(std::string_view body_part)
+ void end(std::string_view bodyPart)
{
- write(body_part);
+ write(bodyPart);
end();
}
diff --git a/http/http_server.hpp b/http/http_server.hpp
index 0be487f..20b4e50 100644
--- a/http/http_server.hpp
+++ b/http/http_server.hpp
@@ -31,34 +31,34 @@
public:
Server(Handler* handlerIn,
std::unique_ptr<boost::asio::ip::tcp::acceptor>&& acceptorIn,
- std::shared_ptr<boost::asio::ssl::context> adaptor_ctx,
+ std::shared_ptr<boost::asio::ssl::context> adaptorCtx,
std::shared_ptr<boost::asio::io_context> io =
std::make_shared<boost::asio::io_context>()) :
ioService(std::move(io)),
acceptor(std::move(acceptorIn)),
signals(*ioService, SIGINT, SIGTERM, SIGHUP), timer(*ioService),
- handler(handlerIn), adaptorCtx(std::move(adaptor_ctx))
+ handler(handlerIn), adaptorCtx(std::move(adaptorCtx))
{}
Server(Handler* handlerIn, const std::string& bindaddr, uint16_t port,
- const std::shared_ptr<boost::asio::ssl::context>& adaptor_ctx,
+ const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx,
const std::shared_ptr<boost::asio::io_context>& io =
std::make_shared<boost::asio::io_context>()) :
Server(handlerIn,
std::make_unique<boost::asio::ip::tcp::acceptor>(
*io, boost::asio::ip::tcp::endpoint(
boost::asio::ip::make_address(bindaddr), port)),
- adaptor_ctx, io)
+ adaptorCtx, io)
{}
- Server(Handler* handlerIn, int existing_socket,
- const std::shared_ptr<boost::asio::ssl::context>& adaptor_ctx,
+ Server(Handler* handlerIn, int existingSocket,
+ const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx,
const std::shared_ptr<boost::asio::io_context>& io =
std::make_shared<boost::asio::io_context>()) :
Server(handlerIn,
std::make_unique<boost::asio::ip::tcp::acceptor>(
- *io, boost::asio::ip::tcp::v6(), existing_socket),
- adaptor_ctx, io)
+ *io, boost::asio::ip::tcp::v6(), existingSocket),
+ adaptorCtx, io)
{}
void updateDateStr()
diff --git a/http/routing.hpp b/http/routing.hpp
index d547348..b4ebede 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -417,10 +417,10 @@
}
template <typename... MethodArgs>
- self_t& methods(boost::beast::http::verb method, MethodArgs... args_method)
+ self_t& methods(boost::beast::http::verb method, MethodArgs... argsMethod)
{
self_t* self = static_cast<self_t*>(this);
- methods(args_method...);
+ methods(argsMethod...);
self->methodsBitfield |= 1U << static_cast<size_t>(method);
return *self;
}
@@ -722,8 +722,8 @@
optimize();
}
- void findRouteIndexes(const std::string& req_url,
- std::vector<unsigned>& route_indexes,
+ void findRouteIndexes(const std::string& reqUrl,
+ std::vector<unsigned>& routeIndexes,
const Node* node = nullptr, unsigned pos = 0) const
{
if (node == nullptr)
@@ -734,21 +734,21 @@
{
const std::string& fragment = kv.first;
const Node* child = &nodes[kv.second];
- if (pos >= req_url.size())
+ if (pos >= reqUrl.size())
{
if (child->ruleIndex != 0 && fragment != "/")
{
- route_indexes.push_back(child->ruleIndex);
+ routeIndexes.push_back(child->ruleIndex);
}
- findRouteIndexes(req_url, route_indexes, child,
+ findRouteIndexes(reqUrl, routeIndexes, child,
static_cast<unsigned>(pos + fragment.size()));
}
else
{
- if (req_url.compare(pos, fragment.size(), fragment) == 0)
+ if (reqUrl.compare(pos, fragment.size(), fragment) == 0)
{
findRouteIndexes(
- req_url, route_indexes, child,
+ reqUrl, routeIndexes, child,
static_cast<unsigned>(pos + fragment.size()));
}
}
@@ -756,7 +756,7 @@
}
std::pair<unsigned, RoutingParams>
- find(const std::string_view req_url, const Node* node = nullptr,
+ find(const std::string_view reqUrl, const Node* node = nullptr,
size_t pos = 0, RoutingParams* params = nullptr) const
{
RoutingParams empty;
@@ -772,7 +772,7 @@
{
node = head();
}
- if (pos == req_url.size())
+ if (pos == reqUrl.size())
{
return {node->ruleIndex, *params};
}
@@ -788,21 +788,21 @@
if (node->paramChildrens[static_cast<size_t>(ParamType::INT)])
{
- char c = req_url[pos];
+ char c = reqUrl[pos];
if ((c >= '0' && c <= '9') || c == '+' || c == '-')
{
char* eptr;
errno = 0;
long long int value =
- std::strtoll(req_url.data() + pos, &eptr, 10);
- if (errno != ERANGE && eptr != req_url.data() + pos)
+ std::strtoll(reqUrl.data() + pos, &eptr, 10);
+ if (errno != ERANGE && eptr != reqUrl.data() + pos)
{
params->intParams.push_back(value);
- std::pair<unsigned, RoutingParams> ret = find(
- req_url,
- &nodes[node->paramChildrens[static_cast<size_t>(
- ParamType::INT)]],
- static_cast<size_t>(eptr - req_url.data()), params);
+ std::pair<unsigned, RoutingParams> ret =
+ find(reqUrl,
+ &nodes[node->paramChildrens[static_cast<size_t>(
+ ParamType::INT)]],
+ static_cast<size_t>(eptr - reqUrl.data()), params);
updateFound(ret);
params->intParams.pop_back();
}
@@ -811,21 +811,21 @@
if (node->paramChildrens[static_cast<size_t>(ParamType::UINT)])
{
- char c = req_url[pos];
+ char c = reqUrl[pos];
if ((c >= '0' && c <= '9') || c == '+')
{
char* eptr;
errno = 0;
unsigned long long int value =
- std::strtoull(req_url.data() + pos, &eptr, 10);
- if (errno != ERANGE && eptr != req_url.data() + pos)
+ std::strtoull(reqUrl.data() + pos, &eptr, 10);
+ if (errno != ERANGE && eptr != reqUrl.data() + pos)
{
params->uintParams.push_back(value);
- std::pair<unsigned, RoutingParams> ret = find(
- req_url,
- &nodes[node->paramChildrens[static_cast<size_t>(
- ParamType::UINT)]],
- static_cast<size_t>(eptr - req_url.data()), params);
+ std::pair<unsigned, RoutingParams> ret =
+ find(reqUrl,
+ &nodes[node->paramChildrens[static_cast<size_t>(
+ ParamType::UINT)]],
+ static_cast<size_t>(eptr - reqUrl.data()), params);
updateFound(ret);
params->uintParams.pop_back();
}
@@ -834,20 +834,20 @@
if (node->paramChildrens[static_cast<size_t>(ParamType::DOUBLE)])
{
- char c = req_url[pos];
+ char c = reqUrl[pos];
if ((c >= '0' && c <= '9') || c == '+' || c == '-' || c == '.')
{
char* eptr;
errno = 0;
- double value = std::strtod(req_url.data() + pos, &eptr);
- if (errno != ERANGE && eptr != req_url.data() + pos)
+ double value = std::strtod(reqUrl.data() + pos, &eptr);
+ if (errno != ERANGE && eptr != reqUrl.data() + pos)
{
params->doubleParams.push_back(value);
- std::pair<unsigned, RoutingParams> ret = find(
- req_url,
- &nodes[node->paramChildrens[static_cast<size_t>(
- ParamType::DOUBLE)]],
- static_cast<size_t>(eptr - req_url.data()), params);
+ std::pair<unsigned, RoutingParams> ret =
+ find(reqUrl,
+ &nodes[node->paramChildrens[static_cast<size_t>(
+ ParamType::DOUBLE)]],
+ static_cast<size_t>(eptr - reqUrl.data()), params);
updateFound(ret);
params->doubleParams.pop_back();
}
@@ -857,9 +857,9 @@
if (node->paramChildrens[static_cast<size_t>(ParamType::STRING)])
{
size_t epos = pos;
- for (; epos < req_url.size(); epos++)
+ for (; epos < reqUrl.size(); epos++)
{
- if (req_url[epos] == '/')
+ if (reqUrl[epos] == '/')
{
break;
}
@@ -868,9 +868,9 @@
if (epos != pos)
{
params->stringParams.emplace_back(
- req_url.substr(pos, epos - pos));
+ reqUrl.substr(pos, epos - pos));
std::pair<unsigned, RoutingParams> ret =
- find(req_url,
+ find(reqUrl,
&nodes[node->paramChildrens[static_cast<size_t>(
ParamType::STRING)]],
epos, params);
@@ -881,14 +881,14 @@
if (node->paramChildrens[static_cast<size_t>(ParamType::PATH)])
{
- size_t epos = req_url.size();
+ size_t epos = reqUrl.size();
if (epos != pos)
{
params->stringParams.emplace_back(
- req_url.substr(pos, epos - pos));
+ reqUrl.substr(pos, epos - pos));
std::pair<unsigned, RoutingParams> ret =
- find(req_url,
+ find(reqUrl,
&nodes[node->paramChildrens[static_cast<size_t>(
ParamType::PATH)]],
epos, params);
@@ -902,10 +902,10 @@
const std::string& fragment = kv.first;
const Node* child = &nodes[kv.second];
- if (req_url.compare(pos, fragment.size(), fragment) == 0)
+ if (reqUrl.compare(pos, fragment.size(), fragment) == 0)
{
std::pair<unsigned, RoutingParams> ret =
- find(req_url, child, pos + fragment.size(), params);
+ find(reqUrl, child, pos + fragment.size(), params);
updateFound(ret);
}
}
diff --git a/http/websocket.hpp b/http/websocket.hpp
index f5c2a7a..363076e 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -66,17 +66,17 @@
ConnectionImpl(
const crow::Request& reqIn, Adaptor adaptorIn,
std::function<void(Connection&, std::shared_ptr<bmcweb::AsyncResp>)>
- open_handler,
+ openHandler,
std::function<void(Connection&, const std::string&, bool)>
- message_handler,
- std::function<void(Connection&, const std::string&)> close_handler,
- std::function<void(Connection&)> error_handler) :
+ messageHandler,
+ std::function<void(Connection&, const std::string&)> closeHandler,
+ std::function<void(Connection&)> errorHandler) :
Connection(reqIn, reqIn.session->username),
ws(std::move(adaptorIn)), inString(), inBuffer(inString, 131088),
- openHandler(std::move(open_handler)),
- messageHandler(std::move(message_handler)),
- closeHandler(std::move(close_handler)),
- errorHandler(std::move(error_handler)), session(reqIn.session)
+ openHandler(std::move(openHandler)),
+ messageHandler(std::move(messageHandler)),
+ closeHandler(std::move(closeHandler)),
+ errorHandler(std::move(errorHandler)), session(reqIn.session)
{
BMCWEB_LOG_DEBUG << "Creating new connection " << this;
}
@@ -202,7 +202,7 @@
{
ws.async_read(inBuffer,
[this, self(shared_from_this())](
- boost::beast::error_code ec, std::size_t bytes_read) {
+ boost::beast::error_code ec, std::size_t bytesRead) {
if (ec)
{
if (ec != boost::beast::websocket::error::closed)
@@ -220,7 +220,7 @@
{
messageHandler(*this, inString, ws.got_text());
}
- inBuffer.consume(bytes_read);
+ inBuffer.consume(bytesRead);
inString.clear();
doRead();
});