-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code quality improvements at Home Connect #126323
base: dev
Are you sure you want to change the base?
Code quality improvements at Home Connect #126323
Conversation
Hey there @DavidMStraub, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
@joostlek These are all the things I found that I think they need quality improvements, do you know any tool or command that can help me find any other code quality issues? |
@@ -244,7 +244,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | |||
|
|||
|
|||
@Throttle(SCAN_INTERVAL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to remove as much throttles as possible, so it would be interesting to explore the option of adding a coordinator
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
We want our functions completely typed in general. Instance variables are usually inferred when set (unless mypy complains, then you add one). So we don't have to overwrite every instance variable with a type outside of the constructor |
0559f8f
to
f2bc45a
Compare
Added types to all arguments and return values to all functions Defined class members and its types outside the constructor Improved logic at binary sensor
f2bc45a
to
9189af7
Compare
I noticed that in some components, the entity description tuples are placed at the end of the file This might be a good idea to apply because entity descriptions can be quite large, and if they are placed before classes and logic, classes and logic will be be at the end of the file, which means you have to scroll all the way down to get to the code, which is quite inconvenient and sensor. (And also specifying the type of the tuples might not be necessary) core/homeassistant/components/home_connect/binary_sensor.py Lines 52 to 65 in 9189af7
core/homeassistant/components/home_connect/light.py Lines 52 to 63 in 9189af7
core/homeassistant/components/home_connect/sensor.py Lines 53 to 90 in 9189af7
core/homeassistant/components/home_connect/switch.py Lines 40 to 54 in 9189af7
|
Breaking change
Proposed change
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: