mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Enable readability-const-return-type check (#3099)
This commit is contained in:
		| @@ -69,7 +69,6 @@ Checks: >- | |||||||
|   -mpi-*, |   -mpi-*, | ||||||
|   -objc-*, |   -objc-*, | ||||||
|   -readability-braces-around-statements, |   -readability-braces-around-statements, | ||||||
|   -readability-const-return-type, |  | ||||||
|   -readability-convert-member-functions-to-static, |   -readability-convert-member-functions-to-static, | ||||||
|   -readability-else-after-return, |   -readability-else-after-return, | ||||||
|   -readability-function-cognitive-complexity, |   -readability-function-cognitive-complexity, | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ class ClimateTraits { | |||||||
|   ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20") |   ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20") | ||||||
|   void set_supports_dry_mode(bool supports_dry_mode) { set_mode_support_(CLIMATE_MODE_DRY, supports_dry_mode); } |   void set_supports_dry_mode(bool supports_dry_mode) { set_mode_support_(CLIMATE_MODE_DRY, supports_dry_mode); } | ||||||
|   bool supports_mode(ClimateMode mode) const { return supported_modes_.count(mode); } |   bool supports_mode(ClimateMode mode) const { return supported_modes_.count(mode); } | ||||||
|   const std::set<ClimateMode> get_supported_modes() const { return supported_modes_; } |   std::set<ClimateMode> get_supported_modes() const { return supported_modes_; } | ||||||
|  |  | ||||||
|   void set_supports_action(bool supports_action) { supports_action_ = supports_action; } |   void set_supports_action(bool supports_action) { supports_action_ = supports_action; } | ||||||
|   bool get_supports_action() const { return supports_action_; } |   bool get_supports_action() const { return supports_action_; } | ||||||
| @@ -93,7 +93,7 @@ class ClimateTraits { | |||||||
|   void set_supports_fan_mode_diffuse(bool supported) { set_fan_mode_support_(CLIMATE_FAN_DIFFUSE, supported); } |   void set_supports_fan_mode_diffuse(bool supported) { set_fan_mode_support_(CLIMATE_FAN_DIFFUSE, supported); } | ||||||
|   bool supports_fan_mode(ClimateFanMode fan_mode) const { return supported_fan_modes_.count(fan_mode); } |   bool supports_fan_mode(ClimateFanMode fan_mode) const { return supported_fan_modes_.count(fan_mode); } | ||||||
|   bool get_supports_fan_modes() const { return !supported_fan_modes_.empty() || !supported_custom_fan_modes_.empty(); } |   bool get_supports_fan_modes() const { return !supported_fan_modes_.empty() || !supported_custom_fan_modes_.empty(); } | ||||||
|   const std::set<ClimateFanMode> get_supported_fan_modes() const { return supported_fan_modes_; } |   std::set<ClimateFanMode> get_supported_fan_modes() const { return supported_fan_modes_; } | ||||||
|  |  | ||||||
|   void set_supported_custom_fan_modes(std::set<std::string> supported_custom_fan_modes) { |   void set_supported_custom_fan_modes(std::set<std::string> supported_custom_fan_modes) { | ||||||
|     supported_custom_fan_modes_ = std::move(supported_custom_fan_modes); |     supported_custom_fan_modes_ = std::move(supported_custom_fan_modes); | ||||||
| @@ -141,7 +141,7 @@ class ClimateTraits { | |||||||
|   } |   } | ||||||
|   bool supports_swing_mode(ClimateSwingMode swing_mode) const { return supported_swing_modes_.count(swing_mode); } |   bool supports_swing_mode(ClimateSwingMode swing_mode) const { return supported_swing_modes_.count(swing_mode); } | ||||||
|   bool get_supports_swing_modes() const { return !supported_swing_modes_.empty(); } |   bool get_supports_swing_modes() const { return !supported_swing_modes_.empty(); } | ||||||
|   const std::set<ClimateSwingMode> get_supported_swing_modes() { return supported_swing_modes_; } |   std::set<ClimateSwingMode> get_supported_swing_modes() { return supported_swing_modes_; } | ||||||
|  |  | ||||||
|   float get_visual_min_temperature() const { return visual_min_temperature_; } |   float get_visual_min_temperature() const { return visual_min_temperature_; } | ||||||
|   void set_visual_min_temperature(float visual_min_temperature) { visual_min_temperature_ = visual_min_temperature; } |   void set_visual_min_temperature(float visual_min_temperature) { visual_min_temperature_ = visual_min_temperature; } | ||||||
|   | |||||||
| @@ -115,7 +115,7 @@ class GraphTrace { | |||||||
|   void set_line_type(enum LineType val) { this->line_type_ = val; } |   void set_line_type(enum LineType val) { this->line_type_ = val; } | ||||||
|   Color get_line_color() { return this->line_color_; } |   Color get_line_color() { return this->line_color_; } | ||||||
|   void set_line_color(Color val) { this->line_color_ = val; } |   void set_line_color(Color val) { this->line_color_ = val; } | ||||||
|   const std::string get_name() { return name_; } |   std::string get_name() { return name_; } | ||||||
|   const HistoryData *get_tracedata() { return &data_; } |   const HistoryData *get_tracedata() { return &data_; } | ||||||
|  |  | ||||||
|  protected: |  protected: | ||||||
|   | |||||||
| @@ -27,13 +27,13 @@ std::string MQTTComponent::get_default_topic_for_(const std::string &suffix) con | |||||||
|          "/" + suffix; |          "/" + suffix; | ||||||
| } | } | ||||||
|  |  | ||||||
| const std::string MQTTComponent::get_state_topic_() const { | std::string MQTTComponent::get_state_topic_() const { | ||||||
|   if (this->custom_state_topic_.empty()) |   if (this->custom_state_topic_.empty()) | ||||||
|     return this->get_default_topic_for_("state"); |     return this->get_default_topic_for_("state"); | ||||||
|   return this->custom_state_topic_; |   return this->custom_state_topic_; | ||||||
| } | } | ||||||
|  |  | ||||||
| const std::string MQTTComponent::get_command_topic_() const { | std::string MQTTComponent::get_command_topic_() const { | ||||||
|   if (this->custom_command_topic_.empty()) |   if (this->custom_command_topic_.empty()) | ||||||
|     return this->get_default_topic_for_("command"); |     return this->get_default_topic_for_("command"); | ||||||
|   return this->custom_command_topic_; |   return this->custom_command_topic_; | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ struct SendDiscoveryConfig { | |||||||
| \ | \ | ||||||
|  public: \ |  public: \ | ||||||
|   void set_custom_##name##_##type##_topic(const std::string &topic) { this->custom_##name##_##type##_topic_ = topic; } \ |   void set_custom_##name##_##type##_topic(const std::string &topic) { this->custom_##name##_##type##_topic_ = topic; } \ | ||||||
|   const std::string get_##name##_##type##_topic() const { \ |   std::string get_##name##_##type##_topic() const { \ | ||||||
|     if (this->custom_##name##_##type##_topic_.empty()) \ |     if (this->custom_##name##_##type##_topic_.empty()) \ | ||||||
|       return this->get_default_topic_for_(#name "/" #type); \ |       return this->get_default_topic_for_(#name "/" #type); \ | ||||||
|     return this->custom_##name##_##type##_topic_; \ |     return this->custom_##name##_##type##_topic_; \ | ||||||
| @@ -171,10 +171,10 @@ class MQTTComponent : public Component { | |||||||
|   virtual bool is_disabled_by_default() const; |   virtual bool is_disabled_by_default() const; | ||||||
|  |  | ||||||
|   /// Get the MQTT topic that new states will be shared to. |   /// Get the MQTT topic that new states will be shared to. | ||||||
|   const std::string get_state_topic_() const; |   std::string get_state_topic_() const; | ||||||
|  |  | ||||||
|   /// Get the MQTT topic for listening to commands. |   /// Get the MQTT topic for listening to commands. | ||||||
|   const std::string get_command_topic_() const; |   std::string get_command_topic_() const; | ||||||
|  |  | ||||||
|   bool is_connected_() const; |   bool is_connected_() const; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ class SelectCall { | |||||||
| class SelectTraits { | class SelectTraits { | ||||||
|  public: |  public: | ||||||
|   void set_options(std::vector<std::string> options) { this->options_ = std::move(options); } |   void set_options(std::vector<std::string> options) { this->options_ = std::move(options); } | ||||||
|   const std::vector<std::string> get_options() const { return this->options_; } |   std::vector<std::string> get_options() const { return this->options_; } | ||||||
|  |  | ||||||
|  protected: |  protected: | ||||||
|   std::vector<std::string> options_; |   std::vector<std::string> options_; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user