Fix clang-tidy. (#469)

This commit is contained in:
Arthur Sonzogni 2022-08-28 21:30:01 +02:00 committed by GitHub
parent 1e381fcad6
commit 8226c5aea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 18 deletions

View File

@ -8,14 +8,16 @@ Checks: "*,
-llvm*,
-modernize-use-trailing-return-type,
-zircon-*,
-readability-else-after-return,
-readability-static-accessed-through-instance,
-readability-avoid-const-params-in-decls,
-bugprone-easily-swappable-parameters,
-cppcoreguidelines-non-private-member-variables-in-classes,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-modernize-use-nodiscard,
-misc-no-recursion,
-readability-avoid-const-params-in-decls,
-readability-else-after-return,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-static-accessed-through-instance,
"
WarningsAsErrors: ''
HeaderFilterRegex: ''

View File

@ -164,7 +164,11 @@ ButtonOption ButtonOption::Animated(Color color) {
/// @brief Create a ButtonOption, using animated colors.
// static
ButtonOption ButtonOption::Animated(Color background, Color foreground) {
return ButtonOption::Animated(background, foreground, foreground, background);
return ButtonOption::Animated(
/*bakground=*/background,
/*foreground=*/foreground,
/*background_active=*/foreground,
/*foreground_active=*/background);
}
/// @brief Create a ButtonOption, using animated colors.

View File

@ -19,7 +19,6 @@ Component Modal(Component main, Component modal, const bool* show_modal) {
: main_(std::move(main)),
modal_(std::move(modal)),
show_modal_(show_modal) {
selector_ = *show_modal_;
Add(Container::Tab({main_, modal_}, &selector_));
}
@ -44,7 +43,7 @@ Component Modal(Component main, Component modal, const bool* show_modal) {
Component main_;
Component modal_;
const bool* show_modal_;
int selector_ = 0;
int selector_ = *show_modal_;
};
return Make<Impl>(main, modal, show_modal);
}

View File

@ -28,7 +28,6 @@ class RadioboxBase : public ComponentBase {
int* selected,
Ref<RadioboxOption> option)
: entries_(entries), selected_(selected), option_(std::move(option)) {
hovered_ = *selected_;
}
private:
@ -175,7 +174,7 @@ class RadioboxBase : public ComponentBase {
ConstStringListRef entries_;
int* selected_;
int hovered_;
int hovered_ = *selected_;
std::vector<Box> boxes_;
Box box_;
Ref<RadioboxOption> option_;

View File

@ -13,8 +13,6 @@
namespace ftxui {
namespace {
using ftxui::Screen;
using Charset = std::array<std::string, 2>; // NOLINT
using Charsets = std::array<Charset, 5>; // NOLINT
// NOLINTNEXTLINE

View File

@ -132,7 +132,7 @@ Color::Color(uint8_t red, uint8_t green, uint8_t blue)
/// @ingroup screen
// static
Color Color::RGB(uint8_t red, uint8_t green, uint8_t blue) {
return Color(red, green, blue);
return {red, green, blue};
}
/// @brief Build a Color from its HSV representation.
@ -145,7 +145,7 @@ Color Color::RGB(uint8_t red, uint8_t green, uint8_t blue) {
// static
Color Color::HSV(uint8_t h, uint8_t s, uint8_t v) {
if (s == 0) {
return Color(v, v, v);
return {0,0,0};
}
uint8_t region = h / 43; // NOLINT
@ -164,8 +164,7 @@ Color Color::HSV(uint8_t h, uint8_t s, uint8_t v) {
case 5: return Color(v,p,q); // NOLINT
} // NOLINT
// clang-format on
return Color(0, 0, 0);
return {0, 0, 0};
}
// static
@ -236,7 +235,7 @@ Color operator""_rgb(unsigned long long int combined) {
auto const red = static_cast<uint8_t>(combined >> 16U);
auto const green = static_cast<uint8_t>(combined >> 8U);
auto const blue = static_cast<uint8_t>(combined);
return Color(red, green, blue);
return {red, green, blue};
}
} // namespace literals

View File

@ -378,13 +378,13 @@ Dimensions Dimension::Full() {
// static
/// Create a screen with the given dimension along the x-axis and y-axis.
Screen Screen::Create(Dimensions width, Dimensions height) {
return Screen(width.dimx, height.dimy);
return {width.dimx, height.dimy};
}
// static
/// Create a screen with the given dimension.
Screen Screen::Create(Dimensions dimension) {
return Screen(dimension.dimx, dimension.dimy);
return {dimension.dimx, dimension.dimy};
}
Screen::Screen(int dimx, int dimy)