-
-
Notifications
You must be signed in to change notification settings - Fork 787
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 is now compatible with Python pattern matching #3650
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.
Thanks @cclauss !
One comment otherwise LGTM.
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.
Thanks @cclauss!
src/tests/test_jsproxy.py
Outdated
assert o.async_ == 1 | ||
assert o.async__ == 2 |
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.
assert o.async_ == 1 | |
assert o.async__ == 2 | |
assert getattr(o, "async_") == 1 # noqa: B009 | |
assert getattr(o, "async__") == 2 # noqa: B009 |
% ruff rule B009
get-attr-with-constant (B009)
Derived from the flake8-bugbear linter.
Autofix is always available.
Message formats:
- Do not call
getattr
with a constant attribute value. It is not any safer than normal property access.
Thanks @cclauss! |
Description
Closes #3624
Previous versions of
ruff
did not support Python 3.11 pattern matching and treated calls to it as SyntaxErrors.pre-commit autoupdate
# includes changes for psf/black 2023 stable styleChecklists