-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Unicode-to-Unicode confusables a preview change (#8473)
- Loading branch information
1 parent
b0f9a14
commit f2335fe
Showing
4 changed files
with
225 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
164 changes: 164 additions & 0 deletions
164
...linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/ruff/mod.rs | ||
--- | ||
confusables.py:1:6: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? | ||
| | ||
1 | x = "𝐁ad string" | ||
| ^ RUF001 | ||
2 | y = "−" | ||
| | ||
|
||
confusables.py:6:56: RUF002 Docstring contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? | ||
| | ||
5 | def f(): | ||
6 | """Here's a docstring with an unusual parenthesis: )""" | ||
| ^^ RUF002 | ||
7 | # And here's a comment with an unusual punctuation mark: ᜵ | ||
8 | ... | ||
| | ||
|
||
confusables.py:7:62: RUF003 Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? | ||
| | ||
5 | def f(): | ||
6 | """Here's a docstring with an unusual parenthesis: )""" | ||
7 | # And here's a comment with an unusual punctuation mark: ᜵ | ||
| ^ RUF003 | ||
8 | ... | ||
| | ||
|
||
confusables.py:17:6: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? | ||
| | ||
17 | x = "𝐁ad string" | ||
| ^ RUF001 | ||
18 | x = "−" | ||
| | ||
|
||
confusables.py:26:10: RUF001 String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? | ||
| | ||
24 | # The first word should be ignored, while the second should be included, since it | ||
25 | # contains ASCII. | ||
26 | x = "βα Bαd" | ||
| ^ RUF001 | ||
27 | | ||
28 | # The two characters should be flagged here. The first character is a "word" | ||
| | ||
|
||
confusables.py:31:6: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? | ||
| | ||
29 | # consisting of a single ambiguous character, while the second character is a "word | ||
30 | # boundary" (whitespace) that it itself ambiguous. | ||
31 | x = "Р усский" | ||
| ^ RUF001 | ||
32 | | ||
33 | # Same test cases as above but using f-strings instead: | ||
| | ||
|
||
confusables.py:31:7: RUF001 String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? | ||
| | ||
29 | # consisting of a single ambiguous character, while the second character is a "word | ||
30 | # boundary" (whitespace) that it itself ambiguous. | ||
31 | x = "Р усский" | ||
| ^ RUF001 | ||
32 | | ||
33 | # Same test cases as above but using f-strings instead: | ||
| | ||
|
||
confusables.py:34:7: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? | ||
| | ||
33 | # Same test cases as above but using f-strings instead: | ||
34 | x = f"𝐁ad string" | ||
| ^ RUF001 | ||
35 | x = f"−" | ||
36 | x = f"Русский" | ||
| | ||
|
||
confusables.py:37:11: RUF001 String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? | ||
| | ||
35 | x = f"−" | ||
36 | x = f"Русский" | ||
37 | x = f"βα Bαd" | ||
| ^ RUF001 | ||
38 | x = f"Р усский" | ||
| | ||
|
||
confusables.py:38:7: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? | ||
| | ||
36 | x = f"Русский" | ||
37 | x = f"βα Bαd" | ||
38 | x = f"Р усский" | ||
| ^ RUF001 | ||
39 | | ||
40 | # Nested f-strings | ||
| | ||
|
||
confusables.py:38:8: RUF001 String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? | ||
| | ||
36 | x = f"Русский" | ||
37 | x = f"βα Bαd" | ||
38 | x = f"Р усский" | ||
| ^ RUF001 | ||
39 | | ||
40 | # Nested f-strings | ||
| | ||
|
||
confusables.py:41:7: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? | ||
| | ||
40 | # Nested f-strings | ||
41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ||
| ^ RUF001 | ||
42 | | ||
43 | # Comments inside f-strings | ||
| | ||
|
||
confusables.py:41:21: RUF001 String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? | ||
| | ||
40 | # Nested f-strings | ||
41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ||
| ^ RUF001 | ||
42 | | ||
43 | # Comments inside f-strings | ||
| | ||
|
||
confusables.py:41:25: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? | ||
| | ||
40 | # Nested f-strings | ||
41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ||
| ^ RUF001 | ||
42 | | ||
43 | # Comments inside f-strings | ||
| | ||
|
||
confusables.py:41:26: RUF001 String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? | ||
| | ||
40 | # Nested f-strings | ||
41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ||
| ^ RUF001 | ||
42 | | ||
43 | # Comments inside f-strings | ||
| | ||
|
||
confusables.py:44:68: RUF003 Comment contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? | ||
| | ||
43 | # Comments inside f-strings | ||
44 | x = f"string { # And here's a comment with an unusual parenthesis: ) | ||
| ^^ RUF003 | ||
45 | # And here's a comment with a greek alpha: ∗ | ||
46 | foo # And here's a comment with an unusual punctuation mark: ᜵ | ||
| | ||
|
||
confusables.py:46:62: RUF003 Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? | ||
| | ||
44 | x = f"string { # And here's a comment with an unusual parenthesis: ) | ||
45 | # And here's a comment with a greek alpha: ∗ | ||
46 | foo # And here's a comment with an unusual punctuation mark: ᜵ | ||
| ^ RUF003 | ||
47 | }" | ||
| | ||
|
||
confusables.py:55:28: RUF001 String contains ambiguous `µ` (MICRO SIGN). Did you mean `μ` (GREEK SMALL LETTER MU)? | ||
| | ||
55 | assert getattr(Labware(), "µL") == 1.5 | ||
| ^ RUF001 | ||
| | ||
|
||
|