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

PYI053 autofix removes @deprecated message #9420

Closed
hamdanal opened this issue Jan 7, 2024 · 1 comment · Fixed by #9423
Closed

PYI053 autofix removes @deprecated message #9420

hamdanal opened this issue Jan 7, 2024 · 1 comment · Fixed by #9423
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@hamdanal
Copy link

hamdanal commented Jan 7, 2024

This concerns @deprecated from PEP-702

  • A minimal code snippet that reproduces the bug.
    Create a t.pyi file with the following content:
from typing_extensions import deprecated

@deprecated("Function deprecated_func is deprecated. Use method new_func instead.")
def deprecated_func(self) -> None: ...
  • The command you invoked (e.g., ruff /path/to/file.py --fix), ideally including the --isolated flag.
$ # ruff generates an error
$ ruff check --select=PYI t.pyi --isolated
t.pyi:3:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted
Found 1 error.
[*] 1 fixable with the `--fix` option.
$ # While flake8-pyi does not
$ pip list | grep pyi
flake8-pyi  24.1.0
$ flake8 --select=Y t.pyi
$ # Even worse, with --fix it removes the message
$ ruff check --select=PYI t.pyi --isolated --diff
--- t.pyi
+++ t.pyi
@@ -1,4 +1,4 @@
 from typing_extensions import deprecated

-@deprecated("Function deprecated_func is deprecated. Use method new_func instead.")
+@deprecated(...)
 def deprecated_func(self) -> None: ...

Would fix 1 error.
  • The current Ruff settings (any relevant sections from your pyproject.toml): N/A
  • The current Ruff version (ruff --version): ruff 0.1.11
@AlexWaygood
Copy link
Member

Ah yes, we had to introduce some special-casing over at flake8-pyi recently for exactly this issue: PyCQA/flake8-pyi@c7d988e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
3 participants