-
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.
Disable blank line rules after top level import statements
- Loading branch information
1 parent
af54970
commit 0d05d48
Showing
6 changed files
with
217 additions
and
55 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
crates/ruff_linter/resources/test/fixtures/pycodestyle/E30_isort.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,43 @@ | ||
import json | ||
|
||
|
||
|
||
from typing import Any, Sequence | ||
|
||
|
||
class MissingCommand(TypeError): ... # noqa: N818 | ||
|
||
|
||
class BackendProxy: | ||
backend_module: str | ||
backend_object: str | None | ||
backend: Any | ||
|
||
|
||
if __name__ == "__main__": | ||
import abcd | ||
|
||
|
||
|
||
abcd.foo() | ||
|
||
|
||
def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... | ||
|
||
|
||
def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: ... | ||
|
||
|
||
def _exit(self) -> None: ... | ||
|
||
|
||
def _optional_commands(self) -> dict[str, bool]: ... | ||
|
||
|
||
def run(argv: Sequence[str]) -> int: ... | ||
|
||
|
||
def read_line(fd: int = 0) -> bytearray: ... | ||
|
||
|
||
def flush() -> None: ... |
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
27 changes: 27 additions & 0 deletions
27
...pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_isort.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,27 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs | ||
--- | ||
E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | ||
| | ||
1 | / import json | ||
2 | | | ||
3 | | | ||
4 | | | ||
5 | | from typing import Any, Sequence | ||
6 | | | ||
7 | | | ||
8 | | class MissingCommand(TypeError): ... # noqa: N818 | ||
| |_^ I001 | ||
| | ||
= help: Organize imports | ||
|
||
ℹ Safe fix | ||
1 1 | import json | ||
2 2 | | ||
3 |- | ||
4 |- | ||
5 3 | from typing import Any, Sequence | ||
6 |- | ||
7 4 | | ||
8 5 | class MissingCommand(TypeError): ... # noqa: N818 | ||
9 6 | |
44 changes: 44 additions & 0 deletions
44
...pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_isort.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,44 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs | ||
--- | ||
E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | ||
| | ||
1 | / import json | ||
2 | | | ||
3 | | | ||
4 | | | ||
5 | | from typing import Any, Sequence | ||
6 | | | ||
7 | | | ||
8 | | class MissingCommand(TypeError): ... # noqa: N818 | ||
| |_^ I001 | ||
| | ||
= help: Organize imports | ||
|
||
ℹ Safe fix | ||
1 1 | import json | ||
2 2 | | ||
3 |- | ||
4 |- | ||
5 3 | from typing import Any, Sequence | ||
6 |- | ||
7 4 | | ||
8 5 | class MissingCommand(TypeError): ... # noqa: N818 | ||
9 6 | | ||
|
||
E30_isort.py:22:5: E303 [*] Too many blank lines (3) | ||
| | ||
22 | abcd.foo() | ||
| ^^^^ E303 | ||
| | ||
= help: Remove extraneous blank line(s) | ||
|
||
ℹ Safe fix | ||
17 17 | if __name__ == "__main__": | ||
18 18 | import abcd | ||
19 19 | | ||
20 |- | ||
21 |- | ||
22 20 | abcd.foo() | ||
23 21 | | ||
24 22 | |