mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[ruff
] Skip RUF001 diagnostics when visiting string type definitions (#16122)
This commit is contained in:
parent
a9671e7008
commit
c31352f52b
4 changed files with 32 additions and 1 deletions
|
@ -56,3 +56,6 @@ assert getattr(Labware(), "µL") == 1.5
|
|||
|
||||
# Implicit string concatenation
|
||||
x = "𝐁ad" f"𝐁ad string"
|
||||
|
||||
from typing import Literal
|
||||
x: '''"""'Literal["ﮨ"]'"""'''
|
||||
|
|
|
@ -186,7 +186,13 @@ pub(crate) fn ambiguous_unicode_character_comment(
|
|||
|
||||
/// RUF001, RUF002
|
||||
pub(crate) fn ambiguous_unicode_character_string(checker: &Checker, string_like: StringLike) {
|
||||
let context = if checker.semantic().in_pep_257_docstring() {
|
||||
let semantic = checker.semantic();
|
||||
|
||||
if semantic.in_string_type_definition() {
|
||||
return;
|
||||
}
|
||||
|
||||
let context = if semantic.in_pep_257_docstring() {
|
||||
Context::Docstring
|
||||
} else {
|
||||
Context::String
|
||||
|
|
|
@ -160,6 +160,8 @@ confusables.py:58:6: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD
|
|||
57 | # Implicit string concatenation
|
||||
58 | x = "𝐁ad" f"𝐁ad string"
|
||||
| ^ RUF001
|
||||
59 |
|
||||
60 | from typing import Literal
|
||||
|
|
||||
|
||||
confusables.py:58:13: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)?
|
||||
|
@ -167,4 +169,13 @@ confusables.py:58:13: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD
|
|||
57 | # Implicit string concatenation
|
||||
58 | x = "𝐁ad" f"𝐁ad string"
|
||||
| ^ RUF001
|
||||
59 |
|
||||
60 | from typing import Literal
|
||||
|
|
||||
|
||||
confusables.py:61:20: RUF001 String contains ambiguous `ﮨ` (ARABIC LETTER HEH GOAL INITIAL FORM). Did you mean `o` (LATIN SMALL LETTER O)?
|
||||
|
|
||||
60 | from typing import Literal
|
||||
61 | x: '''"""'Literal["ﮨ"]'"""'''
|
||||
| ^ RUF001
|
||||
|
|
||||
|
|
|
@ -168,6 +168,8 @@ confusables.py:58:6: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD
|
|||
57 | # Implicit string concatenation
|
||||
58 | x = "𝐁ad" f"𝐁ad string"
|
||||
| ^ RUF001
|
||||
59 |
|
||||
60 | from typing import Literal
|
||||
|
|
||||
|
||||
confusables.py:58:13: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)?
|
||||
|
@ -175,4 +177,13 @@ confusables.py:58:13: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD
|
|||
57 | # Implicit string concatenation
|
||||
58 | x = "𝐁ad" f"𝐁ad string"
|
||||
| ^ RUF001
|
||||
59 |
|
||||
60 | from typing import Literal
|
||||
|
|
||||
|
||||
confusables.py:61:20: RUF001 String contains ambiguous `ﮨ` (ARABIC LETTER HEH GOAL INITIAL FORM). Did you mean `o` (LATIN SMALL LETTER O)?
|
||||
|
|
||||
60 | from typing import Literal
|
||||
61 | x: '''"""'Literal["ﮨ"]'"""'''
|
||||
| ^ RUF001
|
||||
|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue