mirror of
https://github.com/home-assistant/core.git
synced 2026-08-03 20:24:55 +02:00
Update ruff to 0.16.0 (#177534)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.15.22
|
||||
rev: v0.16.0
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
args:
|
||||
|
||||
@@ -41,7 +41,7 @@ async def async_setup_platform(
|
||||
try:
|
||||
event = json_loads_object(msg.payload)
|
||||
device = parse_message(msg.topic, event)
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.debug(
|
||||
"Failed to parse ARWN message on topic %s",
|
||||
msg.topic,
|
||||
|
||||
@@ -83,7 +83,7 @@ class EmonitorConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
self.discovered_info = await fetch_mac_and_title(
|
||||
self.hass, self.discovered_ip
|
||||
)
|
||||
except Exception as ex: # noqa: BLE001
|
||||
except Exception as ex:
|
||||
_LOGGER.debug(
|
||||
"Unable to fetch status, falling back to manual entry", exc_info=ex
|
||||
)
|
||||
|
||||
@@ -87,7 +87,7 @@ class CometBlueConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
except BleakError:
|
||||
LOGGER.debug("Failed to connect to device", exc_info=True)
|
||||
return {"base": "cannot_connect"}
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
LOGGER.debug("Unknown error", exc_info=True)
|
||||
return {"base": "unknown"}
|
||||
return {}
|
||||
|
||||
@@ -173,7 +173,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
)
|
||||
try:
|
||||
await server.start()
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.warning("Could not start go2rtc server", exc_info=True)
|
||||
await session.close()
|
||||
return False
|
||||
|
||||
@@ -198,7 +198,7 @@ class BaseFirmwareUpdateEntity(
|
||||
self.entity_description.expected_firmware_type,
|
||||
self._current_firmware_info.firmware_type,
|
||||
)
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.warning(
|
||||
"Failed to call firmware type changed callback", exc_info=True
|
||||
)
|
||||
|
||||
@@ -404,7 +404,7 @@ async def probe_silabs_firmware_info(
|
||||
else None
|
||||
)
|
||||
)
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.debug("Failed to probe application type", exc_info=True)
|
||||
|
||||
if flasher.app_type is None:
|
||||
@@ -438,7 +438,7 @@ async def probe_silabs_firmware_type(
|
||||
|
||||
try:
|
||||
await flasher.probe_app_type()
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.debug("Failed to probe application type", exc_info=True)
|
||||
|
||||
if flasher.app_type is None:
|
||||
|
||||
@@ -264,7 +264,7 @@ class Router:
|
||||
ResponseErrorNotSupportedException,
|
||||
):
|
||||
pass # Ok, normal, nothing to do
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.warning("Logout error", exc_info=True)
|
||||
|
||||
def cleanup(self, *_: Any) -> None:
|
||||
|
||||
@@ -222,18 +222,18 @@ class HuaweiLteConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
client = Client(conn)
|
||||
try:
|
||||
device_info = client.device.information()
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.debug("Could not get device.information", exc_info=True)
|
||||
try:
|
||||
device_info = client.device.basic_information()
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.debug(
|
||||
"Could not get device.basic_information", exc_info=True
|
||||
)
|
||||
device_info = {}
|
||||
try:
|
||||
wlan_settings = client.wlan.multi_basic_settings()
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.debug("Could not get wlan.multi_basic_settings", exc_info=True)
|
||||
wlan_settings = {}
|
||||
return device_info, wlan_settings
|
||||
|
||||
@@ -87,7 +87,7 @@ class TibberRuntimeData:
|
||||
try:
|
||||
async with asyncio.timeout(DISCONNECT_TIMEOUT):
|
||||
await self._client.rt_disconnect()
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
_LOGGER.warning(
|
||||
"Error disconnecting the Tibber realtime connection", exc_info=True
|
||||
)
|
||||
|
||||
@@ -103,7 +103,7 @@ class Hub:
|
||||
_LOGGER.info("Stopping hub")
|
||||
try:
|
||||
await self._hub.disconnect()
|
||||
except Exception as err: # noqa: BLE001
|
||||
except Exception as err:
|
||||
_LOGGER.warning(
|
||||
"Ignoring error while disconnecting from hub %s during shutdown",
|
||||
self.host,
|
||||
|
||||
@@ -210,7 +210,7 @@ class PlatformData:
|
||||
return await translation.async_get_translations(
|
||||
self.hass, language, category, {integration}
|
||||
)
|
||||
except Exception as err: # noqa: BLE001
|
||||
except Exception as err:
|
||||
_LOGGER.debug(
|
||||
"Could not load translations for %s",
|
||||
integration,
|
||||
|
||||
@@ -63,7 +63,7 @@ def run_callback_threadsafe[_T, *_Ts](
|
||||
"""Run callback and store result."""
|
||||
try:
|
||||
future.set_result(callback(*args))
|
||||
except Exception as exc: # noqa: BLE001
|
||||
except Exception as exc:
|
||||
if future.set_running_or_notify_cancel():
|
||||
future.set_exception(exc)
|
||||
else:
|
||||
|
||||
+8
-1
@@ -645,7 +645,7 @@ exclude_lines = [
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
required-version = ">=0.15.22"
|
||||
required-version = ">=0.16.0"
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
@@ -736,6 +736,7 @@ ignore = [
|
||||
"PLR0912", # Too many branches ({branches} > {max_branches})
|
||||
"PLR0913", # Too many arguments to function call ({c_args} > {max_args})
|
||||
"PLR0915", # Too many statements ({statements} > {max_statements})
|
||||
"PLR0917", # Too many positional arguments defined for a function ({p_args} > {max_args})
|
||||
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
|
||||
"PLW0108", # Unnecessary lambda wrapping a function call; can often be replaced by the function itself
|
||||
"PLW1641", # __eq__ without __hash__
|
||||
@@ -779,6 +780,12 @@ ignore = [
|
||||
"PLE0605",
|
||||
|
||||
"FURB116",
|
||||
|
||||
# Disabled to implement in follow up PRs after ruff 0.16 bump
|
||||
"RUF036",
|
||||
"ISC004",
|
||||
"LOG004",
|
||||
"FURB192",
|
||||
]
|
||||
|
||||
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit
|
||||
|
||||
codespell==2.4.3
|
||||
ruff==0.15.22
|
||||
ruff==0.16.0
|
||||
yamllint==1.38.0
|
||||
zizmor==1.25.2
|
||||
|
||||
Reference in New Issue
Block a user