Activate some clang-tidy checks (#1884)

This commit is contained in:
Otto Winter
2021-06-10 13:04:40 +02:00
committed by GitHub
parent eb9bd69405
commit 360effcb72
109 changed files with 458 additions and 422 deletions
@@ -120,7 +120,7 @@ void ESPRangeView::darken(uint8_t delta) {
for (auto c : *this)
c.darken(delta);
}
ESPRangeView &ESPRangeView::operator=(const ESPRangeView &rhs) {
ESPRangeView &ESPRangeView::operator=(const ESPRangeView &rhs) { // NOLINT
// If size doesn't match, error (todo warning)
if (rhs.size() != this->size())
return *this;
@@ -1,5 +1,7 @@
#pragma once
#include <utility>
#include "esphome/core/component.h"
#include "esphome/components/light/light_state.h"
#include "esphome/components/light/addressable_light.h"
@@ -51,9 +53,9 @@ class AddressableLightEffect : public LightEffect {
class AddressableLambdaLightEffect : public AddressableLightEffect {
public:
AddressableLambdaLightEffect(const std::string &name,
const std::function<void(AddressableLight &, Color, bool initial_run)> &f,
std::function<void(AddressableLight &, Color, bool initial_run)> f,
uint32_t update_interval)
: AddressableLightEffect(name), f_(f), update_interval_(update_interval) {}
: AddressableLightEffect(name), f_(std::move(f)), update_interval_(update_interval) {}
void start() override { this->initial_run_ = true; }
void apply(AddressableLight &it, const Color &current_color) override {
const uint32_t now = millis();
@@ -1,5 +1,7 @@
#pragma once
#include <utility>
#include "light_effect.h"
#include "esphome/core/automation.h"
@@ -85,8 +87,8 @@ class RandomLightEffect : public LightEffect {
class LambdaLightEffect : public LightEffect {
public:
LambdaLightEffect(const std::string &name, const std::function<void()> &f, uint32_t update_interval)
: LightEffect(name), f_(f), update_interval_(update_interval) {}
LambdaLightEffect(const std::string &name, std::function<void()> f, uint32_t update_interval)
: LightEffect(name), f_(std::move(f)), update_interval_(update_interval) {}
void apply() override {
const uint32_t now = millis();
+3 -1
View File
@@ -1,5 +1,7 @@
#pragma once
#include <utility>
#include "esphome/core/component.h"
#include "light_color_values.h"
#include "light_state.h"
@@ -11,7 +13,7 @@ class LightState;
class LightEffect {
public:
explicit LightEffect(const std::string &name) : name_(name) {}
explicit LightEffect(std::string name) : name_(std::move(name)) {}
/// Initialize this LightEffect. Will be called once after creation.
virtual void start() {}
+1 -1
View File
@@ -173,7 +173,7 @@ void LightState::loop() {
}
LightTraits LightState::get_traits() { return this->output_->get_traits(); }
const std::vector<LightEffect *> &LightState::get_effects() const { return this->effects_; }
void LightState::add_effects(const std::vector<LightEffect *> effects) {
void LightState::add_effects(const std::vector<LightEffect *> &effects) {
this->effects_.reserve(this->effects_.size() + effects.size());
for (auto *effect : effects) {
this->effects_.push_back(effect);
+1 -1
View File
@@ -269,7 +269,7 @@ class LightState : public Nameable, public Component {
const std::vector<LightEffect *> &get_effects() const;
void add_effects(std::vector<LightEffect *> effects);
void add_effects(const std::vector<LightEffect *> &effects);
void current_values_as_binary(bool *binary);