clang-tidy

This commit is contained in:
2026-04-03 09:31:41 +02:00
parent 8dcc1d282a
commit 46dc81124f
25 changed files with 320 additions and 314 deletions

View File

@@ -164,7 +164,7 @@ void Console::redrawText() {
}
// Actualiza la animación de la consola
void Console::update(float delta_time) {
void Console::update(float delta_time) { // NOLINT(readability-function-cognitive-complexity)
if (status_ == Status::HIDDEN) {
return;
}
@@ -196,9 +196,9 @@ void Console::update(float delta_time) {
if (status_ == Status::ACTIVE && height_ != target_height_) {
const float PREV_HEIGHT = height_;
if (height_ < target_height_) {
height_ = std::min(height_ + SLIDE_SPEED * delta_time, target_height_);
height_ = std::min(height_ + (SLIDE_SPEED * delta_time), target_height_);
} else {
height_ = std::max(height_ - SLIDE_SPEED * delta_time, target_height_);
height_ = std::max(height_ - (SLIDE_SPEED * delta_time), target_height_);
}
// Actualizar el Notifier incrementalmente con el delta de altura
if (Notifier::get() != nullptr) {
@@ -300,7 +300,7 @@ void Console::toggle() {
}
// Procesa el evento SDL: entrada de texto, Backspace, Enter
void Console::handleEvent(const SDL_Event& event) {
void Console::handleEvent(const SDL_Event& event) { // NOLINT(readability-function-cognitive-complexity)
if (status_ != Status::ACTIVE) { return; }
if (event.type == SDL_EVENT_TEXT_INPUT) {
@@ -348,8 +348,8 @@ void Console::handleEvent(const SDL_Event& event) {
std::string upper;
for (unsigned char c : input_line_) { upper += static_cast<char>(std::toupper(c)); }
const size_t space_pos = upper.rfind(' ');
if (space_pos == std::string::npos) {
const size_t SPACE_POS = upper.rfind(' ');
if (SPACE_POS == std::string::npos) {
// Modo comando: ciclar keywords visibles que empiecen por el prefijo
for (const auto& kw : registry_.getVisibleKeywords()) {
if (upper.empty() || kw.starts_with(upper)) {
@@ -357,12 +357,12 @@ void Console::handleEvent(const SDL_Event& event) {
}
}
} else {
const std::string base_cmd = upper.substr(0, space_pos);
const std::string sub_prefix = upper.substr(space_pos + 1);
const auto opts = registry_.getCompletions(base_cmd);
for (const auto& arg : opts) {
if (sub_prefix.empty() || std::string_view{arg}.starts_with(sub_prefix)) {
tab_matches_.emplace_back(base_cmd + " " + arg);
const std::string BASE_CMD = upper.substr(0, SPACE_POS);
const std::string SUB_PREFIX = upper.substr(SPACE_POS + 1);
const auto OPTS = registry_.getCompletions(BASE_CMD);
for (const auto& arg : OPTS) {
if (SUB_PREFIX.empty() || std::string_view{arg}.starts_with(SUB_PREFIX)) {
tab_matches_.emplace_back(BASE_CMD + " " + arg);
}
}
}