-
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.
This PR updates `PLE2510`, `PLE2512-2515` to check in f-strings. > ### Reference: > * `PLE2510`: Invalid unescaped character backspace, use "\b" instead > * `PLE2512`: Invalid unescaped character SUB, use "\x1A" instead > * `PLE2513`: Invalid unescaped character ESC, use "\x1B" instead > * `PLE2514`: Invalid unescaped character NUL, use "\0" instead > * `PLE2515`: Invalid unescaped character zero-width-space, use "\u200B" instead Add test cases for f-strings.
- Loading branch information
1 parent
3690af2
commit a8662a0
Showing
8 changed files
with
282 additions
and
80 deletions.
There are no files selected for viewing
Binary file modified
BIN
+355 Bytes
(130%)
crates/ruff_linter/resources/test/fixtures/pylint/invalid_characters.py
Binary file not shown.
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
63 changes: 49 additions & 14 deletions
63
...es/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.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 |
---|---|---|
@@ -1,25 +1,60 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pylint/mod.rs | ||
--- | ||
invalid_characters.py:21:12: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | ||
invalid_characters.py:24:12: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | ||
| | ||
19 | cr_ok = '\\r' | ||
20 | | ||
21 | sub = 'sub ' | ||
22 | cr_ok = f'\\r' | ||
23 | | ||
24 | sub = 'sub ' | ||
| PLE2512 | ||
22 | | ||
23 | sub_ok = '\x1a' | ||
25 | sub = f'sub ' | ||
| | ||
= help: Replace with escape sequence | ||
|
||
ℹ Fix | ||
18 18 | | ||
19 19 | cr_ok = '\\r' | ||
20 20 | | ||
21 |-sub = 'sub ' | ||
21 |+sub = 'sub \x1A' | ||
22 22 | | ||
23 23 | sub_ok = '\x1a' | ||
24 24 | | ||
21 21 | cr_ok = '\\r' | ||
22 22 | cr_ok = f'\\r' | ||
23 23 | | ||
24 |-sub = 'sub ' | ||
24 |+sub = 'sub \x1A' | ||
25 25 | sub = f'sub ' | ||
26 26 | | ||
27 27 | sub_ok = '\x1a' | ||
|
||
invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | ||
| | ||
24 | sub = 'sub ' | ||
25 | sub = f'sub ' | ||
| PLE2512 | ||
26 | | ||
27 | sub_ok = '\x1a' | ||
| | ||
= help: Replace with escape sequence | ||
|
||
ℹ Fix | ||
22 22 | cr_ok = f'\\r' | ||
23 23 | | ||
24 24 | sub = 'sub ' | ||
25 |-sub = f'sub ' | ||
25 |+sub = f'sub \x1A' | ||
26 26 | | ||
27 27 | sub_ok = '\x1a' | ||
28 28 | sub_ok = f'\x1a' | ||
|
||
invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | ||
| | ||
53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ " | ||
54 | | ||
55 | nested_fstrings = f'{f'{f''}'}' | ||
| PLE2512 | ||
| | ||
= help: Replace with escape sequence | ||
|
||
ℹ Fix | ||
52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ " | ||
53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ " | ||
54 54 | | ||
55 |-nested_fstrings = f'{f'{f''}'}' | ||
55 |+nested_fstrings = f'{f'\x1A{f''}'}' | ||
|
||
|
63 changes: 49 additions & 14 deletions
63
...es/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.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 |
---|---|---|
@@ -1,25 +1,60 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pylint/mod.rs | ||
--- | ||
invalid_characters.py:25:16: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | ||
invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | ||
| | ||
23 | sub_ok = '\x1a' | ||
24 | | ||
25 | esc = 'esc esc ' | ||
28 | sub_ok = f'\x1a' | ||
29 | | ||
30 | esc = 'esc esc ' | ||
| PLE2513 | ||
26 | | ||
27 | esc_ok = '\x1b' | ||
31 | esc = f'esc esc ' | ||
| | ||
= help: Replace with escape sequence | ||
|
||
ℹ Fix | ||
22 22 | | ||
23 23 | sub_ok = '\x1a' | ||
24 24 | | ||
25 |-esc = 'esc esc ' | ||
25 |+esc = 'esc esc \x1B' | ||
26 26 | | ||
27 27 | esc_ok = '\x1b' | ||
28 28 | | ||
27 27 | sub_ok = '\x1a' | ||
28 28 | sub_ok = f'\x1a' | ||
29 29 | | ||
30 |-esc = 'esc esc ' | ||
30 |+esc = 'esc esc \x1B' | ||
31 31 | esc = f'esc esc ' | ||
32 32 | | ||
33 33 | esc_ok = '\x1b' | ||
|
||
invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | ||
| | ||
30 | esc = 'esc esc ' | ||
31 | esc = f'esc esc ' | ||
| PLE2513 | ||
32 | | ||
33 | esc_ok = '\x1b' | ||
| | ||
= help: Replace with escape sequence | ||
|
||
ℹ Fix | ||
28 28 | sub_ok = f'\x1a' | ||
29 29 | | ||
30 30 | esc = 'esc esc ' | ||
31 |-esc = f'esc esc ' | ||
31 |+esc = f'esc esc \x1B' | ||
32 32 | | ||
33 33 | esc_ok = '\x1b' | ||
34 34 | esc_ok = f'\x1b' | ||
|
||
invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | ||
| | ||
53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ " | ||
54 | | ||
55 | nested_fstrings = f'{f'{f''}'}' | ||
| PLE2513 | ||
| | ||
= help: Replace with escape sequence | ||
|
||
ℹ Fix | ||
52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ " | ||
53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ " | ||
54 54 | | ||
55 |-nested_fstrings = f'{f'{f''}'}' | ||
55 |+nested_fstrings = f'{f'{f'\x1B'}'}' | ||
|
||
|
Binary file modified
BIN
+391 Bytes
(200%)
...es/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap
Binary file not shown.
Oops, something went wrong.