diff --git a/.clang-tidy b/.clang-tidy index 9aeeb1fc26..ea7370a3b2 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -132,7 +132,6 @@ Checks: >- -readability-redundant-inline-specifier, -readability-redundant-member-init, -readability-redundant-parentheses, - -readability-redundant-string-init, -readability-redundant-typename, -readability-uppercase-literal-suffix, -readability-use-anyofallof, diff --git a/.clang-tidy.hash b/.clang-tidy.hash index 2f973e34d9..4c4b4e5c9c 100644 --- a/.clang-tidy.hash +++ b/.clang-tidy.hash @@ -1 +1 @@ -c1e4375738304baabf7e915e5f7ca50fb22ec9b4a2d8312827a32a659f3fa40c +edce6cd78b33b296cef3caa5869d237061345eb346e3f9cb21e3239d2711051f diff --git a/esphome/components/graph/graph.h b/esphome/components/graph/graph.h index 468583ca21..a601e9eeb1 100644 --- a/esphome/components/graph/graph.h +++ b/esphome/components/graph/graph.h @@ -123,7 +123,7 @@ class GraphTrace { protected: sensor::Sensor *sensor_{nullptr}; - std::string name_{""}; + std::string name_; uint8_t line_thickness_{3}; enum LineType line_type_ { LINE_TYPE_SOLID }; Color line_color_{COLOR_ON}; diff --git a/esphome/components/nfc/ndef_message.cpp b/esphome/components/nfc/ndef_message.cpp index ba3aa77e34..d33f3f7b5c 100644 --- a/esphome/components/nfc/ndef_message.cpp +++ b/esphome/components/nfc/ndef_message.cpp @@ -52,7 +52,7 @@ NdefMessage::NdefMessage(std::vector &data) { index += type_length; - std::string id_str = ""; + std::string id_str; if (il) { id_str = std::string(data.begin() + index, data.begin() + index + id_length); index += id_length; diff --git a/esphome/components/online_image/online_image.h b/esphome/components/online_image/online_image.h index 816d6525ea..a967bb6c0e 100644 --- a/esphome/components/online_image/online_image.h +++ b/esphome/components/online_image/online_image.h @@ -88,18 +88,18 @@ class OnlineImage : public PollingComponent, */ size_t download_buffer_initial_size_; - std::string url_{""}; + std::string url_; std::vector>> request_headers_; /** * The value of the ETag HTTP header provided in the last response. */ - std::string etag_ = ""; + std::string etag_; /** * The value of the Last-Modified HTTP header provided in the last response. */ - std::string last_modified_ = ""; + std::string last_modified_; uint32_t start_time_{0}; }; diff --git a/esphome/components/remote_receiver/remote_receiver.h b/esphome/components/remote_receiver/remote_receiver.h index 5da9283a6e..cc707346eb 100644 --- a/esphome/components/remote_receiver/remote_receiver.h +++ b/esphome/components/remote_receiver/remote_receiver.h @@ -90,7 +90,7 @@ class RemoteReceiverComponent : public remote_base::RemoteReceiverBase, uint32_t carrier_frequency_{0}; uint8_t carrier_duty_percent_{100}; esp_err_t error_code_{ESP_OK}; - std::string error_string_{""}; + std::string error_string_; #endif #if defined(USE_ESP8266) || defined(USE_LIBRETINY) || defined(USE_RP2040) || defined(USE_ESP32) diff --git a/esphome/components/remote_transmitter/remote_transmitter.h b/esphome/components/remote_transmitter/remote_transmitter.h index 6b4ebfe24b..d30966e3da 100644 --- a/esphome/components/remote_transmitter/remote_transmitter.h +++ b/esphome/components/remote_transmitter/remote_transmitter.h @@ -92,7 +92,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase, rmt_channel_handle_t channel_{NULL}; rmt_encoder_handle_t encoder_{NULL}; esp_err_t error_code_{ESP_OK}; - std::string error_string_{""}; + std::string error_string_; bool inverted_{false}; bool non_blocking_{false}; #endif diff --git a/esphome/components/rtttl/rtttl.h b/esphome/components/rtttl/rtttl.h index 9dac92be2a..d060b6b024 100644 --- a/esphome/components/rtttl/rtttl.h +++ b/esphome/components/rtttl/rtttl.h @@ -72,7 +72,7 @@ class Rtttl : public Component { void set_state_(State state); /// The RTTTL string to play. - std::string rtttl_{""}; + std::string rtttl_; /// The current position in the RTTTL string. size_t position_{0}; /// The default duration of a note (e.g. 4 for a quarter note). diff --git a/esphome/components/tuya/tuya.h b/esphome/components/tuya/tuya.h index 8ba8ac85a0..470b97e7e7 100644 --- a/esphome/components/tuya/tuya.h +++ b/esphome/components/tuya/tuya.h @@ -150,7 +150,7 @@ class Tuya : public Component, public uart::UARTDevice { int reset_pin_reported_ = -1; uint32_t last_command_timestamp_ = 0; uint32_t last_rx_char_timestamp_ = 0; - std::string product_ = ""; + std::string product_; std::vector listeners_; std::vector datapoints_; std::vector rx_message_; diff --git a/esphome/components/uart/uart_component_host.h b/esphome/components/uart/uart_component_host.h index 56ff525bc3..a47e5649be 100644 --- a/esphome/components/uart/uart_component_host.h +++ b/esphome/components/uart/uart_component_host.h @@ -25,7 +25,7 @@ class HostUartComponent : public UARTComponent, public Component { void update_error_(const std::string &error); void check_logger_conflict() override {} std::string port_name_; - std::string first_error_{""}; + std::string first_error_; int file_descriptor_ = -1; bool has_peek_{false}; uint8_t peek_byte_; diff --git a/esphome/components/voice_assistant/voice_assistant.cpp b/esphome/components/voice_assistant/voice_assistant.cpp index bff0026b24..50a8265297 100644 --- a/esphome/components/voice_assistant/voice_assistant.cpp +++ b/esphome/components/voice_assistant/voice_assistant.cpp @@ -676,7 +676,7 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) { break; case api::enums::VOICE_ASSISTANT_INTENT_PROGRESS: { ESP_LOGD(TAG, "Intent progress"); - std::string tts_url_for_trigger = ""; + std::string tts_url_for_trigger; #ifdef USE_MEDIA_PLAYER if (this->media_player_ != nullptr) { for (const auto &arg : msg.data) { @@ -782,8 +782,8 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) { break; } case api::enums::VOICE_ASSISTANT_ERROR: { - std::string code = ""; - std::string message = ""; + std::string code; + std::string message; for (const auto &arg : msg.data) { if (arg.name == "code") { code = arg.value; diff --git a/esphome/components/voice_assistant/voice_assistant.h b/esphome/components/voice_assistant/voice_assistant.h index faef09d8bd..3de4673001 100644 --- a/esphome/components/voice_assistant/voice_assistant.h +++ b/esphome/components/voice_assistant/voice_assistant.h @@ -288,7 +288,7 @@ class VoiceAssistant : public Component { #endif #ifdef USE_MEDIA_PLAYER media_player::MediaPlayer *media_player_{nullptr}; - std::string tts_response_url_{""}; + std::string tts_response_url_; bool started_streaming_tts_{false}; MediaPlayerResponseState media_player_response_state_{MediaPlayerResponseState::IDLE}; @@ -296,9 +296,9 @@ class VoiceAssistant : public Component { bool local_output_{false}; - std::string conversation_id_{""}; + std::string conversation_id_; - std::string wake_word_{""}; + std::string wake_word_; std::shared_ptr ring_buffer_; diff --git a/esphome/components/web_server_idf/web_server_idf.h b/esphome/components/web_server_idf/web_server_idf.h index cdb58c2f04..c622d53e89 100644 --- a/esphome/components/web_server_idf/web_server_idf.h +++ b/esphome/components/web_server_idf/web_server_idf.h @@ -313,7 +313,7 @@ class AsyncEventSourceResponse { std::vector deferred_queue_; esphome::web_server::WebServer *web_server_; esphome::web_server::ListEntitiesIterator entities_iterator_; - std::string event_buffer_{""}; + std::string event_buffer_; size_t event_bytes_sent_; uint16_t consecutive_send_failures_{0}; static constexpr uint16_t MAX_CONSECUTIVE_SEND_FAILURES = 2500; // ~20 seconds at 125Hz loop rate