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 is now compatible with Python pattern matching #3650

Merged
merged 6 commits into from
Mar 13, 2023

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Mar 11, 2023

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 style
  • Fix codespell typos
  • Fix mypy issues
  • Fix ruff issues and add new ruff rules (pylint, McCabe code complexity) to the testing.

Checklists

  • Add a CHANGELOG entry
  • Add / update tests
  • Add new / update outdated documentation

Copy link
Member

@rth rth left a 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.

pyproject.toml Outdated Show resolved Hide resolved
Copy link
Member

@ryanking13 ryanking13 left a 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 Show resolved Hide resolved
Comment on lines 2253 to 2254
assert o.async_ == 1
assert o.async__ == 2
Copy link
Contributor Author

@cclauss cclauss Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@hoodmane
Copy link
Member

Thanks @cclauss!

@hoodmane hoodmane merged commit 57f36ac into pyodide:main Mar 13, 2023
@cclauss cclauss deleted the upgrade-github-actions-again branch March 13, 2023 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants