-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workingincompatibilityIncompatibility between different Ruff tools or rules (formatter, isort, linter)Incompatibility between different Ruff tools or rules (formatter, isort, linter)previewRelated to preview mode featuresRelated to preview mode features
Description
ruff format allows overloaded method stubs to occur before the runtime definition with no blank line in between, which is good. But this style fails the E301 check (in preview mode only). Should these be harmonized?
minimal code snippet that reproduces the bug
import typing as t
class Foo:
"""Demo."""
@t.overload
def bar(self, x: int) -> int: ...
@t.overload
def bar(self, x: str) -> str: ...
def bar(self, x: int | str) -> int | str:
return xcommands invoked
❯ ruff format --preview foo.py # (this example works the same without --preview here too)
1 file left unchanged
❯ ruff check --preview --extend-select E foo.py # (--preview required here to reproduce)
foo.py:11:5: E301 [*] Expected 1 blank line, found 0
|
9 | @t.overload
10 | def bar(self, x: str) -> str: ...
11 | def bar(self, x: int | str) -> int | str:
| ^^^ E301
12 | return x
|
= help: Add missing blank line
Found 1 error.
[*] 1 fixable with the `--fix` option.
ruff version
❯ ruff --version
ruff 0.3.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingincompatibilityIncompatibility between different Ruff tools or rules (formatter, isort, linter)Incompatibility between different Ruff tools or rules (formatter, isort, linter)previewRelated to preview mode featuresRelated to preview mode features