mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 16:08:10 +01:00
Bump clang-tidy from 11 to 14 (#5160)
This commit is contained in:
parent
3eff7e76aa
commit
cd72a2ed7e
17 changed files with 37 additions and 31 deletions
15
.clang-tidy
15
.clang-tidy
|
@ -5,9 +5,12 @@ Checks: >-
|
||||||
-altera-*,
|
-altera-*,
|
||||||
-android-*,
|
-android-*,
|
||||||
-boost-*,
|
-boost-*,
|
||||||
|
-bugprone-easily-swappable-parameters,
|
||||||
|
-bugprone-implicit-widening-of-multiplication-result,
|
||||||
-bugprone-narrowing-conversions,
|
-bugprone-narrowing-conversions,
|
||||||
-bugprone-signed-char-misuse,
|
-bugprone-signed-char-misuse,
|
||||||
-cert-dcl50-cpp,
|
-cert-dcl50-cpp,
|
||||||
|
-cert-err33-c,
|
||||||
-cert-err58-cpp,
|
-cert-err58-cpp,
|
||||||
-cert-oop57-cpp,
|
-cert-oop57-cpp,
|
||||||
-cert-str34-c,
|
-cert-str34-c,
|
||||||
|
@ -15,6 +18,7 @@ Checks: >-
|
||||||
-clang-analyzer-osx.*,
|
-clang-analyzer-osx.*,
|
||||||
-clang-diagnostic-delete-abstract-non-virtual-dtor,
|
-clang-diagnostic-delete-abstract-non-virtual-dtor,
|
||||||
-clang-diagnostic-delete-non-abstract-non-virtual-dtor,
|
-clang-diagnostic-delete-non-abstract-non-virtual-dtor,
|
||||||
|
-clang-diagnostic-ignored-optimization-argument,
|
||||||
-clang-diagnostic-shadow-field,
|
-clang-diagnostic-shadow-field,
|
||||||
-clang-diagnostic-unused-const-variable,
|
-clang-diagnostic-unused-const-variable,
|
||||||
-clang-diagnostic-unused-parameter,
|
-clang-diagnostic-unused-parameter,
|
||||||
|
@ -25,6 +29,7 @@ Checks: >-
|
||||||
-cppcoreguidelines-macro-usage,
|
-cppcoreguidelines-macro-usage,
|
||||||
-cppcoreguidelines-narrowing-conversions,
|
-cppcoreguidelines-narrowing-conversions,
|
||||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||||
|
-cppcoreguidelines-prefer-member-initializer,
|
||||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||||
|
@ -36,6 +41,7 @@ Checks: >-
|
||||||
-cppcoreguidelines-pro-type-union-access,
|
-cppcoreguidelines-pro-type-union-access,
|
||||||
-cppcoreguidelines-pro-type-vararg,
|
-cppcoreguidelines-pro-type-vararg,
|
||||||
-cppcoreguidelines-special-member-functions,
|
-cppcoreguidelines-special-member-functions,
|
||||||
|
-cppcoreguidelines-virtual-class-destructor,
|
||||||
-fuchsia-multiple-inheritance,
|
-fuchsia-multiple-inheritance,
|
||||||
-fuchsia-overloaded-operator,
|
-fuchsia-overloaded-operator,
|
||||||
-fuchsia-statically-constructed-objects,
|
-fuchsia-statically-constructed-objects,
|
||||||
|
@ -68,6 +74,7 @@ Checks: >-
|
||||||
-modernize-use-nodiscard,
|
-modernize-use-nodiscard,
|
||||||
-mpi-*,
|
-mpi-*,
|
||||||
-objc-*,
|
-objc-*,
|
||||||
|
-readability-container-data-pointer,
|
||||||
-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,
|
||||||
|
@ -82,8 +89,6 @@ WarningsAsErrors: '*'
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
FormatStyle: google
|
FormatStyle: google
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
|
||||||
value: '1'
|
|
||||||
- key: google-readability-function-size.StatementThreshold
|
- key: google-readability-function-size.StatementThreshold
|
||||||
value: '800'
|
value: '800'
|
||||||
- key: google-runtime-int.TypeSuffix
|
- key: google-runtime-int.TypeSuffix
|
||||||
|
@ -158,3 +163,9 @@ CheckOptions:
|
||||||
value: ''
|
value: ''
|
||||||
- key: readability-qualified-auto.AddConstToQualified
|
- key: readability-qualified-auto.AddConstToQualified
|
||||||
value: 0
|
value: 0
|
||||||
|
- key: readability-identifier-length.MinimumVariableNameLength
|
||||||
|
value: 0
|
||||||
|
- key: readability-identifier-length.MinimumParameterNameLength
|
||||||
|
value: 0
|
||||||
|
- key: readability-identifier-length.MinimumLoopCounterNameLength
|
||||||
|
value: 0
|
||||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -305,7 +305,7 @@ jobs:
|
||||||
key: platformio-${{ matrix.pio_cache_key }}-${{ hashFiles('platformio.ini') }}
|
key: platformio-${{ matrix.pio_cache_key }}-${{ hashFiles('platformio.ini') }}
|
||||||
|
|
||||||
- name: Install clang-tidy
|
- name: Install clang-tidy
|
||||||
run: sudo apt-get install clang-tidy-11
|
run: sudo apt-get install clang-tidy-14
|
||||||
|
|
||||||
- name: Register problem matchers
|
- name: Register problem matchers
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -125,7 +125,7 @@ void HOT Logger::log_message_(int level, const char *tag, int offset) {
|
||||||
#elif defined(USE_ESP32_VARIANT_ESP32S3)
|
#elif defined(USE_ESP32_VARIANT_ESP32S3)
|
||||||
uart_ == UART_SELECTION_USB_CDC || uart_ == UART_SELECTION_USB_SERIAL_JTAG
|
uart_ == UART_SELECTION_USB_CDC || uart_ == UART_SELECTION_USB_SERIAL_JTAG
|
||||||
#else
|
#else
|
||||||
/* DISABLES CODE */ (false)
|
/* DISABLES CODE */ (false) // NOLINT
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
puts(msg);
|
puts(msg);
|
||||||
|
|
|
@ -89,12 +89,14 @@ void MatrixKeypad::loop() {
|
||||||
void MatrixKeypad::dump_config() {
|
void MatrixKeypad::dump_config() {
|
||||||
ESP_LOGCONFIG(TAG, "Matrix Keypad:");
|
ESP_LOGCONFIG(TAG, "Matrix Keypad:");
|
||||||
ESP_LOGCONFIG(TAG, " Rows:");
|
ESP_LOGCONFIG(TAG, " Rows:");
|
||||||
for (auto &pin : this->rows_)
|
for (auto &pin : this->rows_) {
|
||||||
LOG_PIN(" Pin: ", pin);
|
LOG_PIN(" Pin: ", pin);
|
||||||
|
}
|
||||||
ESP_LOGCONFIG(TAG, " Cols:");
|
ESP_LOGCONFIG(TAG, " Cols:");
|
||||||
for (auto &pin : this->columns_)
|
for (auto &pin : this->columns_) {
|
||||||
LOG_PIN(" Pin: ", pin);
|
LOG_PIN(" Pin: ", pin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MatrixKeypad::register_listener(MatrixKeypadListener *listener) { this->listeners_.push_back(listener); }
|
void MatrixKeypad::register_listener(MatrixKeypadListener *listener) { this->listeners_.push_back(listener); }
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ class MideaData {
|
||||||
MideaData(const std::vector<uint8_t> &data) {
|
MideaData(const std::vector<uint8_t> &data) {
|
||||||
std::copy_n(data.begin(), std::min(data.size(), this->data_.size()), this->data_.begin());
|
std::copy_n(data.begin(), std::min(data.size(), this->data_.size()), this->data_.begin());
|
||||||
}
|
}
|
||||||
// Default copy constructor
|
|
||||||
MideaData(const MideaData &) = default;
|
|
||||||
|
|
||||||
uint8_t *data() { return this->data_.data(); }
|
uint8_t *data() { return this->data_.data(); }
|
||||||
const uint8_t *data() const { return this->data_.data(); }
|
const uint8_t *data() const { return this->data_.data(); }
|
||||||
|
|
|
@ -21,7 +21,6 @@ void SPISSD1322::setup() {
|
||||||
void SPISSD1322::dump_config() {
|
void SPISSD1322::dump_config() {
|
||||||
LOG_DISPLAY("", "SPI SSD1322", this);
|
LOG_DISPLAY("", "SPI SSD1322", this);
|
||||||
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
||||||
if (this->cs_)
|
|
||||||
LOG_PIN(" CS Pin: ", this->cs_);
|
LOG_PIN(" CS Pin: ", this->cs_);
|
||||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||||
|
|
|
@ -21,7 +21,6 @@ void SPISSD1325::setup() {
|
||||||
void SPISSD1325::dump_config() {
|
void SPISSD1325::dump_config() {
|
||||||
LOG_DISPLAY("", "SPI SSD1325", this);
|
LOG_DISPLAY("", "SPI SSD1325", this);
|
||||||
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
||||||
if (this->cs_)
|
|
||||||
LOG_PIN(" CS Pin: ", this->cs_);
|
LOG_PIN(" CS Pin: ", this->cs_);
|
||||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||||
|
|
|
@ -21,7 +21,6 @@ void SPISSD1327::setup() {
|
||||||
void SPISSD1327::dump_config() {
|
void SPISSD1327::dump_config() {
|
||||||
LOG_DISPLAY("", "SPI SSD1327", this);
|
LOG_DISPLAY("", "SPI SSD1327", this);
|
||||||
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
||||||
if (this->cs_)
|
|
||||||
LOG_PIN(" CS Pin: ", this->cs_);
|
LOG_PIN(" CS Pin: ", this->cs_);
|
||||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||||
|
|
|
@ -20,7 +20,6 @@ void SPISSD1331::setup() {
|
||||||
}
|
}
|
||||||
void SPISSD1331::dump_config() {
|
void SPISSD1331::dump_config() {
|
||||||
LOG_DISPLAY("", "SPI SSD1331", this);
|
LOG_DISPLAY("", "SPI SSD1331", this);
|
||||||
if (this->cs_)
|
|
||||||
LOG_PIN(" CS Pin: ", this->cs_);
|
LOG_PIN(" CS Pin: ", this->cs_);
|
||||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||||
|
|
|
@ -21,7 +21,6 @@ void SPISSD1351::setup() {
|
||||||
void SPISSD1351::dump_config() {
|
void SPISSD1351::dump_config() {
|
||||||
LOG_DISPLAY("", "SPI SSD1351", this);
|
LOG_DISPLAY("", "SPI SSD1351", this);
|
||||||
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
ESP_LOGCONFIG(TAG, " Model: %s", this->model_str_());
|
||||||
if (this->cs_)
|
|
||||||
LOG_PIN(" CS Pin: ", this->cs_);
|
LOG_PIN(" CS Pin: ", this->cs_);
|
||||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||||
|
|
|
@ -27,7 +27,6 @@ void TLC5947::dump_config() {
|
||||||
LOG_PIN(" Data Pin: ", this->data_pin_);
|
LOG_PIN(" Data Pin: ", this->data_pin_);
|
||||||
LOG_PIN(" Clock Pin: ", this->clock_pin_);
|
LOG_PIN(" Clock Pin: ", this->clock_pin_);
|
||||||
LOG_PIN(" LAT Pin: ", this->lat_pin_);
|
LOG_PIN(" LAT Pin: ", this->lat_pin_);
|
||||||
if (this->outenable_pin_ != nullptr)
|
|
||||||
LOG_PIN(" OE Pin: ", this->outenable_pin_);
|
LOG_PIN(" OE Pin: ", this->outenable_pin_);
|
||||||
ESP_LOGCONFIG(TAG, " Number of chips: %u", this->num_chips_);
|
ESP_LOGCONFIG(TAG, " Number of chips: %u", this->num_chips_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,9 +147,10 @@ void VBusCustomBSensor::dump_config() {
|
||||||
ESP_LOGCONFIG(TAG, " Command: 0x%04x", this->command_);
|
ESP_LOGCONFIG(TAG, " Command: 0x%04x", this->command_);
|
||||||
}
|
}
|
||||||
ESP_LOGCONFIG(TAG, " Binary Sensors:");
|
ESP_LOGCONFIG(TAG, " Binary Sensors:");
|
||||||
for (VBusCustomSubBSensor *bsensor : this->bsensors_)
|
for (VBusCustomSubBSensor *bsensor : this->bsensors_) {
|
||||||
LOG_BINARY_SENSOR(" ", "-", bsensor);
|
LOG_BINARY_SENSOR(" ", "-", bsensor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VBusCustomBSensor::handle_message(std::vector<uint8_t> &message) {
|
void VBusCustomBSensor::handle_message(std::vector<uint8_t> &message) {
|
||||||
for (VBusCustomSubBSensor *bsensor : this->bsensors_)
|
for (VBusCustomSubBSensor *bsensor : this->bsensors_)
|
||||||
|
|
|
@ -232,9 +232,10 @@ void VBusCustomSensor::dump_config() {
|
||||||
ESP_LOGCONFIG(TAG, " Command: 0x%04x", this->command_);
|
ESP_LOGCONFIG(TAG, " Command: 0x%04x", this->command_);
|
||||||
}
|
}
|
||||||
ESP_LOGCONFIG(TAG, " Sensors:");
|
ESP_LOGCONFIG(TAG, " Sensors:");
|
||||||
for (VBusCustomSubSensor *sensor : this->sensors_)
|
for (VBusCustomSubSensor *sensor : this->sensors_) {
|
||||||
LOG_SENSOR(" ", "-", sensor);
|
LOG_SENSOR(" ", "-", sensor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VBusCustomSensor::handle_message(std::vector<uint8_t> &message) {
|
void VBusCustomSensor::handle_message(std::vector<uint8_t> &message) {
|
||||||
for (VBusCustomSubSensor *sensor : this->sensors_)
|
for (VBusCustomSubSensor *sensor : this->sensors_)
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/core/defines.h"
|
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
|
||||||
#include "esphome/components/api/api_pb2.h"
|
#include "esphome/components/api/api_pb2.h"
|
||||||
|
|
|
@ -220,7 +220,7 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
esp_wifi_get_config(WIFI_IF_STA, ¤t_conf);
|
esp_wifi_get_config(WIFI_IF_STA, ¤t_conf);
|
||||||
|
|
||||||
if (memcmp(¤t_conf, &conf, sizeof(wifi_config_t)) != 0) {
|
if (memcmp(¤t_conf, &conf, sizeof(wifi_config_t)) != 0) { // NOLINT
|
||||||
err = esp_wifi_disconnect();
|
err = esp_wifi_disconnect();
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_wifi_disconnect failed! %d", err);
|
ESP_LOGV(TAG, "esp_wifi_disconnect failed! %d", err);
|
||||||
|
|
|
@ -333,7 +333,7 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
|
||||||
// can continue
|
// can continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(¤t_conf, &conf, sizeof(wifi_config_t)) != 0) {
|
if (memcmp(¤t_conf, &conf, sizeof(wifi_config_t)) != 0) { // NOLINT
|
||||||
err = esp_wifi_disconnect();
|
err = esp_wifi_disconnect();
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_wifi_disconnect failed: %s", esp_err_to_name(err));
|
ESP_LOGV(TAG, "esp_wifi_disconnect failed: %s", esp_err_to_name(err));
|
||||||
|
|
|
@ -113,7 +113,7 @@ def clang_options(idedata):
|
||||||
def run_tidy(args, options, tmpdir, queue, lock, failed_files):
|
def run_tidy(args, options, tmpdir, queue, lock, failed_files):
|
||||||
while True:
|
while True:
|
||||||
path = queue.get()
|
path = queue.get()
|
||||||
invocation = ["clang-tidy-11"]
|
invocation = ["clang-tidy-14"]
|
||||||
|
|
||||||
if tmpdir is not None:
|
if tmpdir is not None:
|
||||||
invocation.append("--export-fixes")
|
invocation.append("--export-fixes")
|
||||||
|
@ -194,14 +194,14 @@ def main():
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
get_output("clang-tidy-11", "-version")
|
get_output("clang-tidy-14", "-version")
|
||||||
except:
|
except:
|
||||||
print(
|
print(
|
||||||
"""
|
"""
|
||||||
Oops. It looks like clang-tidy-11 is not installed.
|
Oops. It looks like clang-tidy-14 is not installed.
|
||||||
|
|
||||||
Please check you can run "clang-tidy-11 -version" in your terminal and install
|
Please check you can run "clang-tidy-14 -version" in your terminal and install
|
||||||
clang-tidy (v11) if necessary.
|
clang-tidy (v14) if necessary.
|
||||||
|
|
||||||
Note you can also upload your code as a pull request on GitHub and see the CI check
|
Note you can also upload your code as a pull request on GitHub and see the CI check
|
||||||
output to apply clang-tidy.
|
output to apply clang-tidy.
|
||||||
|
@ -272,7 +272,7 @@ def main():
|
||||||
if args.fix and failed_files:
|
if args.fix and failed_files:
|
||||||
print("Applying fixes ...")
|
print("Applying fixes ...")
|
||||||
try:
|
try:
|
||||||
subprocess.call(["clang-apply-replacements-11", tmpdir])
|
subprocess.call(["clang-apply-replacements-14", tmpdir])
|
||||||
except:
|
except:
|
||||||
print("Error applying fixes.\n", file=sys.stderr)
|
print("Error applying fixes.\n", file=sys.stderr)
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in a new issue