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

RUF001 reports multiple violations for the same character in a nested typing string #16117

Closed
dscorbett opened this issue Feb 12, 2025 · 0 comments · Fixed by #16122
Closed
Labels
bug Something isn't working rule Implementing or modifying a lint rule

Comments

@dscorbett
Copy link

Description

ambiguous-unicode-character-string (RUF001) reports one violation per level of nested quotes for a string in a typing context. This is redundant: it should only report one violation for any given character.

$ cat >ruf001.py <<'# EOF'
from typing import Literal
x: '''"""'Literal["ﮨ"]'"""'''
# EOF

$ ruff check --isolated --select RUF001 ruf001.py --output-format concise
ruf001.py:2:20: RUF001 String contains ambiguous `ﮨ` (ARABIC LETTER HEH GOAL INITIAL FORM). Did you mean `o` (LATIN SMALL LETTER O)?
ruf001.py:2:20: RUF001 String contains ambiguous `ﮨ` (ARABIC LETTER HEH GOAL INITIAL FORM). Did you mean `o` (LATIN SMALL LETTER O)?
ruf001.py:2:20: RUF001 String contains ambiguous `ﮨ` (ARABIC LETTER HEH GOAL INITIAL FORM). Did you mean `o` (LATIN SMALL LETTER O)?
ruf001.py:2:20: RUF001 String contains ambiguous `ﮨ` (ARABIC LETTER HEH GOAL INITIAL FORM). Did you mean `o` (LATIN SMALL LETTER O)?
Found 4 errors.
@AlexWaygood AlexWaygood added bug Something isn't working rule Implementing or modifying a lint rule labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants