mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Add Ruff LOG rules (#113677)
* Add Ruff LOG rules * Address review comment * Update const.py
This commit is contained in:
parent
b8e1862746
commit
929bcb92e2
@ -21,7 +21,7 @@ LOGSEVERITY = {
|
||||
LOGSEVERITY_FATAL: logging.FATAL,
|
||||
LOGSEVERITY_ERROR: logging.ERROR,
|
||||
LOGSEVERITY_WARNING: logging.WARNING,
|
||||
LOGSEVERITY_WARN: logging.WARN,
|
||||
LOGSEVERITY_WARN: logging.WARNING,
|
||||
LOGSEVERITY_INFO: logging.INFO,
|
||||
LOGSEVERITY_DEBUG: logging.DEBUG,
|
||||
LOGSEVERITY_NOTSET: logging.NOTSET,
|
||||
|
@ -294,7 +294,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
handler = LogErrorHandler(
|
||||
hass, conf[CONF_MAX_ENTRIES], conf[CONF_FIRE_EVENT], paths_re
|
||||
)
|
||||
handler.setLevel(logging.WARN)
|
||||
handler.setLevel(logging.WARNING)
|
||||
|
||||
hass.data[DOMAIN] = handler
|
||||
|
||||
|
@ -870,7 +870,7 @@ class LogRelayHandler(logging.Handler):
|
||||
def emit(self, record: LogRecord) -> None:
|
||||
"""Relay log message via dispatcher."""
|
||||
entry = LogEntry(
|
||||
record, self.paths_re, figure_out_source=record.levelno >= logging.WARN
|
||||
record, self.paths_re, figure_out_source=record.levelno >= logging.WARNING
|
||||
)
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
|
@ -601,6 +601,7 @@ select = [
|
||||
"I", # isort
|
||||
"ISC", # flake8-implicit-str-concat
|
||||
"ICN001", # import concentions; {name} should be imported as {asname}
|
||||
"LOG", # flake8-logging
|
||||
"N804", # First argument of a class method should be named cls
|
||||
"N805", # First argument of a method should be named self
|
||||
"N815", # Variable {name} in class scope should not be mixedCase
|
||||
|
Loading…
x
Reference in New Issue
Block a user