Upgrade clang-format to v13 (#4535)

* Upgrade clang-format to v13

* Apply clang-format-13 formatting changes

* Format

* Format bme_680

---------

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Oxan van Leeuwen 2023-03-20 04:38:41 +01:00 committed by GitHub
parent f0f6d3f1cd
commit 14e38f0469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 182 additions and 179 deletions

View File

@ -51,6 +51,6 @@
"files.associations": {
"**/.vscode/*.json": "jsonc"
},
"C_Cpp.clang_format_path": "/usr/bin/clang-format-11",
"C_Cpp.clang_format_path": "/usr/bin/clang-format-13",
}
}

View File

@ -133,7 +133,7 @@ jobs:
- name: Install clang tools
run: |
sudo apt-get install \
clang-format-11 \
clang-format-13 \
clang-tidy-11
if: matrix.id == 'clang-tidy' || matrix.id == 'clang-format'

View File

@ -135,7 +135,7 @@ RUN \
apt-get update \
# Use pinned versions so that we get updates with build caching
&& apt-get install -y --no-install-recommends \
clang-format-11=1:11.0.1-2 \
clang-format-13=1:13.0.1-6~deb11u1 \
clang-tidy-11=1:11.0.1-2 \
patch=2.7.6-7 \
software-properties-common=0.96.20.2-2.1 \

View File

@ -1,6 +1,6 @@
#include "bme680.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include "esphome/core/log.h"
namespace esphome {
namespace bme680 {

View File

@ -45,7 +45,8 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
memset(this->remote_bda_, 0, sizeof(this->remote_bda_));
this->address_str_ = "";
} else {
this->address_str_ = str_snprintf("%02X:%02X:%02X:%02X:%02X:%02X", 17, (uint8_t)(this->address_ >> 40) & 0xff,
this->address_str_ =
str_snprintf("%02X:%02X:%02X:%02X:%02X:%02X", 17, (uint8_t) (this->address_ >> 40) & 0xff,
(uint8_t) (this->address_ >> 32) & 0xff, (uint8_t) (this->address_ >> 24) & 0xff,
(uint8_t) (this->address_ >> 16) & 0xff, (uint8_t) (this->address_ >> 8) & 0xff,
(uint8_t) (this->address_ >> 0) & 0xff);

View File

@ -1,8 +1,8 @@
#include "ili9xxx_display.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome {
namespace ili9xxx {

View File

@ -59,7 +59,8 @@ enum class ColorMode : uint8_t {
COLOR_TEMPERATURE =
(uint8_t) (ColorCapability::ON_OFF | ColorCapability::BRIGHTNESS | ColorCapability::COLOR_TEMPERATURE),
/// Cold and warm white output with individually controllable brightness.
COLD_WARM_WHITE = (uint8_t)(ColorCapability::ON_OFF | ColorCapability::BRIGHTNESS | ColorCapability::COLD_WARM_WHITE),
COLD_WARM_WHITE =
(uint8_t) (ColorCapability::ON_OFF | ColorCapability::BRIGHTNESS | ColorCapability::COLD_WARM_WHITE),
/// RGB color output.
RGB = (uint8_t) (ColorCapability::ON_OFF | ColorCapability::BRIGHTNESS | ColorCapability::RGB),
/// RGB color output and a separate white output.

View File

@ -123,7 +123,8 @@ uint32_t MopekaProCheck::parse_distance_(const std::vector<uint8_t> &message) {
double raw_level = raw & 0x3FFF;
double raw_t = (message[2] & 0x7F);
return (uint32_t)(raw_level * (MOPEKA_LPG_COEF[0] + MOPEKA_LPG_COEF[1] * raw_t + MOPEKA_LPG_COEF[2] * raw_t * raw_t));
return (uint32_t) (raw_level *
(MOPEKA_LPG_COEF[0] + MOPEKA_LPG_COEF[1] * raw_t + MOPEKA_LPG_COEF[2] * raw_t * raw_t));
}
uint8_t MopekaProCheck::parse_temperature_(const std::vector<uint8_t> &message) { return (message[2] & 0x7F) - 40; }

View File

@ -17,7 +17,7 @@ def run_format(args, queue, lock, failed_files):
"""Takes filenames out of queue and runs clang-format on them."""
while True:
path = queue.get()
invocation = ["clang-format-11"]
invocation = ["clang-format-13"]
if args.inplace:
invocation.append("-i")
else:
@ -59,14 +59,14 @@ def main():
args = parser.parse_args()
try:
get_output("clang-format-11", "-version")
get_output("clang-format-13", "-version")
except:
print(
"""
Oops. It looks like clang-format is not installed.
Please check you can run "clang-format-11 -version" in your terminal and install
clang-format (v11) if necessary.
Please check you can run "clang-format-13 -version" in your terminal and install
clang-format (v13) if necessary.
Note you can also upload your code as a pull request on GitHub and see the CI check
output to apply clang-format.