-
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.
Limit
isort.lines-after-imports
to 1 for stub files (#9971)
- Loading branch information
1 parent
317d2e4
commit 1791e7d
Showing
8 changed files
with
228 additions
and
2 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
crates/ruff_linter/resources/test/fixtures/isort/lines_after_imports.pyi
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 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from requests import Session | ||
|
||
from my_first_party import my_first_party_object | ||
|
||
from . import my_local_folder_object | ||
|
||
|
||
|
||
class Thing(object): | ||
name: str | ||
def __init__(self, name: str): | ||
self.name = name |
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
41 changes: 41 additions & 0 deletions
41
.../src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.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,41 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/isort/mod.rs | ||
--- | ||
lines_after_imports.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted | ||
| | ||
1 | / from __future__ import annotations | ||
2 | | | ||
3 | | from typing import Any | ||
4 | | | ||
5 | | from requests import Session | ||
6 | | | ||
7 | | from my_first_party import my_first_party_object | ||
8 | | | ||
9 | | from . import my_local_folder_object | ||
10 | | | ||
11 | | | ||
12 | | | ||
13 | | class Thing(object): | ||
| |_^ I001 | ||
14 | name: str | ||
15 | def __init__(self, name: str): | ||
| | ||
= help: Organize imports | ||
|
||
ℹ Safe fix | ||
2 2 | | ||
3 3 | from typing import Any | ||
4 4 | | ||
5 |-from requests import Session | ||
6 |- | ||
7 5 | from my_first_party import my_first_party_object | ||
6 |+from requests import Session | ||
8 7 | | ||
9 8 | from . import my_local_folder_object | ||
10 |- | ||
11 |- | ||
12 9 | | ||
13 10 | class Thing(object): | ||
14 11 | name: str | ||
|
||
|
38 changes: 38 additions & 0 deletions
38
...isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.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,38 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/isort/mod.rs | ||
--- | ||
lines_after_imports_class_after.py:1:1: I001 [*] Import block is un-sorted or un-formatted | ||
| | ||
1 | / from __future__ import annotations | ||
2 | | | ||
3 | | from typing import Any | ||
4 | | | ||
5 | | from requests import Session | ||
6 | | | ||
7 | | from my_first_party import my_first_party_object | ||
8 | | | ||
9 | | from . import my_local_folder_object | ||
10 | | class Thing(object): | ||
| |_^ I001 | ||
11 | name: str | ||
12 | def __init__(self, name: str): | ||
| | ||
= help: Organize imports | ||
|
||
ℹ Safe fix | ||
2 2 | | ||
3 3 | from typing import Any | ||
4 4 | | ||
5 |-from requests import Session | ||
6 |- | ||
7 5 | from my_first_party import my_first_party_object | ||
6 |+from requests import Session | ||
8 7 | | ||
9 8 | from . import my_local_folder_object | ||
9 |+ | ||
10 |+ | ||
10 11 | class Thing(object): | ||
11 12 | name: str | ||
12 13 | def __init__(self, name: str): | ||
|
||
|
55 changes: 55 additions & 0 deletions
55
.../isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.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,55 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/isort/mod.rs | ||
--- | ||
lines_after_imports_func_after.py:1:1: I001 [*] Import block is un-sorted or un-formatted | ||
| | ||
1 | / from __future__ import annotations | ||
2 | | | ||
3 | | from typing import Any | ||
4 | | | ||
5 | | from requests import Session | ||
6 | | | ||
7 | | from my_first_party import my_first_party_object | ||
8 | | | ||
9 | | from . import my_local_folder_object | ||
10 | | | ||
11 | | | ||
12 | | | ||
13 | | | ||
14 | | | ||
15 | | | ||
16 | | | ||
17 | | | ||
18 | | | ||
19 | | | ||
20 | | | ||
21 | | def main(): | ||
| |_^ I001 | ||
22 | my_local_folder_object.get() | ||
| | ||
= help: Organize imports | ||
|
||
ℹ Safe fix | ||
2 2 | | ||
3 3 | from typing import Any | ||
4 4 | | ||
5 |-from requests import Session | ||
6 |- | ||
7 5 | from my_first_party import my_first_party_object | ||
6 |+from requests import Session | ||
8 7 | | ||
9 8 | from . import my_local_folder_object | ||
10 |- | ||
11 |- | ||
12 |- | ||
13 |- | ||
14 |- | ||
15 |- | ||
16 |- | ||
17 |- | ||
18 |- | ||
19 9 | | ||
20 10 | | ||
21 11 | def main(): | ||
|
||
|
41 changes: 41 additions & 0 deletions
41
...pshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.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,41 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/isort/mod.rs | ||
--- | ||
lines_after_imports.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted | ||
| | ||
1 | / from __future__ import annotations | ||
2 | | | ||
3 | | from typing import Any | ||
4 | | | ||
5 | | from requests import Session | ||
6 | | | ||
7 | | from my_first_party import my_first_party_object | ||
8 | | | ||
9 | | from . import my_local_folder_object | ||
10 | | | ||
11 | | | ||
12 | | | ||
13 | | class Thing(object): | ||
| |_^ I001 | ||
14 | name: str | ||
15 | def __init__(self, name: str): | ||
| | ||
= help: Organize imports | ||
|
||
ℹ Safe fix | ||
2 2 | | ||
3 3 | from typing import Any | ||
4 4 | | ||
5 |-from requests import Session | ||
6 |- | ||
7 5 | from my_first_party import my_first_party_object | ||
6 |+from requests import Session | ||
8 7 | | ||
9 8 | from . import my_local_folder_object | ||
10 |- | ||
11 |- | ||
12 9 | | ||
13 10 | class Thing(object): | ||
14 11 | name: str | ||
|
||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.