Skip to content
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

[ruff] Omit diagnostic for shadowed private function parameters in used-dummy-variable (RUF052) #15376

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented Jan 9, 2025

As discussed in #14818, we should skip used-dummy-variable (RUF052) for private function parameters. This PR extends the logic from loc. cit. and further skips the lint for bindings in the body of a function which shadow a private function parameter.

Closes #14968

@dylwil3 dylwil3 added the rule Implementing or modifying a lint rule label Jan 9, 2025
Copy link
Contributor

github-actions bot commented Jan 9, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -12 violations, +0 -0 fixes in 6 projects; 49 projects unchanged)

RasaHQ/rasa (+0 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- rasa/utils/tensorflow/crf.py:119:9: RUF052 Local dummy variable `_state` is accessed
- rasa/utils/tensorflow/crf.py:386:9: RUF052 Local dummy variable `_state` is accessed

apache/airflow (+0 -3 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

- dev/breeze/src/airflow_breeze/utils/run_utils.py:122:13: RUF052 Local dummy variable `_argument` is accessed
- providers/src/airflow/providers/elasticsearch/log/es_response.py:33:13: RUF052 Local dummy variable `_list` is accessed
- providers/src/airflow/providers/opensearch/log/os_response.py:33:13: RUF052 Local dummy variable `_list` is accessed

pandas-dev/pandas (+0 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- pandas/core/nanops.py:765:13: RUF052 Local dummy variable `_mask` is accessed
- pandas/core/nanops.py:767:13: RUF052 Local dummy variable `_mask` is accessed

reflex-dev/reflex (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- reflex/vars/sequence.py:624:9: RUF052 Local dummy variable `_var_type` is accessed

scikit-build/scikit-build-core (+0 -3 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- src/scikit_build_core/settings/sources.py:72:9: RUF052 Local dummy variable `__dict` is accessed
- src/scikit_build_core/settings/sources.py:82:9: RUF052 Local dummy variable `__dict` is accessed
- src/scikit_build_core/settings/sources.py:93:10: RUF052 Local dummy variable `__opt` is accessed

astropy/astropy (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

- astropy/io/fits/util.py:181:9: RUF052 Local dummy variable `_seen` is accessed

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF052 12 0 12 0 0

@dylwil3
Copy link
Collaborator Author

dylwil3 commented Jan 9, 2025

Ecosystem results all look correct to me!

@MichaReiser MichaReiser added the preview Related to preview mode features label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RUF052: Don't flag assignments to private function arguments
2 participants