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
Replace bandit with ruff #93200
Replace bandit with ruff #93200
Conversation
Hey there @mdegat01, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Hey there @bachya, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Only one trivial docstring thing to address. `keep-runtime-typing` replaced by `UP006` and `UP007` ignores: https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md#00268
B325 is not available in ruff, but it has been removed in bandit, too.
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.
Super nice! Great contributions upstream for this as well ❤️
../Frenck
Proposed change
Move from bandit to ruff. Ruff >= 0.0.271 will be needed before this can go in.
Remaining rules:
flake8-bandit
] Implementparamiko-call
(S601
) astral-sh/ruff#4500, in ruff >= 0.0.270The following discussion applies to an earlier submission where I proposed a partial move to ruff, with some rules still missing it. Keeping it for historical purposes.
Even though not all rules are yet available in ruff, I suppose consolidating towards it is a good thing. It appears to be doing a better job than bandit for at least some rules; it does not support
nosec
, and migrating them to supportednoqa
s turned up no things that could be removed. It did flag some additional, valid ones that were missed by bandit.Removal of these bandit rules brings the time it takes to run it down a bit, too. With B601 and B609 still left there but others removed, the times I see for
time pre-commit run bandit --all-files
go down from about...to roughly
Type of change
Additional information
Checklist
black --fast 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: