mirror of
https://github.com/XRPLF/clio.git
synced 2026-08-03 12:11:07 +00:00
chore: Fixes after tidy v22 update (#3108)
This commit is contained in:
22
.github/workflows/clang-tidy.yml
vendored
22
.github/workflows/clang-tidy.yml
vendored
@@ -28,9 +28,10 @@ env:
|
||||
BUILD_DIR: build
|
||||
BUILD_TYPE: Debug # Debug so that ASSERTS and such participate in clang-tidy check
|
||||
|
||||
OUTPUT_FILE: clang-tidy-output.txt
|
||||
DIFF_FILE: clang-tidy-git-diff.txt
|
||||
ISSUE_FILE: clang-tidy-issue.md
|
||||
OUTPUT_FILE: /tmp/clang-tidy-output.txt
|
||||
FILTERED_OUTPUT_FILE: /tmp/clang-tidy-filtered-output.txt
|
||||
DIFF_FILE: /tmp/clang-tidy-git-diff.txt
|
||||
ISSUE_FILE: /tmp/clang-tidy-issue.md
|
||||
|
||||
COMPILER: clang
|
||||
|
||||
@@ -154,21 +155,21 @@ jobs:
|
||||
run: |
|
||||
if [ -f "${OUTPUT_FILE}" ]; then
|
||||
# Extract lines containing 'error:', 'warning:', or 'note:'
|
||||
grep -E '(error:|warning:|note:)' "${OUTPUT_FILE}" >filtered-output.txt || true
|
||||
grep -E '(error:|warning:|note:)' "${OUTPUT_FILE}" >"${FILTERED_OUTPUT_FILE}" || true
|
||||
|
||||
# If filtered output is empty, use original (might be a different error format)
|
||||
if [ ! -s filtered-output.txt ]; then
|
||||
cp "${OUTPUT_FILE}" filtered-output.txt
|
||||
if [ ! -s "${FILTERED_OUTPUT_FILE}" ]; then
|
||||
cp "${OUTPUT_FILE}" "${FILTERED_OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
# Truncate if too large
|
||||
head -c 60000 filtered-output.txt >>"${ISSUE_FILE}"
|
||||
if [ "$(wc -c <filtered-output.txt)" -gt 60000 ]; then
|
||||
head -c 60000 "${FILTERED_OUTPUT_FILE}" >>"${ISSUE_FILE}"
|
||||
if [ "$(wc -c <"${FILTERED_OUTPUT_FILE}")" -gt 60000 ]; then
|
||||
echo "" >>"${ISSUE_FILE}"
|
||||
echo "... (output truncated, see artifacts for full output)" >>"${ISSUE_FILE}"
|
||||
fi
|
||||
|
||||
rm filtered-output.txt
|
||||
rm "${FILTERED_OUTPUT_FILE}"
|
||||
else
|
||||
echo "No output file found" >>"${ISSUE_FILE}"
|
||||
fi
|
||||
@@ -184,6 +185,7 @@ jobs:
|
||||
EOF
|
||||
|
||||
- name: Create issue
|
||||
id: create_issue
|
||||
if: ${{ steps.run_clang_tidy.outcome != 'success' && github.event_name != 'pull_request' }}
|
||||
uses: XRPLF/actions/create-issue@2b8bc36af85b88bca0dd7bfac2e2dc05f94ad712
|
||||
with:
|
||||
@@ -212,7 +214,7 @@ jobs:
|
||||
branch: "clang_tidy/autofix"
|
||||
branch-suffix: timestamp
|
||||
delete-branch: true
|
||||
title: "style: clang-tidy auto fixes"
|
||||
title: "style: Apply clang-tidy auto fixes"
|
||||
body: >
|
||||
Fixes #${{ steps.create_issue.outputs.issue_number }}.
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
*
|
||||
* @return The UUID of this node.
|
||||
*/
|
||||
ClioNode::CUuid
|
||||
[[nodiscard]] ClioNode::CUuid
|
||||
selfId() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "util/config/ConfigDefinition.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ BackendInterface::fetchBookOffers(
|
||||
<< " blob = " << ripple::strHex(objs[i])
|
||||
<< " ledgerSequence = " << ledgerSequence;
|
||||
ASSERT(!objs[i].empty(), "Ledger object can't be empty");
|
||||
page.offers.push_back({keys[i], objs[i]});
|
||||
page.offers.push_back({.key = keys[i], .blob = objs[i]});
|
||||
}
|
||||
auto end = std::chrono::system_clock::now();
|
||||
LOG(log_.debug()) << "Fetching " << std::to_string(keys.size()) << " offers took "
|
||||
@@ -328,7 +328,7 @@ BackendInterface::fetchLedgerPage(
|
||||
auto objects = fetchLedgerObjects(keys, ledgerSequence, yield);
|
||||
for (size_t i = 0; i < objects.size(); ++i) {
|
||||
if (!objects[i].empty()) {
|
||||
page.objects.push_back({keys[i], std::move(objects[i])});
|
||||
page.objects.push_back({.key = keys[i], .blob = std::move(objects[i])});
|
||||
} else if (!outOfOrder) {
|
||||
LOG(log_.error()) << "Deleted or non-existent object in successor table. key = "
|
||||
<< ripple::strHex(keys[i]) << " - seq = " << ledgerSequence;
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
/**
|
||||
* @return true if outstanding read requests allowance is exhausted; false otherwise
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isTooBusy() const
|
||||
{
|
||||
bool const result = numReadRequestsOutstanding_ >= maxReadRequestsOutstanding_;
|
||||
@@ -495,7 +495,7 @@ public:
|
||||
/**
|
||||
* @brief Get statistics about the backend.
|
||||
*/
|
||||
boost::json::object
|
||||
[[nodiscard]] boost::json::object
|
||||
stats() const
|
||||
{
|
||||
return counters_->report();
|
||||
@@ -536,13 +536,13 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
canAddWriteRequest() const
|
||||
{
|
||||
return numWriteRequestsOutstanding_ < maxWriteRequestsOutstanding_;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
finishedAllWriteRequests() const
|
||||
{
|
||||
return numWriteRequestsOutstanding_ == 0;
|
||||
|
||||
@@ -179,19 +179,19 @@ public:
|
||||
void
|
||||
stop() override;
|
||||
|
||||
boost::json::object
|
||||
[[nodiscard]] boost::json::object
|
||||
getInfo() const override;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isAmendmentBlocked() const override;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isCorruptionDetected() const override;
|
||||
|
||||
std::optional<ETLState>
|
||||
[[nodiscard]] std::optional<ETLState>
|
||||
getETLState() const override;
|
||||
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
lastCloseAgeSeconds() const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
@@ -109,7 +109,7 @@ struct ToNumber final {
|
||||
return {}; // ignore for non-string types
|
||||
|
||||
auto const strInt = boost::json::value_to<std::string>(value.as_object().at(key));
|
||||
if (strInt.find('.') != std::string::npos)
|
||||
if (strInt.contains('.'))
|
||||
return Error{Status{RippledError::rpcINVALID_PARAMS}}; // maybe a float
|
||||
|
||||
try {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include <charconv>
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <xrpl/protocol/Serializer.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ LedgerDataHandler::process(Input const& input, Context const& ctx) const
|
||||
for (size_t i = 0; i < objs.size(); ++i) {
|
||||
auto& obj = objs[i];
|
||||
if (!obj.empty())
|
||||
results.push_back({keys[i], std::move(obj)});
|
||||
results.push_back({.key = keys[i], .blob = std::move(obj)});
|
||||
}
|
||||
|
||||
if (*(input.diffMarker) > lgrInfo.seq)
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
*
|
||||
* @return The current value
|
||||
*/
|
||||
ValueType
|
||||
[[nodiscard]] ValueType
|
||||
value() const
|
||||
{
|
||||
return value_;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <boost/asio/spawn.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
*
|
||||
* @return size_t The number of coroutines in the group
|
||||
*/
|
||||
size_t
|
||||
[[nodiscard]] size_t
|
||||
size() const;
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
*
|
||||
* @return true If the group is full false otherwise
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isFull() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <boost/beast/http/field.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
*
|
||||
* @return The API subversion.
|
||||
*/
|
||||
uint32_t
|
||||
[[nodiscard]] uint32_t
|
||||
apiSubversion() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
*
|
||||
* @return The API subversion.
|
||||
*/
|
||||
uint32_t
|
||||
[[nodiscard]] uint32_t
|
||||
apiSubversion() const override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <thread>
|
||||
|
||||
@@ -209,14 +209,11 @@ TEST_F(CliArgsTestsWithTmpFile, Parse_ConfigDescriptionFileContent)
|
||||
inFile.close();
|
||||
|
||||
auto const fileContent = buffer.str();
|
||||
EXPECT_TRUE(fileContent.find("# Clio Config Description") != std::string::npos);
|
||||
EXPECT_TRUE(
|
||||
fileContent.find(
|
||||
"This document provides a list of all available Clio configuration properties in "
|
||||
"detail."
|
||||
) != std::string::npos
|
||||
);
|
||||
EXPECT_TRUE(fileContent.find("## Configuration Details") != std::string::npos);
|
||||
EXPECT_TRUE(fileContent.contains("# Clio Config Description"));
|
||||
EXPECT_TRUE(fileContent.contains(
|
||||
"This document provides a list of all available Clio configuration properties in detail."
|
||||
));
|
||||
EXPECT_TRUE(fileContent.contains("## Configuration Details"));
|
||||
|
||||
// all keys that exist in clio config should be listed in config description file
|
||||
for (auto const& key : getClioConfig())
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
@@ -472,7 +472,7 @@ TEST_F(BackendCassandraExecutionStrategyTest, StatsCallsCountersReport)
|
||||
{
|
||||
auto strat = makeStrategy();
|
||||
EXPECT_CALL(*counters_, report());
|
||||
strat.stats();
|
||||
[[maybe_unused]] auto _ = strat.stats();
|
||||
}
|
||||
|
||||
TEST_F(BackendCassandraExecutionStrategyTest, WriteEachAndCallSyncSucceeds)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <semaphore>
|
||||
|
||||
using namespace etl::impl;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <fmt/format.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace etl;
|
||||
using namespace util::config;
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace feed::impl;
|
||||
namespace json = boost::json;
|
||||
using namespace util::prometheus;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -712,7 +712,7 @@ TEST_F(WebServerTest, AdminErrorCfgTestBothAdminPasswordAndLocalAdminSet)
|
||||
boost::json::parse(jsonServerConfigWithBothAdminPasswordAndLocalAdmin)
|
||||
)};
|
||||
|
||||
MockLedgerCache cache;
|
||||
MockLedgerCache const cache;
|
||||
auto const result = web::makeHttpServer(serverConfig, ctx, dosGuardOverload, e, cache);
|
||||
EXPECT_FALSE(result.has_value());
|
||||
}
|
||||
@@ -736,7 +736,7 @@ TEST_F(WebServerTest, AdminErrorCfgTestBothAdminPasswordAndLocalAdminFalse)
|
||||
boost::json::parse(jsonServerConfigWithNoAdminPasswordAndLocalAdminFalse)
|
||||
)};
|
||||
|
||||
MockLedgerCache cache;
|
||||
MockLedgerCache const cache;
|
||||
auto const result = web::makeHttpServer(serverConfig, ctx, dosGuardOverload, e, cache);
|
||||
EXPECT_FALSE(result.has_value());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user