mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-12 07:45:52 +00:00
style: clang-tidy auto fixes (#1659)
Fixes #1658. Please review and commit clang-tidy fixes. Co-authored-by: kuznetsss <15742918+kuznetsss@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
13a9aef579
commit
c409f8b2d6
@@ -22,8 +22,6 @@
|
||||
#include "util/newconfig/Error.hpp"
|
||||
#include "util/newconfig/Types.hpp"
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <regex>
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
// see here for more info:
|
||||
// https://stackoverflow.com/questions/72835571/constexpr-c-error-destructor-used-before-its-definition
|
||||
// https://godbolt.org/z/eMdWThaMY
|
||||
constexpr virtual ~Constraint() noexcept {};
|
||||
constexpr virtual ~Constraint() noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Check if the value meets the specific constraint.
|
||||
@@ -155,9 +155,8 @@ protected:
|
||||
*/
|
||||
class PortConstraint final : public Constraint {
|
||||
public:
|
||||
constexpr ~PortConstraint()
|
||||
{
|
||||
}
|
||||
constexpr ~PortConstraint() override
|
||||
= default;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -187,9 +186,8 @@ private:
|
||||
*/
|
||||
class ValidIPConstraint final : public Constraint {
|
||||
public:
|
||||
constexpr ~ValidIPConstraint()
|
||||
{
|
||||
}
|
||||
constexpr ~ValidIPConstraint() override
|
||||
= default;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -229,9 +227,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr ~OneOf()
|
||||
{
|
||||
}
|
||||
constexpr ~OneOf() override
|
||||
= default;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -285,9 +282,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr ~NumberValueConstraint()
|
||||
{
|
||||
}
|
||||
constexpr ~NumberValueConstraint() override
|
||||
= default;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -328,9 +324,8 @@ private:
|
||||
*/
|
||||
class PositiveDouble final : public Constraint {
|
||||
public:
|
||||
constexpr ~PositiveDouble()
|
||||
{
|
||||
}
|
||||
constexpr ~PositiveDouble() override
|
||||
= default;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -133,7 +133,7 @@ void
|
||||
ConfigFileJson::flattenJson(boost::json::object const& obj, std::string const& prefix)
|
||||
{
|
||||
for (auto const& [key, value] : obj) {
|
||||
std::string fullKey = prefix.empty() ? std::string(key) : fmt::format("{}.{}", prefix, std::string(key));
|
||||
std::string const fullKey = prefix.empty() ? std::string(key) : fmt::format("{}.{}", prefix, std::string(key));
|
||||
|
||||
// In ClioConfigDefinition, value must be a primitive or array
|
||||
if (value.is_object()) {
|
||||
@@ -141,7 +141,7 @@ ConfigFileJson::flattenJson(boost::json::object const& obj, std::string const& p
|
||||
} else if (value.is_array()) {
|
||||
auto const& arr = value.as_array();
|
||||
for (std::size_t i = 0; i < arr.size(); ++i) {
|
||||
std::string arrayPrefix = fullKey + ".[]";
|
||||
std::string const arrayPrefix = fullKey + ".[]";
|
||||
if (arr[i].is_object()) {
|
||||
flattenJson(arr[i].as_object(), arrayPrefix);
|
||||
} else {
|
||||
|
||||
@@ -47,11 +47,11 @@ TEST(ArrayTest, addAndCheckMultipleValues)
|
||||
EXPECT_EQ(arr.size(), 3);
|
||||
|
||||
auto const cv = arr.at(0);
|
||||
ValueView vv{cv};
|
||||
ValueView const vv{cv};
|
||||
EXPECT_EQ(vv.asDouble(), 111.11);
|
||||
|
||||
auto const cv2 = arr.at(1);
|
||||
ValueView vv2{cv2};
|
||||
ValueView const vv2{cv2};
|
||||
EXPECT_EQ(vv2.asDouble(), 222.22);
|
||||
|
||||
EXPECT_EQ(arr.size(), 3);
|
||||
@@ -59,7 +59,7 @@ TEST(ArrayTest, addAndCheckMultipleValues)
|
||||
|
||||
EXPECT_EQ(arr.size(), 4);
|
||||
auto const cv4 = arr.at(3);
|
||||
ValueView vv4{cv4};
|
||||
ValueView const vv4{cv4};
|
||||
EXPECT_EQ(vv4.asDouble(), 444.44);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,9 @@
|
||||
#include "util/newconfig/Types.hpp"
|
||||
#include "util/newconfig/ValueView.hpp"
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/json/object.hpp>
|
||||
#include <boost/json/parse.hpp>
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -287,7 +285,7 @@ TEST_F(IncorrectOverrideValues, InvalidJsonErrors)
|
||||
EXPECT_TRUE(errors.has_value());
|
||||
|
||||
// Expected error messages
|
||||
std::unordered_set<std::string_view> expectedErrors{
|
||||
std::unordered_set<std::string_view> const expectedErrors{
|
||||
"dosguard.whitelist.[] value does not match type string",
|
||||
"higher.[].low.section key is required in user Config",
|
||||
"higher.[].low.admin key is required in user Config",
|
||||
|
||||
Reference in New Issue
Block a user