mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:27:14 +00:00
[clang-tidy] Enable readability-redundant-string-init (#16310)
This commit is contained in:
@@ -132,7 +132,6 @@ Checks: >-
|
|||||||
-readability-redundant-inline-specifier,
|
-readability-redundant-inline-specifier,
|
||||||
-readability-redundant-member-init,
|
-readability-redundant-member-init,
|
||||||
-readability-redundant-parentheses,
|
-readability-redundant-parentheses,
|
||||||
-readability-redundant-string-init,
|
|
||||||
-readability-redundant-typename,
|
-readability-redundant-typename,
|
||||||
-readability-uppercase-literal-suffix,
|
-readability-uppercase-literal-suffix,
|
||||||
-readability-use-anyofallof,
|
-readability-use-anyofallof,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
c1e4375738304baabf7e915e5f7ca50fb22ec9b4a2d8312827a32a659f3fa40c
|
edce6cd78b33b296cef3caa5869d237061345eb346e3f9cb21e3239d2711051f
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class GraphTrace {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
sensor::Sensor *sensor_{nullptr};
|
sensor::Sensor *sensor_{nullptr};
|
||||||
std::string name_{""};
|
std::string name_;
|
||||||
uint8_t line_thickness_{3};
|
uint8_t line_thickness_{3};
|
||||||
enum LineType line_type_ { LINE_TYPE_SOLID };
|
enum LineType line_type_ { LINE_TYPE_SOLID };
|
||||||
Color line_color_{COLOR_ON};
|
Color line_color_{COLOR_ON};
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ NdefMessage::NdefMessage(std::vector<uint8_t> &data) {
|
|||||||
|
|
||||||
index += type_length;
|
index += type_length;
|
||||||
|
|
||||||
std::string id_str = "";
|
std::string id_str;
|
||||||
if (il) {
|
if (il) {
|
||||||
id_str = std::string(data.begin() + index, data.begin() + index + id_length);
|
id_str = std::string(data.begin() + index, data.begin() + index + id_length);
|
||||||
index += id_length;
|
index += id_length;
|
||||||
|
|||||||
@@ -88,18 +88,18 @@ class OnlineImage : public PollingComponent,
|
|||||||
*/
|
*/
|
||||||
size_t download_buffer_initial_size_;
|
size_t download_buffer_initial_size_;
|
||||||
|
|
||||||
std::string url_{""};
|
std::string url_;
|
||||||
|
|
||||||
std::vector<std::pair<std::string, TemplatableValue<std::string>>> request_headers_;
|
std::vector<std::pair<std::string, TemplatableValue<std::string>>> request_headers_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value of the ETag HTTP header provided in the last response.
|
* 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.
|
* 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};
|
uint32_t start_time_{0};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class RemoteReceiverComponent : public remote_base::RemoteReceiverBase,
|
|||||||
uint32_t carrier_frequency_{0};
|
uint32_t carrier_frequency_{0};
|
||||||
uint8_t carrier_duty_percent_{100};
|
uint8_t carrier_duty_percent_{100};
|
||||||
esp_err_t error_code_{ESP_OK};
|
esp_err_t error_code_{ESP_OK};
|
||||||
std::string error_string_{""};
|
std::string error_string_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_ESP8266) || defined(USE_LIBRETINY) || defined(USE_RP2040) || defined(USE_ESP32)
|
#if defined(USE_ESP8266) || defined(USE_LIBRETINY) || defined(USE_RP2040) || defined(USE_ESP32)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase,
|
|||||||
rmt_channel_handle_t channel_{NULL};
|
rmt_channel_handle_t channel_{NULL};
|
||||||
rmt_encoder_handle_t encoder_{NULL};
|
rmt_encoder_handle_t encoder_{NULL};
|
||||||
esp_err_t error_code_{ESP_OK};
|
esp_err_t error_code_{ESP_OK};
|
||||||
std::string error_string_{""};
|
std::string error_string_;
|
||||||
bool inverted_{false};
|
bool inverted_{false};
|
||||||
bool non_blocking_{false};
|
bool non_blocking_{false};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class Rtttl : public Component {
|
|||||||
void set_state_(State state);
|
void set_state_(State state);
|
||||||
|
|
||||||
/// The RTTTL string to play.
|
/// The RTTTL string to play.
|
||||||
std::string rtttl_{""};
|
std::string rtttl_;
|
||||||
/// The current position in the RTTTL string.
|
/// The current position in the RTTTL string.
|
||||||
size_t position_{0};
|
size_t position_{0};
|
||||||
/// The default duration of a note (e.g. 4 for a quarter note).
|
/// The default duration of a note (e.g. 4 for a quarter note).
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class Tuya : public Component, public uart::UARTDevice {
|
|||||||
int reset_pin_reported_ = -1;
|
int reset_pin_reported_ = -1;
|
||||||
uint32_t last_command_timestamp_ = 0;
|
uint32_t last_command_timestamp_ = 0;
|
||||||
uint32_t last_rx_char_timestamp_ = 0;
|
uint32_t last_rx_char_timestamp_ = 0;
|
||||||
std::string product_ = "";
|
std::string product_;
|
||||||
std::vector<TuyaDatapointListener> listeners_;
|
std::vector<TuyaDatapointListener> listeners_;
|
||||||
std::vector<TuyaDatapoint> datapoints_;
|
std::vector<TuyaDatapoint> datapoints_;
|
||||||
std::vector<uint8_t> rx_message_;
|
std::vector<uint8_t> rx_message_;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class HostUartComponent : public UARTComponent, public Component {
|
|||||||
void update_error_(const std::string &error);
|
void update_error_(const std::string &error);
|
||||||
void check_logger_conflict() override {}
|
void check_logger_conflict() override {}
|
||||||
std::string port_name_;
|
std::string port_name_;
|
||||||
std::string first_error_{""};
|
std::string first_error_;
|
||||||
int file_descriptor_ = -1;
|
int file_descriptor_ = -1;
|
||||||
bool has_peek_{false};
|
bool has_peek_{false};
|
||||||
uint8_t peek_byte_;
|
uint8_t peek_byte_;
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
|
|||||||
break;
|
break;
|
||||||
case api::enums::VOICE_ASSISTANT_INTENT_PROGRESS: {
|
case api::enums::VOICE_ASSISTANT_INTENT_PROGRESS: {
|
||||||
ESP_LOGD(TAG, "Intent progress");
|
ESP_LOGD(TAG, "Intent progress");
|
||||||
std::string tts_url_for_trigger = "";
|
std::string tts_url_for_trigger;
|
||||||
#ifdef USE_MEDIA_PLAYER
|
#ifdef USE_MEDIA_PLAYER
|
||||||
if (this->media_player_ != nullptr) {
|
if (this->media_player_ != nullptr) {
|
||||||
for (const auto &arg : msg.data) {
|
for (const auto &arg : msg.data) {
|
||||||
@@ -782,8 +782,8 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case api::enums::VOICE_ASSISTANT_ERROR: {
|
case api::enums::VOICE_ASSISTANT_ERROR: {
|
||||||
std::string code = "";
|
std::string code;
|
||||||
std::string message = "";
|
std::string message;
|
||||||
for (const auto &arg : msg.data) {
|
for (const auto &arg : msg.data) {
|
||||||
if (arg.name == "code") {
|
if (arg.name == "code") {
|
||||||
code = arg.value;
|
code = arg.value;
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ class VoiceAssistant : public Component {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef USE_MEDIA_PLAYER
|
#ifdef USE_MEDIA_PLAYER
|
||||||
media_player::MediaPlayer *media_player_{nullptr};
|
media_player::MediaPlayer *media_player_{nullptr};
|
||||||
std::string tts_response_url_{""};
|
std::string tts_response_url_;
|
||||||
bool started_streaming_tts_{false};
|
bool started_streaming_tts_{false};
|
||||||
|
|
||||||
MediaPlayerResponseState media_player_response_state_{MediaPlayerResponseState::IDLE};
|
MediaPlayerResponseState media_player_response_state_{MediaPlayerResponseState::IDLE};
|
||||||
@@ -296,9 +296,9 @@ class VoiceAssistant : public Component {
|
|||||||
|
|
||||||
bool local_output_{false};
|
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::RingBuffer> ring_buffer_;
|
std::shared_ptr<ring_buffer::RingBuffer> ring_buffer_;
|
||||||
|
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ class AsyncEventSourceResponse {
|
|||||||
std::vector<DeferredEvent> deferred_queue_;
|
std::vector<DeferredEvent> deferred_queue_;
|
||||||
esphome::web_server::WebServer *web_server_;
|
esphome::web_server::WebServer *web_server_;
|
||||||
esphome::web_server::ListEntitiesIterator entities_iterator_;
|
esphome::web_server::ListEntitiesIterator entities_iterator_;
|
||||||
std::string event_buffer_{""};
|
std::string event_buffer_;
|
||||||
size_t event_bytes_sent_;
|
size_t event_bytes_sent_;
|
||||||
uint16_t consecutive_send_failures_{0};
|
uint16_t consecutive_send_failures_{0};
|
||||||
static constexpr uint16_t MAX_CONSECUTIVE_SEND_FAILURES = 2500; // ~20 seconds at 125Hz loop rate
|
static constexpr uint16_t MAX_CONSECUTIVE_SEND_FAILURES = 2500; // ~20 seconds at 125Hz loop rate
|
||||||
|
|||||||
Reference in New Issue
Block a user