mirror of
https://github.com/esphome/esphome.git
synced 2024-12-03 12:14:13 +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-*,
|
||||
-android-*,
|
||||
-boost-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-implicit-widening-of-multiplication-result,
|
||||
-bugprone-narrowing-conversions,
|
||||
-bugprone-signed-char-misuse,
|
||||
-cert-dcl50-cpp,
|
||||
-cert-err33-c,
|
||||
-cert-err58-cpp,
|
||||
-cert-oop57-cpp,
|
||||
-cert-str34-c,
|
||||
|
@ -15,6 +18,7 @@ Checks: >-
|
|||
-clang-analyzer-osx.*,
|
||||
-clang-diagnostic-delete-abstract-non-virtual-dtor,
|
||||
-clang-diagnostic-delete-non-abstract-non-virtual-dtor,
|
||||
-clang-diagnostic-ignored-optimization-argument,
|
||||
-clang-diagnostic-shadow-field,
|
||||
-clang-diagnostic-unused-const-variable,
|
||||
-clang-diagnostic-unused-parameter,
|
||||
|
@ -25,6 +29,7 @@ Checks: >-
|
|||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-narrowing-conversions,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-cppcoreguidelines-prefer-member-initializer,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
|
@ -36,6 +41,7 @@ Checks: >-
|
|||
-cppcoreguidelines-pro-type-union-access,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-cppcoreguidelines-special-member-functions,
|
||||
-cppcoreguidelines-virtual-class-destructor,
|
||||
-fuchsia-multiple-inheritance,
|
||||
-fuchsia-overloaded-operator,
|
||||
-fuchsia-statically-constructed-objects,
|
||||
|
@ -68,6 +74,7 @@ Checks: >-
|
|||
-modernize-use-nodiscard,
|
||||
-mpi-*,
|
||||
-objc-*,
|
||||
-readability-container-data-pointer,
|
||||
-readability-convert-member-functions-to-static,
|
||||
-readability-else-after-return,
|
||||
-readability-function-cognitive-complexity,
|
||||
|
@ -82,8 +89,6 @@ WarningsAsErrors: '*'
|
|||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: google
|
||||
CheckOptions:
|
||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||
value: '1'
|
||||
- key: google-readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: google-runtime-int.TypeSuffix
|
||||
|
@ -158,3 +163,9 @@ CheckOptions:
|
|||
value: ''
|
||||
- key: readability-qualified-auto.AddConstToQualified
|
||||
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') }}
|
||||
|
||||
- name: Install clang-tidy
|
||||
run: sudo apt-get install clang-tidy-11
|
||||
run: sudo apt-get install clang-tidy-14
|
||||
|
||||
- name: Register problem matchers
|
||||
run: |
|
||||
|
|
|
@ -125,7 +125,7 @@ void HOT Logger::log_message_(int level, const char *tag, int offset) {
|
|||
#elif defined(USE_ESP32_VARIANT_ESP32S3)
|
||||
uart_ == UART_SELECTION_USB_CDC || uart_ == UART_SELECTION_USB_SERIAL_JTAG
|
||||
#else
|
||||
/* DISABLES CODE */ (false)
|
||||
/* DISABLES CODE */ (false) // NOLINT
|
||||
#endif
|
||||
) {
|
||||
puts(msg);
|
||||
|
|
|
@ -89,11 +89,13 @@ void MatrixKeypad::loop() {
|
|||
void MatrixKeypad::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Matrix Keypad:");
|
||||
ESP_LOGCONFIG(TAG, " Rows:");
|
||||
for (auto &pin : this->rows_)
|
||||
for (auto &pin : this->rows_) {
|
||||
LOG_PIN(" Pin: ", pin);
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Cols:");
|
||||
for (auto &pin : this->columns_)
|
||||
for (auto &pin : this->columns_) {
|
||||
LOG_PIN(" Pin: ", pin);
|
||||
}
|
||||
}
|
||||
|
||||
void MatrixKeypad::register_listener(MatrixKeypadListener *listener) { this->listeners_.push_back(listener); }
|
||||
|
|
|
@ -22,8 +22,6 @@ class MideaData {
|
|||
MideaData(const std::vector<uint8_t> &data) {
|
||||
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(); }
|
||||
const uint8_t *data() const { return this->data_.data(); }
|
||||
|
|
|
@ -21,8 +21,7 @@ void SPISSD1322::setup() {
|
|||
void SPISSD1322::dump_config() {
|
||||
LOG_DISPLAY("", "SPI SSD1322", this);
|
||||
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(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
|
||||
|
|
|
@ -21,8 +21,7 @@ void SPISSD1325::setup() {
|
|||
void SPISSD1325::dump_config() {
|
||||
LOG_DISPLAY("", "SPI SSD1325", this);
|
||||
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(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
|
||||
|
|
|
@ -21,8 +21,7 @@ void SPISSD1327::setup() {
|
|||
void SPISSD1327::dump_config() {
|
||||
LOG_DISPLAY("", "SPI SSD1327", this);
|
||||
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(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
|
||||
|
|
|
@ -20,8 +20,7 @@ void SPISSD1331::setup() {
|
|||
}
|
||||
void SPISSD1331::dump_config() {
|
||||
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(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
|
||||
|
|
|
@ -21,8 +21,7 @@ void SPISSD1351::setup() {
|
|||
void SPISSD1351::dump_config() {
|
||||
LOG_DISPLAY("", "SPI SSD1351", this);
|
||||
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(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG, " Initial Brightness: %.2f", this->brightness_);
|
||||
|
|
|
@ -27,8 +27,7 @@ void TLC5947::dump_config() {
|
|||
LOG_PIN(" Data Pin: ", this->data_pin_);
|
||||
LOG_PIN(" Clock Pin: ", this->clock_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_);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,9 @@ void VBusCustomBSensor::dump_config() {
|
|||
ESP_LOGCONFIG(TAG, " Command: 0x%04x", this->command_);
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Binary Sensors:");
|
||||
for (VBusCustomSubBSensor *bsensor : this->bsensors_)
|
||||
for (VBusCustomSubBSensor *bsensor : this->bsensors_) {
|
||||
LOG_BINARY_SENSOR(" ", "-", bsensor);
|
||||
}
|
||||
}
|
||||
|
||||
void VBusCustomBSensor::handle_message(std::vector<uint8_t> &message) {
|
||||
|
|
|
@ -232,8 +232,9 @@ void VBusCustomSensor::dump_config() {
|
|||
ESP_LOGCONFIG(TAG, " Command: 0x%04x", this->command_);
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Sensors:");
|
||||
for (VBusCustomSubSensor *sensor : this->sensors_)
|
||||
for (VBusCustomSubSensor *sensor : this->sensors_) {
|
||||
LOG_SENSOR(" ", "-", sensor);
|
||||
}
|
||||
}
|
||||
|
||||
void VBusCustomSensor::handle_message(std::vector<uint8_t> &message) {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "esphome/core/automation.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/helpers.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_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();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_wifi_disconnect failed! %d", err);
|
||||
|
|
|
@ -333,7 +333,7 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
|
|||
// 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();
|
||||
if (err != ESP_OK) {
|
||||
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):
|
||||
while True:
|
||||
path = queue.get()
|
||||
invocation = ["clang-tidy-11"]
|
||||
invocation = ["clang-tidy-14"]
|
||||
|
||||
if tmpdir is not None:
|
||||
invocation.append("--export-fixes")
|
||||
|
@ -194,14 +194,14 @@ def main():
|
|||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
get_output("clang-tidy-11", "-version")
|
||||
get_output("clang-tidy-14", "-version")
|
||||
except:
|
||||
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
|
||||
clang-tidy (v11) if necessary.
|
||||
Please check you can run "clang-tidy-14 -version" in your terminal and install
|
||||
clang-tidy (v14) if necessary.
|
||||
|
||||
Note you can also upload your code as a pull request on GitHub and see the CI check
|
||||
output to apply clang-tidy.
|
||||
|
@ -272,7 +272,7 @@ def main():
|
|||
if args.fix and failed_files:
|
||||
print("Applying fixes ...")
|
||||
try:
|
||||
subprocess.call(["clang-apply-replacements-11", tmpdir])
|
||||
subprocess.call(["clang-apply-replacements-14", tmpdir])
|
||||
except:
|
||||
print("Error applying fixes.\n", file=sys.stderr)
|
||||
raise
|
||||
|
|
Loading…
Reference in a new issue