mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:07:33 +00:00
[core] Enable ruff G (flake8-logging-format) lint family (#16650)
This commit is contained in:
@@ -96,7 +96,7 @@ def _extract_tz_string(tzfile: bytes) -> str:
|
||||
return tzfile.split(b"\n")[-2].decode()
|
||||
except (IndexError, UnicodeDecodeError):
|
||||
_LOGGER.error("Could not determine TZ string. Please report this issue.")
|
||||
_LOGGER.error("tzfile contents: %s", tzfile, exc_info=True)
|
||||
_LOGGER.exception("tzfile contents: %s", tzfile)
|
||||
raise
|
||||
|
||||
|
||||
|
||||
@@ -239,12 +239,12 @@ def _lookup_module(domain: str, exception: bool) -> ComponentManifest | None:
|
||||
"Unable to import component %s: %s", domain, str(e), exc_info=False
|
||||
)
|
||||
else:
|
||||
_LOGGER.error("Unable to import component %s:", domain, exc_info=True)
|
||||
_LOGGER.exception("Unable to import component %s:", domain)
|
||||
return None
|
||||
except Exception: # pylint: disable=broad-except
|
||||
if exception:
|
||||
raise
|
||||
_LOGGER.error("Unable to load component %s:", domain, exc_info=True)
|
||||
_LOGGER.exception("Unable to load component %s:", domain)
|
||||
return None
|
||||
|
||||
manif = ComponentManifest(module)
|
||||
|
||||
@@ -272,9 +272,10 @@ def check_strapping_pin(conf, strapping_pin_list: set[int], logger: Logger):
|
||||
num = conf[CONF_NUMBER]
|
||||
if num in strapping_pin_list and not conf.get(CONF_IGNORE_STRAPPING_WARNING):
|
||||
logger.warning(
|
||||
f"GPIO{num} is a strapping PIN and should only be used for I/O with care.\n"
|
||||
"GPIO%s is a strapping PIN and should only be used for I/O with care.\n"
|
||||
"Attaching external pullup/down resistors to strapping pins can cause unexpected failures.\n"
|
||||
"See https://esphome.io/guides/faq/#why-am-i-getting-a-warning-about-strapping-pins",
|
||||
num,
|
||||
)
|
||||
# mitigate undisciplined use of strapping:
|
||||
if num not in strapping_pin_list and conf.get(CONF_IGNORE_STRAPPING_WARNING):
|
||||
|
||||
@@ -96,7 +96,7 @@ def _run_idedata(config):
|
||||
try:
|
||||
return json.loads(match.group())
|
||||
except ValueError:
|
||||
_LOGGER.error("Could not parse idedata", exc_info=True)
|
||||
_LOGGER.exception("Could not parse idedata")
|
||||
_LOGGER.error("Stdout: %s", stdout)
|
||||
raise
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ select = [
|
||||
"FA", # flake8-future-annotations
|
||||
"FLY", # flynt: convert string formatting to f-strings
|
||||
"FURB", # refurb
|
||||
"G", # flake8-logging-format
|
||||
"I", # isort
|
||||
"ICN", # flake8-import-conventions
|
||||
"ISC", # flake8-implicit-str-concat
|
||||
|
||||
Reference in New Issue
Block a user