supervision
supervision copied to clipboard
pre-commit autoupdate 2025-10-04
Description
This is #1928 with fixes for ruff rule RUF059.
- #1928
% pre-commit autoupdate
[https://github.com/pre-commit/pre-commit-hooks] updating v5.0.0 -> v6.0.0
[https://github.com/PyCQA/bandit] already up to date!
[https://github.com/astral-sh/ruff-pre-commit] updating v0.12.5 -> v0.13.3
[https://github.com/codespell-project/codespell] already up to date!
[https://github.com/asottile/pyupgrade] already up to date!
% ruff check --select=RUF059 --fix --unsafe-fixes
Found 7 errors (7 fixed, 0 remaining).
Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] This change requires a documentation update
How has this change been tested, please provide a testcase or example of how you tested the change?
% pre-commit run --all-files
Also, note that the pre-commit.ci test below passes on this PR but does not on #1928.
Any specific deployment considerations
For example, documentation changes, usability, usage/costs, secrets, etc.
Docs
- [ ] Docs updated? What were the changes:
% ruff rule RUF059
unused-unpacked-variable (RUF059)
Derived from the Ruff-specific rules linter.
Fix is sometimes available.
What it does
Checks for the presence of unused variables in unpacked assignments.
Why is this bad?
A variable that is defined but never used can confuse readers.
If a variable is intentionally defined-but-not-used, it should be
prefixed with an underscore, or some other value that adheres to the
[lint.dummy-variable-rgx] pattern.
Example
def get_pair():
return 1, 2
def foo():
x, y = get_pair()
return x
Use instead:
def foo():
x, _ = get_pair()
return x
See also
This rule applies only to unpacked assignments. For regular assignments, see
unused-variable.
Options
lint.dummy-variable-rgx
Hi @cclauss 👋🏻 I have one question about this change. Why did we switch from ruff to ruff check here?
As of Ruff 0.7.0:
- ruff → split into ruff-check (lint) and ruff-format (format)
- https://docs.astral.sh/ruff/integrations/#pre-commit