[tests] Fix -Wformat= mismatches in test YAML lambdas/logger.log (#16435)

This commit is contained in:
Jonathan Swoboda
2026-05-14 18:40:40 -04:00
committed by Jesse Hills
parent dd1818661c
commit d5c6efb2fe
12 changed files with 34 additions and 34 deletions
+7 -7
View File
@@ -506,13 +506,13 @@ async def _late_logger_init(config: ConfigType) -> None:
def validate_printf(value):
# https://stackoverflow.com/questions/30011379/how-can-i-parse-a-c-format-string-in-python
cfmt = r"""
( # start of capture group 1
% # literal "%"
(?:[-+0 #]{0,5}) # optional flags
(?:\d+|\*)? # width
(?:\.(?:\d+|\*))? # precision
(?:h|l|ll|w|I|I32|I64)? # size
[cCdiouxXeEfgGaAnpsSZ] # type
( # start of capture group 1
% # literal "%"
(?:[-+0 #]{0,5}) # optional flags
(?:\d+|\*)? # width
(?:\.(?:\d+|\*))? # precision
(?:hh|h|ll|l|j|z|t|L|w|I|I32|I64)? # size
[cCdiouxXeEfgGaAnpsSZ] # type
)
""" # noqa
matches = re.findall(cfmt, value[CONF_FORMAT], flags=re.VERBOSE)
+14 -14
View File
@@ -9,13 +9,13 @@ CONF_IF_NAN = "if_nan"
# noqa
f_regex = re.compile(
r"""
( # start of capture group 1
% # literal "%"
[-+0 #]{0,5} # optional flags
(?:\d+|\*)? # width
(?:\.(?:\d+|\*))? # precision
(?:h|l|ll|w|I|I32|I64)? # size
f # type
( # start of capture group 1
% # literal "%"
[-+0 #]{0,5} # optional flags
(?:\d+|\*)? # width
(?:\.(?:\d+|\*))? # precision
(?:hh|h|ll|l|j|z|t|L|w|I|I32|I64)? # size
f # type
)
""",
flags=re.VERBOSE,
@@ -23,13 +23,13 @@ f_regex = re.compile(
# noqa
c_regex = re.compile(
r"""
( # start of capture group 1
% # literal "%"
[-+0 #]{0,5} # optional flags
(?:\d+|\*)? # width
(?:\.(?:\d+|\*))? # precision
(?:h|l|ll|w|I|I32|I64)? # size
[cCdiouxXeEfgGaAnpsSZ] # type
( # start of capture group 1
% # literal "%"
[-+0 #]{0,5} # optional flags
(?:\d+|\*)? # width
(?:\.(?:\d+|\*))? # precision
(?:hh|h|ll|l|j|z|t|L|w|I|I32|I64)? # size
[cCdiouxXeEfgGaAnpsSZ] # type
)
""",
flags=re.VERBOSE,
@@ -29,12 +29,12 @@ esp32_ble_tracker:
- service_uuid: ABCD
then:
- lambda: !lambda |-
ESP_LOGD("main", "Length of service data is %i", x.size());
ESP_LOGD("main", "Length of service data is %zu", x.size());
on_ble_manufacturer_data_advertise:
- manufacturer_id: ABCD
then:
- lambda: !lambda |-
ESP_LOGD("main", "Length of manufacturer data is %i", x.size());
ESP_LOGD("main", "Length of manufacturer data is %zu", x.size());
on_scan_end:
- then:
- lambda: |-
+1 -1
View File
@@ -123,7 +123,7 @@ select:
- lambda: |-
id(uart_bus).flush();
uint32_t new_baud_rate = stoi(x);
ESP_LOGD("change_baud_rate", "Changing baud rate from %i to %i",id(uart_bus).get_baud_rate(), new_baud_rate);
ESP_LOGD("change_baud_rate", "Changing baud rate from %" PRIu32 " to %" PRIu32, id(uart_bus).get_baud_rate(), new_baud_rate);
if (id(uart_bus).get_baud_rate() != new_baud_rate) {
id(uart_bus).set_baud_rate(new_baud_rate);
#if defined(USE_ESP8266) || defined(USE_ESP32)
+3 -3
View File
@@ -660,13 +660,13 @@ lvgl:
on_release:
logger.log:
format: Button released at %d/%d
args: [point.x, point.y]
args: ['(int) point.x', '(int) point.y']
on_long_press_repeat:
logger.log: Button clicked
on_pressing:
logger.log:
format: Button pressing at %d/%d
args: [point.x, point.y]
args: ['(int) point.x', '(int) point.y']
on_press_lost:
logger.log: Button press lost
on_single_click:
@@ -944,7 +944,7 @@ lvgl:
on_release:
logger.log:
format: Slider released at %d/%d with value %.0f
args: [point.x, point.y, x]
args: ['(int) point.x', '(int) point.y', x]
- button:
styles: spin_button
id: spin_up
+1 -1
View File
@@ -21,7 +21,7 @@ modbus_server:
read_lambda: |-
return 31;
write_lambda: |-
printf("address=%d, value=%d", x);
printf("address=%d, value=%" PRId32 "\n", (int) address, x);
return true;
- id: modbus_server4
modbus_id: mod_bus2
+1 -1
View File
@@ -64,7 +64,7 @@ mqtt:
topic: some/topic
payload: Good-bye
- lambda: |-
ESP_LOGD("MQTT", "Disconnect reason %d", reason);
ESP_LOGD("MQTT", "Disconnect reason %d", (int) reason);
publish_nan_as_none: false
binary_sensor:
+1 -1
View File
@@ -299,7 +299,7 @@ display:
- lambda: |-
// key: StringRef, value: int32_t
if (key == "temperature_raw") {
ESP_LOGD("nextion.custom", "%s=%d", key.c_str(), value);
ESP_LOGD("nextion.custom", "%s=%" PRId32, key.c_str(), value);
}
on_custom_binary_sensor:
then:
@@ -12,7 +12,7 @@ on_brennenstuhl:
then:
- logger.log:
format: "on_brennenstuhl: %u"
args: ["x.code"]
args: ["(unsigned) x.code"]
on_aeha:
then:
- logger.log:
+1 -1
View File
@@ -49,7 +49,7 @@ script:
then:
- lambda: |-
ESP_LOGD("main", "ints=%d floats=%f bools=%d strings=%s",
ints[0], floats[0], bools[0], strings[0].c_str());
ints[0], floats[0], (int) bools[0], strings[0].c_str());
- id: my_script_with_params
parameters:
prefix: string
+1 -1
View File
@@ -11,7 +11,7 @@ udp:
- "10.0.0.255"
on_receive:
- logger.log:
format: "Received %d bytes"
format: "Received %zu bytes"
args: [data.size()]
- udp.write:
id: my_udp
+1 -1
View File
@@ -4,7 +4,7 @@ udp:
addresses: ["239.0.60.53"]
on_receive:
- logger.log:
format: "Received %d bytes"
format: "Received %zu bytes"
args: [data.size()]
- udp.write:
id: my_udp