From 2937d81216ff94e7d546f01c2c043f48920949c4 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Oct 2026 12:20:50 -1000 Subject: [PATCH] Mark the test recorders as intentional mutable globals --- tests/components/button/apply_button_test.cpp | 4 ++-- tests/components/number/apply_number_test.cpp | 4 ++-- tests/components/select/apply_select_test.cpp | 2 +- tests/components/switch/apply_switch_test.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/components/button/apply_button_test.cpp b/tests/components/button/apply_button_test.cpp index 45384f0978c..225427f6689 100644 --- a/tests/components/button/apply_button_test.cpp +++ b/tests/components/button/apply_button_test.cpp @@ -4,8 +4,8 @@ namespace esphome::button::testing { -static Button *last_entity = nullptr; -static int presses = 0; +static Button *last_entity = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) +static int presses = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) static void on_press(Button *entity) { last_entity = entity; diff --git a/tests/components/number/apply_number_test.cpp b/tests/components/number/apply_number_test.cpp index b5e5e2b3536..bc412a5688b 100644 --- a/tests/components/number/apply_number_test.cpp +++ b/tests/components/number/apply_number_test.cpp @@ -6,8 +6,8 @@ namespace esphome::number::testing { -static Number *last_entity = nullptr; -static std::vector values; +static Number *last_entity = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) +static std::vector values; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) static void on_control(Number *entity, float value) { last_entity = entity; diff --git a/tests/components/select/apply_select_test.cpp b/tests/components/select/apply_select_test.cpp index 41c43421777..083fba742d1 100644 --- a/tests/components/select/apply_select_test.cpp +++ b/tests/components/select/apply_select_test.cpp @@ -9,7 +9,7 @@ namespace esphome::select::testing { static constexpr const char *const APPLY_OPTIONS[] = {"low", "medium", "high"}; -static std::vector chosen; +static std::vector chosen; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) static void on_control(Select *entity, size_t index) { chosen.emplace_back(entity->option_at(index)); } diff --git a/tests/components/switch/apply_switch_test.cpp b/tests/components/switch/apply_switch_test.cpp index b62098821bf..14304f1f4c3 100644 --- a/tests/components/switch/apply_switch_test.cpp +++ b/tests/components/switch/apply_switch_test.cpp @@ -6,8 +6,8 @@ namespace esphome::switch_::testing { -static Switch *last_entity = nullptr; -static std::vector writes; +static Switch *last_entity = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) +static std::vector writes; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) static void on_write(Switch *entity, bool state) { last_entity = entity;