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

Avoid shadowing diagnostics for @override methods #12415

Merged
merged 1 commit into from
Jul 20, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Closes #12412.

@charliermarsh charliermarsh marked this pull request as ready for review July 20, 2024 01:19
@charliermarsh charliermarsh added the bug Something isn't working label Jul 20, 2024
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

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

bokeh/bokeh (+0 -2 violations, +0 -0 fixes)

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

- src/bokeh/core/property/enum.py:57:78: A002 Argument `help` is shadowing a Python builtin
- src/bokeh/core/property/enum.py:59:75: A002 Argument `help` is shadowing a Python builtin

zulip/zulip (+0 -4 violations, +0 -0 fixes)

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

- zerver/lib/db.py:38:37: A002 Argument `vars` is shadowing a Python builtin
- zerver/tests/test_auth_backends.py:1954:9: A002 Argument `next` is shadowing a Python builtin
- zerver/tests/test_auth_backends.py:3475:9: A002 Argument `next` is shadowing a Python builtin
- zerver/tests/test_auth_backends.py:3521:9: A002 Argument `next` is shadowing a Python builtin

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
A002 6 0 6 0 0

Linter (preview)

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

bokeh/bokeh (+0 -2 violations, +0 -0 fixes)

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

- src/bokeh/core/property/enum.py:57:78: A002 Argument `help` is shadowing a Python builtin
- src/bokeh/core/property/enum.py:59:75: A002 Argument `help` is shadowing a Python builtin

zulip/zulip (+0 -4 violations, +0 -0 fixes)

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

- zerver/lib/db.py:38:37: A002 Argument `vars` is shadowing a Python builtin
- zerver/tests/test_auth_backends.py:1954:9: A002 Argument `next` is shadowing a Python builtin
- zerver/tests/test_auth_backends.py:3475:9: A002 Argument `next` is shadowing a Python builtin
- zerver/tests/test_auth_backends.py:3521:9: A002 Argument `next` is shadowing a Python builtin

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
A002 6 0 6 0 0

@charliermarsh charliermarsh merged commit 4bcc96a into main Jul 20, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/o branch July 20, 2024 01:32
@cbornet
Copy link

cbornet commented Aug 22, 2024

I'm not sure it's good to always ignore the rule on overrides.
I have some classes that look like this:

class A:
    def foo(**kwargs):
        pass

class B(A):
    @override
    def foo(*, filter, **kwargs):
        pass

Previously, it was triggering A002 because filter is a builtin which I had to silence (couldn't rename because of backward compatibility).
I think that was fair.
But now the rule is not triggered anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

builtin-argument-shadowing (A002) should not fire when overriding
2 participants