From 0daa0fb29d5591607489f158e39d8b28e6aff588 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 31 Mar 2026 23:17:18 -1000 Subject: [PATCH] Fix clang-tidy: remove trailing underscore from static methods --- esphome/components/runtime_stats/runtime_stats.cpp | 8 ++++---- esphome/components/runtime_stats/runtime_stats.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/esphome/components/runtime_stats/runtime_stats.cpp b/esphome/components/runtime_stats/runtime_stats.cpp index b3f96c6ff62..34aa31ec65b 100644 --- a/esphome/components/runtime_stats/runtime_stats.cpp +++ b/esphome/components/runtime_stats/runtime_stats.cpp @@ -47,7 +47,7 @@ void RuntimeStatsCollector::log_stats_() { } // Sort by period runtime (descending) - std::sort(sorted, sorted + count, compare_period_time_); + std::sort(sorted, sorted + count, compare_period_time); // Log top components by period runtime for (size_t i = 0; i < count; i++) { @@ -62,7 +62,7 @@ void RuntimeStatsCollector::log_stats_() { ESP_LOGI(TAG, " Total stats (since boot): %zu active components", count); // Re-sort by total runtime for all-time stats - std::sort(sorted, sorted + count, compare_total_time_); + std::sort(sorted, sorted + count, compare_total_time); for (size_t i = 0; i < count; i++) { const auto &stats = sorted[i]->runtime_stats_; @@ -78,11 +78,11 @@ void RuntimeStatsCollector::log_stats_() { } } -bool RuntimeStatsCollector::compare_period_time_(Component *a, Component *b) { +bool RuntimeStatsCollector::compare_period_time(Component *a, Component *b) { return a->runtime_stats_.period_time_us > b->runtime_stats_.period_time_us; } -bool RuntimeStatsCollector::compare_total_time_(Component *a, Component *b) { +bool RuntimeStatsCollector::compare_total_time(Component *a, Component *b) { return a->runtime_stats_.total_time_us > b->runtime_stats_.total_time_us; } diff --git a/esphome/components/runtime_stats/runtime_stats.h b/esphome/components/runtime_stats/runtime_stats.h index 5f7c59d0b5d..3c2c9f78add 100644 --- a/esphome/components/runtime_stats/runtime_stats.h +++ b/esphome/components/runtime_stats/runtime_stats.h @@ -32,8 +32,8 @@ class RuntimeStatsCollector { protected: void log_stats_(); // Static comparators — member functions have friend access, lambdas do not - static bool compare_period_time_(Component *a, Component *b); - static bool compare_total_time_(Component *a, Component *b); + static bool compare_period_time(Component *a, Component *b); + static bool compare_total_time(Component *a, Component *b); uint32_t log_interval_; uint32_t next_log_time_{0};