-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid inserting imports directly after continuation (#7553)
## Summary This is extremely rare in practice, but common in the fuzzer issues so worth fixing quickly. Closes #7199.
- Loading branch information
1 parent
ee9ee00
commit a0917ec
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
crates/ruff_linter/resources/test/fixtures/pylint/sys_exit_alias_12.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,3 @@ | ||
import os \ | ||
|
||
exit(0) |
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
20 changes: 20 additions & 0 deletions
20
...les/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.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,20 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pylint/mod.rs | ||
--- | ||
sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | ||
| | ||
1 | import os \ | ||
2 | | ||
3 | exit(0) | ||
| ^^^^ PLR1722 | ||
| | ||
= help: Replace `exit` with `sys.exit()` | ||
|
||
ℹ Suggested fix | ||
1 |-import os \ | ||
1 |+import os; import sys \ | ||
2 2 | | ||
3 |-exit(0) | ||
3 |+sys.exit(0) | ||
|
||
|