Skip to content

Commit

Permalink
format userver: update codestyle
Browse files Browse the repository at this point in the history
Tests: проверено CI
commit_hash:1d11516cb846982878aba35edc963284ee9c1f4d
  • Loading branch information
kenny1847 committed Oct 20, 2024
1 parent 9cf1546 commit 08d314a
Show file tree
Hide file tree
Showing 2,927 changed files with 186,255 additions and 201,243 deletions.
14 changes: 13 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
BasedOnStyle: google
BasedOnStyle: Google
DerivePointerAlignment: false
IncludeBlocks: Preserve
AttributeMacros: ["noexcept"]
IndentRequires: false
ColumnLimit: 120
IndentWidth: 4
TabWidth: 4
AccessModifierOffset: -4
BinPackParameters: false
BinPackArguments: false
AllowAllParametersOfDeclarationOnNextLine: false
AlignAfterOpenBracket: BlockIndent
AlwaysBreakAfterDefinitionReturnType: None
PenaltyReturnTypeOnItsOwnLine: 200
148 changes: 60 additions & 88 deletions chaotic/golden_tests/output/schemas/allof/allof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,60 @@
namespace ns {

bool operator==(const ns::AllOf::Foo__P0& lhs, const ns::AllOf::Foo__P0& rhs) {
return lhs.foo == rhs.foo && lhs.extra == rhs.extra &&
return lhs.foo == rhs.foo && lhs.extra == rhs.extra &&

true;
true;
}

bool operator==(const ns::AllOf::Foo__P1& lhs, const ns::AllOf::Foo__P1& rhs) {
return lhs.bar == rhs.bar && lhs.extra == rhs.extra &&
return lhs.bar == rhs.bar && lhs.extra == rhs.extra &&

true;
true;
}

bool operator==(const ns::AllOf::Foo& lhs, const ns::AllOf::Foo& rhs) {
return static_cast<const ns::AllOf::Foo__P0&>(lhs) ==
static_cast<const ns::AllOf::Foo__P0&>(rhs) &&
static_cast<const ns::AllOf::Foo__P1&>(lhs) ==
static_cast<const ns::AllOf::Foo__P1&>(rhs);
return static_cast<const ns::AllOf::Foo__P0&>(lhs) == static_cast<const ns::AllOf::Foo__P0&>(rhs) &&
static_cast<const ns::AllOf::Foo__P1&>(lhs) == static_cast<const ns::AllOf::Foo__P1&>(rhs);
}

bool operator==(const ns::AllOf& lhs, const ns::AllOf& rhs) {
return lhs.foo == rhs.foo && true;
}
bool operator==(const ns::AllOf& lhs, const ns::AllOf& rhs) { return lhs.foo == rhs.foo && true; }

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh,
const ns::AllOf::Foo__P0& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value)
.ExtractValue());
USERVER_NAMESPACE::logging::LogHelper&
operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo__P0& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value).ExtractValue());
}

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh,
const ns::AllOf::Foo__P1& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value)
.ExtractValue());
USERVER_NAMESPACE::logging::LogHelper&
operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo__P1& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value).ExtractValue());
}

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value)
.ExtractValue());
USERVER_NAMESPACE::logging::LogHelper&
operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value).ExtractValue());
}

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value)
.ExtractValue());
USERVER_NAMESPACE::logging::LogHelper& operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf& value) {
return lh << ToString(USERVER_NAMESPACE::formats::json::ValueBuilder(value).ExtractValue());
}

AllOf::Foo__P0 Parse(
USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P0> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
AllOf::Foo__P0
Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P0> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
}

AllOf::Foo__P1 Parse(
USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P1> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
AllOf::Foo__P1
Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P1> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
}

AllOf::Foo Parse(USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
AllOf::Foo
Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
}

AllOf Parse(USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
AllOf Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf> to) {
return Parse<USERVER_NAMESPACE::formats::json::Value>(json, to);
}

/* Parse(USERVER_NAMESPACE::formats::yaml::Value, To<ns::AllOf>) was not
Expand All @@ -83,63 +69,49 @@ AllOf Parse(USERVER_NAMESPACE::formats::json::Value json,
/* Parse(USERVER_NAMESPACE::yaml_config::Value, To<ns::AllOf>) was not
* generated: ns::AllOf::Foo__P0 has JSON-specific field "extra" */

USERVER_NAMESPACE::formats::json::Value Serialize(
[[maybe_unused]] const ns::AllOf::Foo__P0& value,
USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb = value.extra;
USERVER_NAMESPACE::formats::json::Value
Serialize([[maybe_unused]] const ns::AllOf::Foo__P0& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb = value.extra;

if (value.foo) {
vb["foo"] = USERVER_NAMESPACE::chaotic::Primitive<std::string>{*value.foo};
}
if (value.foo) {
vb["foo"] = USERVER_NAMESPACE::chaotic::Primitive<std::string>{*value.foo};
}

return vb.ExtractValue();
return vb.ExtractValue();
}

USERVER_NAMESPACE::formats::json::Value Serialize(
[[maybe_unused]] const ns::AllOf::Foo__P1& value,
USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb = value.extra;
USERVER_NAMESPACE::formats::json::Value
Serialize([[maybe_unused]] const ns::AllOf::Foo__P1& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb = value.extra;

if (value.bar) {
vb["bar"] = USERVER_NAMESPACE::chaotic::Primitive<int>{*value.bar};
}
if (value.bar) {
vb["bar"] = USERVER_NAMESPACE::chaotic::Primitive<int>{*value.bar};
}

return vb.ExtractValue();
return vb.ExtractValue();
}

USERVER_NAMESPACE::formats::json::Value Serialize(
const ns::AllOf::Foo& value, USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb =
USERVER_NAMESPACE::formats::common::Type::kObject;
USERVER_NAMESPACE::formats::common::Merge(
vb,
USERVER_NAMESPACE::formats::json::ValueBuilder{
static_cast<ns::AllOf::Foo__P0>(value)}
.ExtractValue());
USERVER_NAMESPACE::formats::common::Merge(
vb,
USERVER_NAMESPACE::formats::json::ValueBuilder{
static_cast<ns::AllOf::Foo__P1>(value)}
.ExtractValue());
return vb.ExtractValue();
USERVER_NAMESPACE::formats::json::Value
Serialize(const ns::AllOf::Foo& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb = USERVER_NAMESPACE::formats::common::Type::kObject;
USERVER_NAMESPACE::formats::common::Merge(
vb, USERVER_NAMESPACE::formats::json::ValueBuilder{static_cast<ns::AllOf::Foo__P0>(value)}.ExtractValue()
);
USERVER_NAMESPACE::formats::common::Merge(
vb, USERVER_NAMESPACE::formats::json::ValueBuilder{static_cast<ns::AllOf::Foo__P1>(value)}.ExtractValue()
);
return vb.ExtractValue();
}

USERVER_NAMESPACE::formats::json::Value Serialize(
[[maybe_unused]] const ns::AllOf& value,
USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb =
USERVER_NAMESPACE::formats::common::Type::kObject;
USERVER_NAMESPACE::formats::json::Value
Serialize([[maybe_unused]] const ns::AllOf& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>) {
USERVER_NAMESPACE::formats::json::ValueBuilder vb = USERVER_NAMESPACE::formats::common::Type::kObject;

if (value.foo) {
vb["foo"] =
USERVER_NAMESPACE::chaotic::Primitive<ns::AllOf::Foo>{*value.foo};
}
if (value.foo) {
vb["foo"] = USERVER_NAMESPACE::chaotic::Primitive<ns::AllOf::Foo>{*value.foo};
}

return vb.ExtractValue();
return vb.ExtractValue();
}

} // namespace ns
80 changes: 35 additions & 45 deletions chaotic/golden_tests/output/schemas/allof/allof.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,26 @@
namespace ns {

struct AllOf {
struct Foo__P0 {
std::optional<std::string> foo{};
struct Foo__P0 {
std::optional<std::string> foo{};

USERVER_NAMESPACE::formats::json::Value extra;
};
USERVER_NAMESPACE::formats::json::Value extra;
};

struct Foo__P1 {
std::optional<int> bar{};
struct Foo__P1 {
std::optional<int> bar{};

USERVER_NAMESPACE::formats::json::Value extra;
};
USERVER_NAMESPACE::formats::json::Value extra;
};

struct Foo : public ns::AllOf::Foo__P0, public ns::AllOf::Foo__P1 {
Foo() = default;
struct Foo : public ns::AllOf::Foo__P0, public ns::AllOf::Foo__P1 {
Foo() = default;

Foo(ns::AllOf::Foo__P0&& a0, ns::AllOf::Foo__P1&& a1)
: ns::AllOf::Foo__P0(std::move(a0)),
ns::AllOf::Foo__P1(std::move(a1)) {}
};
Foo(ns::AllOf::Foo__P0&& a0, ns::AllOf::Foo__P1&& a1)
: ns::AllOf::Foo__P0(std::move(a0)), ns::AllOf::Foo__P1(std::move(a1)) {}
};

std::optional<ns::AllOf::Foo> foo{};
std::optional<ns::AllOf::Foo> foo{};
};

bool operator==(const ns::AllOf::Foo__P0& lhs, const ns::AllOf::Foo__P0& rhs);
Expand All @@ -43,52 +42,43 @@ bool operator==(const ns::AllOf::Foo& lhs, const ns::AllOf::Foo& rhs);

bool operator==(const ns::AllOf& lhs, const ns::AllOf& rhs);

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo__P0& value);
USERVER_NAMESPACE::logging::LogHelper&
operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo__P0& value);

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo__P1& value);
USERVER_NAMESPACE::logging::LogHelper&
operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo__P1& value);

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo& value);
USERVER_NAMESPACE::logging::LogHelper&
operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf::Foo& value);

USERVER_NAMESPACE::logging::LogHelper& operator<<(
USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf& value);
USERVER_NAMESPACE::logging::LogHelper& operator<<(USERVER_NAMESPACE::logging::LogHelper& lh, const ns::AllOf& value);

AllOf::Foo__P0 Parse(USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P0>);
AllOf::Foo__P0
Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P0>);

AllOf::Foo__P1 Parse(USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P1>);
AllOf::Foo__P1
Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo__P1>);

AllOf::Foo Parse(USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo>);
AllOf::Foo Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf::Foo>);

AllOf Parse(USERVER_NAMESPACE::formats::json::Value json,
USERVER_NAMESPACE::formats::parse::To<ns::AllOf>);
AllOf Parse(USERVER_NAMESPACE::formats::json::Value json, USERVER_NAMESPACE::formats::parse::To<ns::AllOf>);

/* Parse(USERVER_NAMESPACE::formats::yaml::Value, To<ns::AllOf>) was not
* generated: ns::AllOf::Foo__P0 has JSON-specific field "extra" */

/* Parse(USERVER_NAMESPACE::yaml_config::Value, To<ns::AllOf>) was not
* generated: ns::AllOf::Foo__P0 has JSON-specific field "extra" */

USERVER_NAMESPACE::formats::json::Value Serialize(
const ns::AllOf::Foo__P0& value,
USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>);
USERVER_NAMESPACE::formats::json::Value
Serialize(const ns::AllOf::Foo__P0& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>);

USERVER_NAMESPACE::formats::json::Value Serialize(
const ns::AllOf::Foo__P1& value,
USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>);
USERVER_NAMESPACE::formats::json::Value
Serialize(const ns::AllOf::Foo__P1& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>);

USERVER_NAMESPACE::formats::json::Value Serialize(
const ns::AllOf::Foo& value, USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>);
USERVER_NAMESPACE::formats::json::Value
Serialize(const ns::AllOf::Foo& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>);

USERVER_NAMESPACE::formats::json::Value Serialize(
const ns::AllOf& value, USERVER_NAMESPACE::formats::serialize::To<
USERVER_NAMESPACE::formats::json::Value>);
USERVER_NAMESPACE::formats::json::Value
Serialize(const ns::AllOf& value, USERVER_NAMESPACE::formats::serialize::To<USERVER_NAMESPACE::formats::json::Value>);

} // namespace ns
Loading

0 comments on commit 08d314a

Please sign in to comment.