-
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.
Fix continuation detection following multi-line strings (#9332)
## Summary The logic that detects continuations assumed that tokens themselves cannot span multiple lines. However, strings _can_ -- even single-quoted strings. Closes #9323.
- Loading branch information
1 parent
003851c
commit b3789cd
Showing
4 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
crates/ruff_linter/resources/test/fixtures/pycodestyle/W293.py
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,16 @@ | ||
# See: https://github.com/astral-sh/ruff/issues/9323 | ||
class Chassis(RobotModuleTemplate): | ||
"""底盘信息推送控制 | ||
"""\ | ||
|
||
|
||
"""""" \ | ||
\ | ||
|
||
|
||
|
||
"abc\ | ||
" \ | ||
\ | ||
|
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: 63 additions & 0 deletions
63
...src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs | ||
--- | ||
W293.py:4:1: W293 [*] Blank line contains whitespace | ||
| | ||
2 | class Chassis(RobotModuleTemplate): | ||
3 | """底盘信息推送控制 | ||
4 | | ||
| ^^^^ W293 | ||
5 | """\ | ||
| | ||
= help: Remove whitespace from blank line | ||
|
||
ℹ Safe fix | ||
1 1 | # See: https://github.com/astral-sh/ruff/issues/9323 | ||
2 2 | class Chassis(RobotModuleTemplate): | ||
3 3 | """底盘信息推送控制 | ||
4 |- | ||
4 |+ | ||
5 5 | """\ | ||
6 6 | | ||
7 7 | | ||
|
||
W293.py:10:1: W293 [*] Blank line contains whitespace | ||
| | ||
8 | """""" \ | ||
9 | \ | ||
10 | | ||
| ^^^^ W293 | ||
| | ||
= help: Remove whitespace from blank line | ||
|
||
ℹ Safe fix | ||
5 5 | """\ | ||
6 6 | | ||
7 7 | | ||
8 |-"""""" \ | ||
9 |- \ | ||
10 |- | ||
8 |+"""""" | ||
11 9 | | ||
12 10 | | ||
13 11 | "abc\ | ||
|
||
W293.py:16:1: W293 [*] Blank line contains whitespace | ||
| | ||
14 | " \ | ||
15 | \ | ||
16 | | ||
| ^^^^ W293 | ||
| | ||
= help: Remove whitespace from blank line | ||
|
||
ℹ Safe fix | ||
11 11 | | ||
12 12 | | ||
13 13 | "abc\ | ||
14 |- " \ | ||
15 |- \ | ||
16 |- | ||
14 |+ " | ||
|
||
|
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