Skip to content

Commit f21f67c

Browse files
committed
Fix some DeepSource issues
1 parent 887aa6e commit f21f67c

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

.deepsource.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ name = "python"
88

99
[[analyzers]]
1010
name = "cxx"
11+
12+
[analyzers.meta]
13+
ignore_rules = ["cxx-c2018"]

components/econet_zone_control/econet_zone_control.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void EcoNetZoneControl::setup() {
3131
for (auto &zone_cfg : this->zones_) {
3232
EconetZone *zp = &zone_cfg;
3333

34-
if (this->mode_id_ && *this->mode_id_) {
34+
if (this->mode_id_ != nullptr && *this->mode_id_) {
3535
this->parent_->register_listener(
3636
this->mode_id_, zone_cfg.request_mod, false,
3737
[this, zp](const econet::EconetDatapoint &dp) {
@@ -47,7 +47,7 @@ void EcoNetZoneControl::setup() {
4747
false, zone_cfg.src_adr);
4848
}
4949

50-
if (this->current_temperature_id_ && *this->current_temperature_id_) {
50+
if (this->current_temperature_id_ != nullptr && *this->current_temperature_id_) {
5151
this->parent_->register_listener(
5252
this->current_temperature_id_, zone_cfg.request_mod, false,
5353
[this, zp](const econet::EconetDatapoint &dp) {
@@ -59,7 +59,7 @@ void EcoNetZoneControl::setup() {
5959
false, zone_cfg.src_adr);
6060
}
6161

62-
if (this->target_temperature_low_id_ && *this->target_temperature_low_id_) {
62+
if (this->target_temperature_low_id_ != nullptr && *this->target_temperature_low_id_) {
6363
this->parent_->register_listener(
6464
this->target_temperature_low_id_, zone_cfg.request_mod, false,
6565
[this, zp](const econet::EconetDatapoint &dp) {
@@ -70,7 +70,7 @@ void EcoNetZoneControl::setup() {
7070
false, zone_cfg.src_adr);
7171
}
7272

73-
if (this->target_temperature_high_id_ && *this->target_temperature_high_id_) {
73+
if (this->target_temperature_high_id_ != nullptr && *this->target_temperature_high_id_) {
7474
this->parent_->register_listener(
7575
this->target_temperature_high_id_, zone_cfg.request_mod, false,
7676
[this, zp](const econet::EconetDatapoint &dp) {
@@ -81,7 +81,7 @@ void EcoNetZoneControl::setup() {
8181
false, zone_cfg.src_adr);
8282
}
8383

84-
if (this->current_humidity_id_ && *this->current_humidity_id_) {
84+
if (this->current_humidity_id_ != nullptr && *this->current_humidity_id_) {
8585
this->parent_->register_listener(
8686
this->current_humidity_id_, zone_cfg.request_mod, false,
8787
[this, zp](const econet::EconetDatapoint &dp) {
@@ -92,7 +92,7 @@ void EcoNetZoneControl::setup() {
9292
false, zone_cfg.src_adr);
9393
}
9494

95-
if (this->fan_mode_id_ && *this->fan_mode_id_) {
95+
if (this->fan_mode_id_ != nullptr && *this->fan_mode_id_) {
9696
this->parent_->register_listener(
9797
this->fan_mode_id_, zone_cfg.request_mod, false,
9898
[this, zp](const econet::EconetDatapoint &dp) {
@@ -103,7 +103,7 @@ void EcoNetZoneControl::setup() {
103103
false, zone_cfg.src_adr);
104104
}
105105

106-
if (this->fan_mode_no_schedule_id_ && *this->fan_mode_no_schedule_id_) {
106+
if (this->fan_mode_no_schedule_id_ != nullptr && *this->fan_mode_no_schedule_id_) {
107107
this->parent_->register_listener(
108108
this->fan_mode_no_schedule_id_, zone_cfg.request_mod, false,
109109
[this, zp](const econet::EconetDatapoint &dp) {
@@ -116,7 +116,7 @@ void EcoNetZoneControl::setup() {
116116
}
117117

118118
// Top-level operating mode listener (not per-zone)
119-
if (this->operating_mode_id_ && *this->operating_mode_id_) {
119+
if (this->operating_mode_id_ != nullptr && *this->operating_mode_id_) {
120120
this->parent_->register_listener(
121121
this->operating_mode_id_, this->request_mod_, this->request_once_,
122122
[this](const econet::EconetDatapoint &dp) {
@@ -165,7 +165,7 @@ climate::ClimateTraits EcoNetZoneControl::traits() {
165165

166166
uint32_t flags = climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE | climate::CLIMATE_SUPPORTS_ACTION |
167167
climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE;
168-
if (this->current_humidity_id_ && *this->current_humidity_id_)
168+
if (this->current_humidity_id_ != nullptr && *this->current_humidity_id_)
169169
flags |= climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY;
170170
traits.set_feature_flags(flags);
171171

@@ -183,7 +183,7 @@ void EcoNetZoneControl::control(const climate::ClimateCall &call) {
183183
if (this->primary_zone_ == nullptr)
184184
return;
185185

186-
if (call.get_mode().has_value() && this->mode_id_ && *this->mode_id_) {
186+
if (call.get_mode().has_value() && this->mode_id_ != nullptr && *this->mode_id_) {
187187
auto it = std::find_if(this->modes_.begin(), this->modes_.end(),
188188
[&](const ModeEntry &m) { return m.mode == *call.get_mode(); });
189189
if (it != this->modes_.end()) {
@@ -192,14 +192,14 @@ void EcoNetZoneControl::control(const climate::ClimateCall &call) {
192192
}
193193
}
194194

195-
if (call.get_target_temperature_low().has_value() && this->target_temperature_low_id_ &&
195+
if (call.get_target_temperature_low().has_value() && this->target_temperature_low_id_ != nullptr &&
196196
*this->target_temperature_low_id_) {
197197
float val_f = celsius_to_fahrenheit(*call.get_target_temperature_low());
198198
ESP_LOGD(TAG, "Control: set primary zone target_low=%.1f°F", val_f);
199199
this->parent_->set_float_datapoint_value(this->target_temperature_low_id_, val_f, this->primary_zone_->src_adr);
200200
}
201201

202-
if (call.get_target_temperature_high().has_value() && this->target_temperature_high_id_ &&
202+
if (call.get_target_temperature_high().has_value() && this->target_temperature_high_id_ != nullptr &&
203203
*this->target_temperature_high_id_) {
204204
float val_f = celsius_to_fahrenheit(*call.get_target_temperature_high());
205205
ESP_LOGD(TAG, "Control: set primary zone target_high=%.1f°F", val_f);
@@ -252,7 +252,7 @@ void EcoNetZoneControl::update_zones_() {
252252
}
253253

254254
// 3. Current humidity — average across all zones (if configured)
255-
if (this->current_humidity_id_ && *this->current_humidity_id_) {
255+
if (this->current_humidity_id_ != nullptr && *this->current_humidity_id_) {
256256
float sum = 0.0f;
257257
int count = 0;
258258
for (const auto &zone : this->zones_) {
@@ -278,7 +278,7 @@ void EcoNetZoneControl::update_zones_() {
278278
if (zone.is_primary)
279279
continue;
280280

281-
if (this->target_temperature_low_id_ && *this->target_temperature_low_id_ &&
281+
if (this->target_temperature_low_id_ != nullptr && *this->target_temperature_low_id_ &&
282282
!std::isnan(this->primary_zone_->cached_target_low_f) &&
283283
(std::isnan(zone.cached_target_low_f) ||
284284
std::abs(zone.cached_target_low_f - this->primary_zone_->cached_target_low_f) >= 0.1f)) {
@@ -288,7 +288,7 @@ void EcoNetZoneControl::update_zones_() {
288288
this->primary_zone_->cached_target_low_f, zone.src_adr);
289289
}
290290

291-
if (this->target_temperature_high_id_ && *this->target_temperature_high_id_ &&
291+
if (this->target_temperature_high_id_ != nullptr && *this->target_temperature_high_id_ &&
292292
!std::isnan(this->primary_zone_->cached_target_high_f) &&
293293
(std::isnan(zone.cached_target_high_f) ||
294294
std::abs(zone.cached_target_high_f - this->primary_zone_->cached_target_high_f) >= 0.1f)) {

0 commit comments

Comments
 (0)