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*, -llvm*,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-zircon-*, -zircon-*,
-readability-else-after-return, -bugprone-easily-swappable-parameters,
-readability-static-accessed-through-instance,
-readability-avoid-const-params-in-decls,
-cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-non-private-member-variables-in-classes,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes, -misc-non-private-member-variables-in-classes,
-modernize-use-nodiscard, -modernize-use-nodiscard,
-misc-no-recursion, -readability-avoid-const-params-in-decls,
-readability-else-after-return,
-readability-identifier-length,
-readability-implicit-bool-conversion, -readability-implicit-bool-conversion,
-readability-static-accessed-through-instance,
" "
WarningsAsErrors: '' WarningsAsErrors: ''
HeaderFilterRegex: '' HeaderFilterRegex: ''

View File

@ -164,7 +164,11 @@ ButtonOption ButtonOption::Animated(Color color) {
/// @brief Create a ButtonOption, using animated colors. /// @brief Create a ButtonOption, using animated colors.
// static // static
ButtonOption ButtonOption::Animated(Color background, Color foreground) { 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. /// @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)), : main_(std::move(main)),
modal_(std::move(modal)), modal_(std::move(modal)),
show_modal_(show_modal) { show_modal_(show_modal) {
selector_ = *show_modal_;
Add(Container::Tab({main_, modal_}, &selector_)); Add(Container::Tab({main_, modal_}, &selector_));
} }
@ -44,7 +43,7 @@ Component Modal(Component main, Component modal, const bool* show_modal) {
Component main_; Component main_;
Component modal_; Component modal_;
const bool* show_modal_; const bool* show_modal_;
int selector_ = 0; int selector_ = *show_modal_;
}; };
return Make<Impl>(main, modal, show_modal); return Make<Impl>(main, modal, show_modal);
} }

View File

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

View File

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

View File

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

View File

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