fix: Resolve all ruff lint errors and add CONFIG_SCHEMA#132
Merged
markus-lassfolk merged 9 commits intodevelopfrom Mar 7, 2026
Merged
fix: Resolve all ruff lint errors and add CONFIG_SCHEMA#132markus-lassfolk merged 9 commits intodevelopfrom
markus-lassfolk merged 9 commits intodevelopfrom
Conversation
- Add CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN) for HA 2024.x compat - Add type annotations to discovery.py callbacks (on_connect, on_message) - Add return type annotations to test functions - Replace assert False with raise AssertionError (B011) - Fix line-too-long in coordinator.py (E501) - Add noqa: E402 for intentional late imports in __init__.py - Auto-fix import sorting (I001) Ruff now passes with zero errors.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR fixes all 27 ruff lint errors across the Yarbo Home Assistant integration codebase and adds the CONFIG_SCHEMA constant required for HA 2024.x compatibility.
Changes:
- Adds
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)and correspondingcvimport to__init__.py, along withnoqa: E402annotations on intentionally late imports - Adds type annotations (
Anyand-> None) to paho-mqtt callback functions indiscovery.pyand removes unnecessarynoqadirectives for rule sets (ARG,BLE) that aren't enabled - Wraps long lines in
coordinator.pyand fixes test function signatures, import ordering, andassert False→raise AssertionError(...)intests/test_init.py
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
custom_components/yarbo/__init__.py |
Added CONFIG_SCHEMA for HA compatibility, cv import, and noqa: E402 on late imports |
custom_components/yarbo/discovery.py |
Added Any type annotations to MQTT callbacks, removed unnecessary noqa directives |
custom_components/yarbo/coordinator.py |
Wrapped long comment and expression to stay within 100-char line limit |
tests/test_init.py |
Added -> None return types, fixed import sorting, replaced assert False with raise AssertionError(...) |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Import changed from library to local, breaking safety net
- Restored the import from yarbo.error_reporting (library) instead of .error_reporting (local module) so the safety net properly disables library-level Sentry auto-init.
The import of init_error_reporting was incorrectly changed from the library (yarbo.error_reporting) to the local module (.error_reporting). This broke the safety net mechanism that disables library-level Sentry auto-init in older versions of python-yarbo. The _lib_init_error_reporting(enabled=False) call must invoke the library's function, not the local one, to properly suppress Sentry initialization in the python-yarbo package.
- Restore try/except import of yarbo.error_reporting in __init__.py to disable python-yarbo's Sentry auto-init (BugBot incorrectly removed it) - Add yarbo.error_reporting stub to test conftest so CI can resolve the module (root cause: conftest stubs yarbo but didn't include error_reporting) - Ensures GlitchTip catches errors from both HA integration (DSN /4) and python-yarbo library (DSN /2) without conflicts
… SocketBlockedError The DHCP flow calls async_discover_endpoints() after _probe_robot_identity(), which creates real network sockets. pytest-socket blocks these in tests. Add the missing patch to test_dhcp_discovery_shows_confirm and test_dhcp_confirm_then_mqtt_test_and_create_entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix all 27 ruff lint errors and add missing
CONFIG_SCHEMAfor Home Assistant 2024.x compatibility.Changes
__init__.pyCONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)— prevents HA from logging warnings about missing config schemaimport homeassistant.helpers.config_validation as cvnoqa: E402for intentional late imports (after safety-net_lib_init_error_reportingcall)discovery.pyfrom typing import Anyon_connect()andon_message()callbacks (ANN001/ANN202)coordinator.pytests/test_init.py-> Nonereturn type annotations to test functions (ANN201)assert Falsewithraise AssertionError()(B011)Result
ruff check .→ All checks passed! (was 27 errors)Note
Low Risk
Low risk: primarily lint/type/formatting changes plus a minimal
CONFIG_SCHEMAaddition and a safer (try/except) guard around disabling python-yarbo’s error reporting.Overview
Adds
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)to the integration to satisfy HA’s expected config schema and updates__init__.pyto disable python-yarbo’s library-level Sentry init via atry/except ImportErrorguard (with late imports annotated using# noqa: E402).Cleans up remaining ruff violations across the integration (line wrapping, callback type annotations, minor simplifications) and updates tests to stub
yarbo.error_reporting, mark DHCP discovery tests with@pytest.mark.allow_net_connect, and patchasync_discover_endpointsto keep config-flow tests deterministic.Written by Cursor Bugbot for commit 5e582e2. This will update automatically on new commits. Configure here.