mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 03:28:41 +00:00
Exempt empty literals from the log literal lint
This commit is contained in:
+3
-1
@@ -1033,7 +1033,9 @@ def _find_ternary_literals(text: str) -> Iterator[tuple[int, str]]:
|
||||
branch = False
|
||||
for m in LOG_TERNARY_LITERAL_RE.finditer(text):
|
||||
tok = m.group(0)
|
||||
if branch and tok[0] == '"':
|
||||
# An empty literal is merged with every other string's terminator, so it costs no RAM,
|
||||
# while a PSTR("") would add its own flash array; leave it alone.
|
||||
if branch and tok[0] == '"' and tok != '""':
|
||||
yield m.start(), tok
|
||||
branch = tok[0] in "?:"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user