-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
Enable Ruff Preview #115687
base: dev
Are you sure you want to change the base?
Enable Ruff Preview #115687
Conversation
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.
Overall I don't think we should enable the ruff preview rules. It's fine to apply them locally from time to time and suggest a PR with the changes but I'm against using them by default.
They are considered preview for a reason after all. Btw. that's similar to how I handled new pylint rules in the past.
call, msg = await assert_request_calls_service( | ||
_, msg = await assert_request_calls_service( |
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.
call
might technically be unused. However, I would recommend against replacing it with _
. There isn't really a performance benefit in doing so and it can help with debugging.
Personally, I suggest we disable that rule.
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.
Hmm, pylint is the same opinion as Ruff is and puts it as "Unused variable"
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Just for clarification, these stable rules are extended in preview mode (which have occurrences in the codebase):
|
IMO it's a bit unfortunate that they extend it that way and not just create a new rule, but given that I would suggest we disable it. Same story for The other changes seem fine but as I explained earlier, I'd suggest we only commit these without enabling the preview mode in general. |
I can understand why they extended it that way, but the explicit With |
Proposed change
This enables the Ruff preview. The option
explicit-preview-rules = true
is used so that no new preview rules are enabled unless explicitly defined.This only enables more findings and fixes for stable rules.
The option
output-format = "concise"
is there because in preview mode, Ruff defaults to the full output.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
..coveragerc
.To help with the load of incoming pull requests: