mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
[pycodestyle
] Do not trigger E3
rules on defs following a function/method with a dummy body (#10704)
This commit is contained in:
parent
cbd500141f
commit
670d66f54c
8 changed files with 806 additions and 670 deletions
|
@ -445,6 +445,39 @@ def test():
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
# no error
|
||||||
|
class Foo:
|
||||||
|
"""Demo."""
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def bar(self, x: int) -> int: ...
|
||||||
|
@overload
|
||||||
|
def bar(self, x: str) -> str: ...
|
||||||
|
def bar(self, x: int | str) -> int | str:
|
||||||
|
return x
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
# no error
|
||||||
|
@overload
|
||||||
|
def foo(x: int) -> int: ...
|
||||||
|
@overload
|
||||||
|
def foo(x: str) -> str: ...
|
||||||
|
def foo(x: int | str) -> int | str:
|
||||||
|
if not isinstance(x, (int, str)):
|
||||||
|
raise TypeError
|
||||||
|
return x
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
# no error
|
||||||
|
def foo(self, x: int) -> int: ...
|
||||||
|
def bar(self, x: str) -> str: ...
|
||||||
|
def baz(self, x: int | str) -> int | str:
|
||||||
|
return x
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
# E301
|
# E301
|
||||||
class Class(object):
|
class Class(object):
|
||||||
|
|
||||||
|
@ -489,6 +522,20 @@ class Class:
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
# E301
|
||||||
|
class Foo:
|
||||||
|
"""Demo."""
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def bar(self, x: int) -> int: ...
|
||||||
|
@overload
|
||||||
|
def bar(self, x: str) -> str:
|
||||||
|
...
|
||||||
|
def bar(self, x: int | str) -> int | str:
|
||||||
|
return x
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
# E302
|
# E302
|
||||||
"""Main module."""
|
"""Main module."""
|
||||||
def fn():
|
def fn():
|
||||||
|
@ -580,6 +627,23 @@ class Test:
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
# E302
|
||||||
|
class A:...
|
||||||
|
class B: ...
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
# E302
|
||||||
|
@overload
|
||||||
|
def fn(a: int) -> int: ...
|
||||||
|
@overload
|
||||||
|
def fn(a: str) -> str: ...
|
||||||
|
|
||||||
|
def fn(a: int | str) -> int | str:
|
||||||
|
...
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
# E303
|
# E303
|
||||||
def fn():
|
def fn():
|
||||||
_ = None
|
_ = None
|
||||||
|
|
|
@ -635,11 +635,26 @@ enum Follows {
|
||||||
Other,
|
Other,
|
||||||
Decorator,
|
Decorator,
|
||||||
Def,
|
Def,
|
||||||
|
/// A function whose body is a dummy (...), if the ellipsis is on the same line as the def.
|
||||||
|
DummyDef,
|
||||||
Import,
|
Import,
|
||||||
FromImport,
|
FromImport,
|
||||||
Docstring,
|
Docstring,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Follows {
|
||||||
|
// Allow a function/method to follow a function/method with a dummy body.
|
||||||
|
const fn follows_def_with_dummy_body(self) -> bool {
|
||||||
|
matches!(self, Follows::DummyDef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Follows {
|
||||||
|
const fn is_any_def(self) -> bool {
|
||||||
|
matches!(self, Follows::Def | Follows::DummyDef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Follows {
|
impl Follows {
|
||||||
const fn is_any_import(self) -> bool {
|
const fn is_any_import(self) -> bool {
|
||||||
matches!(self, Follows::Import | Follows::FromImport)
|
matches!(self, Follows::Import | Follows::FromImport)
|
||||||
|
@ -755,7 +770,11 @@ impl<'a> BlankLinesChecker<'a> {
|
||||||
if matches!(state.fn_status, Status::Outside) {
|
if matches!(state.fn_status, Status::Outside) {
|
||||||
state.fn_status = Status::Inside(logical_line.indent_length);
|
state.fn_status = Status::Inside(logical_line.indent_length);
|
||||||
}
|
}
|
||||||
state.follows = Follows::Def;
|
state.follows = if logical_line.last_token == TokenKind::Ellipsis {
|
||||||
|
Follows::DummyDef
|
||||||
|
} else {
|
||||||
|
Follows::Def
|
||||||
|
};
|
||||||
}
|
}
|
||||||
LogicalLineKind::Comment => {}
|
LogicalLineKind::Comment => {}
|
||||||
LogicalLineKind::Import => {
|
LogicalLineKind::Import => {
|
||||||
|
@ -801,7 +820,8 @@ impl<'a> BlankLinesChecker<'a> {
|
||||||
// Only applies to methods.
|
// Only applies to methods.
|
||||||
&& matches!(line.kind, LogicalLineKind::Function | LogicalLineKind::Decorator)
|
&& matches!(line.kind, LogicalLineKind::Function | LogicalLineKind::Decorator)
|
||||||
// Allow groups of one-liners.
|
// Allow groups of one-liners.
|
||||||
&& !(matches!(state.follows, Follows::Def) && !matches!(line.last_token, TokenKind::Colon))
|
&& !(state.follows.is_any_def() && line.last_token != TokenKind::Colon)
|
||||||
|
&& !state.follows.follows_def_with_dummy_body()
|
||||||
&& matches!(state.class_status, Status::Inside(_))
|
&& matches!(state.class_status, Status::Inside(_))
|
||||||
// The class/parent method's docstring can directly precede the def.
|
// The class/parent method's docstring can directly precede the def.
|
||||||
// Allow following a decorator (if there is an error it will be triggered on the first decorator).
|
// Allow following a decorator (if there is an error it will be triggered on the first decorator).
|
||||||
|
@ -852,7 +872,8 @@ impl<'a> BlankLinesChecker<'a> {
|
||||||
// Allow following a decorator (if there is an error it will be triggered on the first decorator).
|
// Allow following a decorator (if there is an error it will be triggered on the first decorator).
|
||||||
&& !matches!(state.follows, Follows::Decorator)
|
&& !matches!(state.follows, Follows::Decorator)
|
||||||
// Allow groups of one-liners.
|
// Allow groups of one-liners.
|
||||||
&& !(matches!(state.follows, Follows::Def) && !matches!(line.last_token, TokenKind::Colon))
|
&& !(state.follows.is_any_def() && line.last_token != TokenKind::Colon)
|
||||||
|
&& !(state.follows.follows_def_with_dummy_body() && line.preceding_blank_lines == 0)
|
||||||
// Only trigger on non-indented classes and functions (for example functions within an if are ignored)
|
// Only trigger on non-indented classes and functions (for example functions within an if are ignored)
|
||||||
&& line.indent_length == 0
|
&& line.indent_length == 0
|
||||||
// Only apply to functions or classes.
|
// Only apply to functions or classes.
|
||||||
|
@ -1018,7 +1039,8 @@ impl<'a> BlankLinesChecker<'a> {
|
||||||
// Do not trigger when the def/class follows an "indenting token" (if/while/etc...).
|
// Do not trigger when the def/class follows an "indenting token" (if/while/etc...).
|
||||||
&& prev_indent_length.is_some_and(|prev_indent_length| prev_indent_length >= line.indent_length)
|
&& prev_indent_length.is_some_and(|prev_indent_length| prev_indent_length >= line.indent_length)
|
||||||
// Allow groups of one-liners.
|
// Allow groups of one-liners.
|
||||||
&& !(matches!(state.follows, Follows::Def) && line.last_token != TokenKind::Colon)
|
&& !(state.follows.is_any_def() && line.last_token != TokenKind::Colon)
|
||||||
|
&& !state.follows.follows_def_with_dummy_body()
|
||||||
// Blank lines in stub files are only used for grouping. Don't enforce blank lines.
|
// Blank lines in stub files are only used for grouping. Don't enforce blank lines.
|
||||||
&& !self.source_type.is_stub()
|
&& !self.source_type.is_stub()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,83 +1,101 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||||
---
|
---
|
||||||
E30.py:453:5: E301 [*] Expected 1 blank line, found 0
|
|
||||||
|
|
|
||||||
451 | def func1():
|
|
||||||
452 | pass
|
|
||||||
453 | def func2():
|
|
||||||
| ^^^ E301
|
|
||||||
454 | pass
|
|
||||||
455 | # end
|
|
||||||
|
|
|
||||||
= help: Add missing blank line
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
450 450 |
|
|
||||||
451 451 | def func1():
|
|
||||||
452 452 | pass
|
|
||||||
453 |+
|
|
||||||
453 454 | def func2():
|
|
||||||
454 455 | pass
|
|
||||||
455 456 | # end
|
|
||||||
|
|
||||||
E30.py:464:5: E301 [*] Expected 1 blank line, found 0
|
|
||||||
|
|
|
||||||
462 | pass
|
|
||||||
463 | # comment
|
|
||||||
464 | def fn2():
|
|
||||||
| ^^^ E301
|
|
||||||
465 | pass
|
|
||||||
466 | # end
|
|
||||||
|
|
|
||||||
= help: Add missing blank line
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
460 460 |
|
|
||||||
461 461 | def fn1():
|
|
||||||
462 462 | pass
|
|
||||||
463 |+
|
|
||||||
463 464 | # comment
|
|
||||||
464 465 | def fn2():
|
|
||||||
465 466 | pass
|
|
||||||
|
|
||||||
E30.py:474:5: E301 [*] Expected 1 blank line, found 0
|
|
||||||
|
|
|
||||||
473 | columns = []
|
|
||||||
474 | @classmethod
|
|
||||||
| ^ E301
|
|
||||||
475 | def cls_method(cls) -> None:
|
|
||||||
476 | pass
|
|
||||||
|
|
|
||||||
= help: Add missing blank line
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
471 471 | """Class for minimal repo."""
|
|
||||||
472 472 |
|
|
||||||
473 473 | columns = []
|
|
||||||
474 |+
|
|
||||||
474 475 | @classmethod
|
|
||||||
475 476 | def cls_method(cls) -> None:
|
|
||||||
476 477 | pass
|
|
||||||
|
|
||||||
E30.py:486:5: E301 [*] Expected 1 blank line, found 0
|
E30.py:486:5: E301 [*] Expected 1 blank line, found 0
|
||||||
|
|
|
|
||||||
484 | def method(cls) -> None:
|
484 | def func1():
|
||||||
485 | pass
|
485 | pass
|
||||||
486 | @classmethod
|
486 | def func2():
|
||||||
| ^ E301
|
| ^^^ E301
|
||||||
487 | def cls_method(cls) -> None:
|
487 | pass
|
||||||
488 | pass
|
488 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
483 483 |
|
483 483 |
|
||||||
484 484 | def method(cls) -> None:
|
484 484 | def func1():
|
||||||
485 485 | pass
|
485 485 | pass
|
||||||
486 |+
|
486 |+
|
||||||
486 487 | @classmethod
|
486 487 | def func2():
|
||||||
487 488 | def cls_method(cls) -> None:
|
487 488 | pass
|
||||||
488 489 | pass
|
488 489 | # end
|
||||||
|
|
||||||
|
E30.py:497:5: E301 [*] Expected 1 blank line, found 0
|
||||||
|
|
|
||||||
|
495 | pass
|
||||||
|
496 | # comment
|
||||||
|
497 | def fn2():
|
||||||
|
| ^^^ E301
|
||||||
|
498 | pass
|
||||||
|
499 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
493 493 |
|
||||||
|
494 494 | def fn1():
|
||||||
|
495 495 | pass
|
||||||
|
496 |+
|
||||||
|
496 497 | # comment
|
||||||
|
497 498 | def fn2():
|
||||||
|
498 499 | pass
|
||||||
|
|
||||||
|
E30.py:507:5: E301 [*] Expected 1 blank line, found 0
|
||||||
|
|
|
||||||
|
506 | columns = []
|
||||||
|
507 | @classmethod
|
||||||
|
| ^ E301
|
||||||
|
508 | def cls_method(cls) -> None:
|
||||||
|
509 | pass
|
||||||
|
|
|
||||||
|
= help: Add missing blank line
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
504 504 | """Class for minimal repo."""
|
||||||
|
505 505 |
|
||||||
|
506 506 | columns = []
|
||||||
|
507 |+
|
||||||
|
507 508 | @classmethod
|
||||||
|
508 509 | def cls_method(cls) -> None:
|
||||||
|
509 510 | pass
|
||||||
|
|
||||||
|
E30.py:519:5: E301 [*] Expected 1 blank line, found 0
|
||||||
|
|
|
||||||
|
517 | def method(cls) -> None:
|
||||||
|
518 | pass
|
||||||
|
519 | @classmethod
|
||||||
|
| ^ E301
|
||||||
|
520 | def cls_method(cls) -> None:
|
||||||
|
521 | pass
|
||||||
|
|
|
||||||
|
= help: Add missing blank line
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
516 516 |
|
||||||
|
517 517 | def method(cls) -> None:
|
||||||
|
518 518 | pass
|
||||||
|
519 |+
|
||||||
|
519 520 | @classmethod
|
||||||
|
520 521 | def cls_method(cls) -> None:
|
||||||
|
521 522 | pass
|
||||||
|
|
||||||
|
E30.py:534:5: E301 [*] Expected 1 blank line, found 0
|
||||||
|
|
|
||||||
|
532 | def bar(self, x: str) -> str:
|
||||||
|
533 | ...
|
||||||
|
534 | def bar(self, x: int | str) -> int | str:
|
||||||
|
| ^^^ E301
|
||||||
|
535 | return x
|
||||||
|
536 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
531 531 | @overload
|
||||||
|
532 532 | def bar(self, x: str) -> str:
|
||||||
|
533 533 | ...
|
||||||
|
534 |+
|
||||||
|
534 535 | def bar(self, x: int | str) -> int | str:
|
||||||
|
535 536 | return x
|
||||||
|
536 537 | # end
|
||||||
|
|
|
@ -1,187 +1,225 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||||
---
|
---
|
||||||
E30.py:494:1: E302 [*] Expected 2 blank lines, found 0
|
E30.py:541:1: E302 [*] Expected 2 blank lines, found 0
|
||||||
|
|
|
|
||||||
492 | # E302
|
539 | # E302
|
||||||
493 | """Main module."""
|
540 | """Main module."""
|
||||||
494 | def fn():
|
541 | def fn():
|
||||||
| ^^^ E302
|
| ^^^ E302
|
||||||
495 | pass
|
542 | pass
|
||||||
496 | # end
|
543 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
491 491 |
|
|
||||||
492 492 | # E302
|
|
||||||
493 493 | """Main module."""
|
|
||||||
494 |+
|
|
||||||
495 |+
|
|
||||||
494 496 | def fn():
|
|
||||||
495 497 | pass
|
|
||||||
496 498 | # end
|
|
||||||
|
|
||||||
E30.py:501:1: E302 [*] Expected 2 blank lines, found 0
|
|
||||||
|
|
|
||||||
499 | # E302
|
|
||||||
500 | import sys
|
|
||||||
501 | def get_sys_path():
|
|
||||||
| ^^^ E302
|
|
||||||
502 | return sys.path
|
|
||||||
503 | # end
|
|
||||||
|
|
|
||||||
= help: Add missing blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
498 498 |
|
|
||||||
499 499 | # E302
|
|
||||||
500 500 | import sys
|
|
||||||
501 |+
|
|
||||||
502 |+
|
|
||||||
501 503 | def get_sys_path():
|
|
||||||
502 504 | return sys.path
|
|
||||||
503 505 | # end
|
|
||||||
|
|
||||||
E30.py:510:1: E302 [*] Expected 2 blank lines, found 1
|
|
||||||
|
|
|
||||||
508 | pass
|
|
||||||
509 |
|
|
||||||
510 | def b():
|
|
||||||
| ^^^ E302
|
|
||||||
511 | pass
|
|
||||||
512 | # end
|
|
||||||
|
|
|
||||||
= help: Add missing blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
507 507 | def a():
|
|
||||||
508 508 | pass
|
|
||||||
509 509 |
|
|
||||||
510 |+
|
|
||||||
510 511 | def b():
|
|
||||||
511 512 | pass
|
|
||||||
512 513 | # end
|
|
||||||
|
|
||||||
E30.py:521:1: E302 [*] Expected 2 blank lines, found 1
|
|
||||||
|
|
|
||||||
519 | # comment
|
|
||||||
520 |
|
|
||||||
521 | def b():
|
|
||||||
| ^^^ E302
|
|
||||||
522 | pass
|
|
||||||
523 | # end
|
|
||||||
|
|
|
||||||
= help: Add missing blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
518 518 |
|
|
||||||
519 519 | # comment
|
|
||||||
520 520 |
|
|
||||||
521 |+
|
|
||||||
521 522 | def b():
|
|
||||||
522 523 | pass
|
|
||||||
523 524 | # end
|
|
||||||
|
|
||||||
E30.py:530:1: E302 [*] Expected 2 blank lines, found 1
|
|
||||||
|
|
|
||||||
528 | pass
|
|
||||||
529 |
|
|
||||||
530 | async def b():
|
|
||||||
| ^^^^^ E302
|
|
||||||
531 | pass
|
|
||||||
532 | # end
|
|
||||||
|
|
|
||||||
= help: Add missing blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
527 527 | def a():
|
|
||||||
528 528 | pass
|
|
||||||
529 529 |
|
|
||||||
530 |+
|
|
||||||
530 531 | async def b():
|
|
||||||
531 532 | pass
|
|
||||||
532 533 | # end
|
|
||||||
|
|
||||||
E30.py:539:1: E302 [*] Expected 2 blank lines, found 1
|
|
||||||
|
|
|
||||||
537 | pass
|
|
||||||
538 |
|
|
||||||
539 | async def x(y: int = 1):
|
|
||||||
| ^^^^^ E302
|
|
||||||
540 | pass
|
|
||||||
541 | # end
|
|
||||||
|
|
|
||||||
= help: Add missing blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
536 536 | async def x():
|
|
||||||
537 537 | pass
|
|
||||||
538 538 |
|
538 538 |
|
||||||
539 |+
|
539 539 | # E302
|
||||||
539 540 | async def x(y: int = 1):
|
540 540 | """Main module."""
|
||||||
540 541 | pass
|
541 |+
|
||||||
541 542 | # end
|
542 |+
|
||||||
|
541 543 | def fn():
|
||||||
|
542 544 | pass
|
||||||
|
543 545 | # end
|
||||||
|
|
||||||
E30.py:547:1: E302 [*] Expected 2 blank lines, found 0
|
E30.py:548:1: E302 [*] Expected 2 blank lines, found 0
|
||||||
|
|
|
|
||||||
545 | def bar():
|
546 | # E302
|
||||||
546 | pass
|
547 | import sys
|
||||||
547 | def baz(): pass
|
548 | def get_sys_path():
|
||||||
| ^^^ E302
|
| ^^^ E302
|
||||||
548 | # end
|
549 | return sys.path
|
||||||
|
550 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
544 544 | # E302
|
545 545 |
|
||||||
545 545 | def bar():
|
546 546 | # E302
|
||||||
546 546 | pass
|
547 547 | import sys
|
||||||
547 |+
|
|
||||||
548 |+
|
548 |+
|
||||||
547 549 | def baz(): pass
|
549 |+
|
||||||
548 550 | # end
|
548 550 | def get_sys_path():
|
||||||
549 551 |
|
549 551 | return sys.path
|
||||||
|
550 552 | # end
|
||||||
|
|
||||||
E30.py:553:1: E302 [*] Expected 2 blank lines, found 0
|
E30.py:557:1: E302 [*] Expected 2 blank lines, found 1
|
||||||
|
|
|
|
||||||
551 | # E302
|
555 | pass
|
||||||
552 | def bar(): pass
|
556 |
|
||||||
553 | def baz():
|
557 | def b():
|
||||||
| ^^^ E302
|
| ^^^ E302
|
||||||
554 | pass
|
558 | pass
|
||||||
555 | # end
|
559 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
550 550 |
|
554 554 | def a():
|
||||||
551 551 | # E302
|
555 555 | pass
|
||||||
552 552 | def bar(): pass
|
556 556 |
|
||||||
553 |+
|
557 |+
|
||||||
554 |+
|
557 558 | def b():
|
||||||
553 555 | def baz():
|
558 559 | pass
|
||||||
554 556 | pass
|
559 560 | # end
|
||||||
555 557 | # end
|
|
||||||
|
|
||||||
E30.py:563:1: E302 [*] Expected 2 blank lines, found 1
|
E30.py:568:1: E302 [*] Expected 2 blank lines, found 1
|
||||||
|
|
|
|
||||||
562 | # comment
|
566 | # comment
|
||||||
563 | @decorator
|
567 |
|
||||||
|
568 | def b():
|
||||||
|
| ^^^ E302
|
||||||
|
569 | pass
|
||||||
|
570 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
565 565 |
|
||||||
|
566 566 | # comment
|
||||||
|
567 567 |
|
||||||
|
568 |+
|
||||||
|
568 569 | def b():
|
||||||
|
569 570 | pass
|
||||||
|
570 571 | # end
|
||||||
|
|
||||||
|
E30.py:577:1: E302 [*] Expected 2 blank lines, found 1
|
||||||
|
|
|
||||||
|
575 | pass
|
||||||
|
576 |
|
||||||
|
577 | async def b():
|
||||||
|
| ^^^^^ E302
|
||||||
|
578 | pass
|
||||||
|
579 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
574 574 | def a():
|
||||||
|
575 575 | pass
|
||||||
|
576 576 |
|
||||||
|
577 |+
|
||||||
|
577 578 | async def b():
|
||||||
|
578 579 | pass
|
||||||
|
579 580 | # end
|
||||||
|
|
||||||
|
E30.py:586:1: E302 [*] Expected 2 blank lines, found 1
|
||||||
|
|
|
||||||
|
584 | pass
|
||||||
|
585 |
|
||||||
|
586 | async def x(y: int = 1):
|
||||||
|
| ^^^^^ E302
|
||||||
|
587 | pass
|
||||||
|
588 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
583 583 | async def x():
|
||||||
|
584 584 | pass
|
||||||
|
585 585 |
|
||||||
|
586 |+
|
||||||
|
586 587 | async def x(y: int = 1):
|
||||||
|
587 588 | pass
|
||||||
|
588 589 | # end
|
||||||
|
|
||||||
|
E30.py:594:1: E302 [*] Expected 2 blank lines, found 0
|
||||||
|
|
|
||||||
|
592 | def bar():
|
||||||
|
593 | pass
|
||||||
|
594 | def baz(): pass
|
||||||
|
| ^^^ E302
|
||||||
|
595 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
591 591 | # E302
|
||||||
|
592 592 | def bar():
|
||||||
|
593 593 | pass
|
||||||
|
594 |+
|
||||||
|
595 |+
|
||||||
|
594 596 | def baz(): pass
|
||||||
|
595 597 | # end
|
||||||
|
596 598 |
|
||||||
|
|
||||||
|
E30.py:600:1: E302 [*] Expected 2 blank lines, found 0
|
||||||
|
|
|
||||||
|
598 | # E302
|
||||||
|
599 | def bar(): pass
|
||||||
|
600 | def baz():
|
||||||
|
| ^^^ E302
|
||||||
|
601 | pass
|
||||||
|
602 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
597 597 |
|
||||||
|
598 598 | # E302
|
||||||
|
599 599 | def bar(): pass
|
||||||
|
600 |+
|
||||||
|
601 |+
|
||||||
|
600 602 | def baz():
|
||||||
|
601 603 | pass
|
||||||
|
602 604 | # end
|
||||||
|
|
||||||
|
E30.py:610:1: E302 [*] Expected 2 blank lines, found 1
|
||||||
|
|
|
||||||
|
609 | # comment
|
||||||
|
610 | @decorator
|
||||||
| ^ E302
|
| ^ E302
|
||||||
564 | def g():
|
611 | def g():
|
||||||
565 | pass
|
612 | pass
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
559 559 | def f():
|
606 606 | def f():
|
||||||
560 560 | pass
|
607 607 | pass
|
||||||
561 561 |
|
608 608 |
|
||||||
562 |+
|
609 |+
|
||||||
563 |+
|
610 |+
|
||||||
562 564 | # comment
|
609 611 | # comment
|
||||||
563 565 | @decorator
|
610 612 | @decorator
|
||||||
564 566 | def g():
|
611 613 | def g():
|
||||||
|
|
||||||
|
E30.py:632:1: E302 [*] Expected 2 blank lines, found 0
|
||||||
|
|
|
||||||
|
630 | # E302
|
||||||
|
631 | class A:...
|
||||||
|
632 | class B: ...
|
||||||
|
| ^^^^^ E302
|
||||||
|
633 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
629 629 |
|
||||||
|
630 630 | # E302
|
||||||
|
631 631 | class A:...
|
||||||
|
632 |+
|
||||||
|
633 |+
|
||||||
|
632 634 | class B: ...
|
||||||
|
633 635 | # end
|
||||||
|
634 636 |
|
||||||
|
|
||||||
|
E30.py:642:1: E302 [*] Expected 2 blank lines, found 1
|
||||||
|
|
|
||||||
|
640 | def fn(a: str) -> str: ...
|
||||||
|
641 |
|
||||||
|
642 | def fn(a: int | str) -> int | str:
|
||||||
|
| ^^^ E302
|
||||||
|
643 | ...
|
||||||
|
644 | # end
|
||||||
|
|
|
||||||
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
639 639 | @overload
|
||||||
|
640 640 | def fn(a: str) -> str: ...
|
||||||
|
641 641 |
|
||||||
|
642 |+
|
||||||
|
642 643 | def fn(a: int | str) -> int | str:
|
||||||
|
643 644 | ...
|
||||||
|
644 645 | # end
|
||||||
|
|
|
@ -1,248 +1,248 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||||
---
|
---
|
||||||
E30.py:578:2: E303 [*] Too many blank lines (2)
|
E30.py:625:2: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
|
||||||
578 | def method2():
|
625 | def method2():
|
||||||
| ^^^ E303
|
| ^^^ E303
|
||||||
579 | return 22
|
626 | return 22
|
||||||
580 | # end
|
627 | # end
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
574 574 | def method1():
|
621 621 | def method1():
|
||||||
575 575 | return 1
|
622 622 | return 1
|
||||||
576 576 |
|
623 623 |
|
||||||
577 |-
|
624 |-
|
||||||
578 577 | def method2():
|
625 624 | def method2():
|
||||||
579 578 | return 22
|
626 625 | return 22
|
||||||
580 579 | # end
|
627 626 | # end
|
||||||
|
|
||||||
E30.py:588:5: E303 [*] Too many blank lines (2)
|
E30.py:652:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
|
||||||
588 | # arbitrary comment
|
652 | # arbitrary comment
|
||||||
| ^^^^^^^^^^^^^^^^^^^ E303
|
| ^^^^^^^^^^^^^^^^^^^ E303
|
||||||
589 |
|
653 |
|
||||||
590 | def inner(): # E306 not expected (pycodestyle detects E306)
|
654 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
584 584 | def fn():
|
648 648 | def fn():
|
||||||
585 585 | _ = None
|
649 649 | _ = None
|
||||||
586 586 |
|
650 650 |
|
||||||
587 |-
|
651 |-
|
||||||
588 587 | # arbitrary comment
|
652 651 | # arbitrary comment
|
||||||
589 588 |
|
653 652 |
|
||||||
590 589 | def inner(): # E306 not expected (pycodestyle detects E306)
|
654 653 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||||
|
|
||||||
E30.py:600:5: E303 [*] Too many blank lines (2)
|
E30.py:664:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
|
||||||
600 | # arbitrary comment
|
664 | # arbitrary comment
|
||||||
| ^^^^^^^^^^^^^^^^^^^ E303
|
| ^^^^^^^^^^^^^^^^^^^ E303
|
||||||
601 | def inner(): # E306 not expected (pycodestyle detects E306)
|
665 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||||
602 | pass
|
666 | pass
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
596 596 | def fn():
|
660 660 | def fn():
|
||||||
597 597 | _ = None
|
661 661 | _ = None
|
||||||
598 598 |
|
662 662 |
|
||||||
599 |-
|
663 |-
|
||||||
600 599 | # arbitrary comment
|
664 663 | # arbitrary comment
|
||||||
601 600 | def inner(): # E306 not expected (pycodestyle detects E306)
|
665 664 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||||
602 601 | pass
|
666 665 | pass
|
||||||
|
|
||||||
E30.py:611:1: E303 [*] Too many blank lines (3)
|
E30.py:675:1: E303 [*] Too many blank lines (3)
|
||||||
|
|
|
|
||||||
611 | print()
|
675 | print()
|
||||||
| ^^^^^ E303
|
| ^^^^^ E303
|
||||||
612 | # end
|
676 | # end
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
607 607 | print()
|
671 671 | print()
|
||||||
608 608 |
|
672 672 |
|
||||||
609 609 |
|
|
||||||
610 |-
|
|
||||||
611 610 | print()
|
|
||||||
612 611 | # end
|
|
||||||
613 612 |
|
|
||||||
|
|
||||||
E30.py:620:1: E303 [*] Too many blank lines (3)
|
|
||||||
|
|
|
||||||
620 | # comment
|
|
||||||
| ^^^^^^^^^ E303
|
|
||||||
621 |
|
|
||||||
622 | print()
|
|
||||||
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
616 616 | print()
|
|
||||||
617 617 |
|
|
||||||
618 618 |
|
|
||||||
619 |-
|
|
||||||
620 619 | # comment
|
|
||||||
621 620 |
|
|
||||||
622 621 | print()
|
|
||||||
|
|
||||||
E30.py:631:5: E303 [*] Too many blank lines (2)
|
|
||||||
|
|
|
||||||
631 | # comment
|
|
||||||
| ^^^^^^^^^ E303
|
|
||||||
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
627 627 | def a():
|
|
||||||
628 628 | print()
|
|
||||||
629 629 |
|
|
||||||
630 |-
|
|
||||||
631 630 | # comment
|
|
||||||
632 631 |
|
|
||||||
633 632 |
|
|
||||||
|
|
||||||
E30.py:634:5: E303 [*] Too many blank lines (2)
|
|
||||||
|
|
|
||||||
634 | # another comment
|
|
||||||
| ^^^^^^^^^^^^^^^^^ E303
|
|
||||||
635 |
|
|
||||||
636 | print()
|
|
||||||
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
630 630 |
|
|
||||||
631 631 | # comment
|
|
||||||
632 632 |
|
|
||||||
633 |-
|
|
||||||
634 633 | # another comment
|
|
||||||
635 634 |
|
|
||||||
636 635 | print()
|
|
||||||
|
|
||||||
E30.py:645:1: E303 [*] Too many blank lines (3)
|
|
||||||
|
|
|
||||||
645 | / """This class docstring comes on line 5.
|
|
||||||
646 | | It gives error E303: too many blank lines (3)
|
|
||||||
647 | | """
|
|
||||||
| |___^ E303
|
|
||||||
648 | # end
|
|
||||||
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
641 641 | #!python
|
|
||||||
642 642 |
|
|
||||||
643 643 |
|
|
||||||
644 |-
|
|
||||||
645 644 | """This class docstring comes on line 5.
|
|
||||||
646 645 | It gives error E303: too many blank lines (3)
|
|
||||||
647 646 | """
|
|
||||||
|
|
||||||
E30.py:657:5: E303 [*] Too many blank lines (2)
|
|
||||||
|
|
|
||||||
657 | def b(self):
|
|
||||||
| ^^^ E303
|
|
||||||
658 | pass
|
|
||||||
659 | # end
|
|
||||||
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
653 653 | def a(self):
|
|
||||||
654 654 | pass
|
|
||||||
655 655 |
|
|
||||||
656 |-
|
|
||||||
657 656 | def b(self):
|
|
||||||
658 657 | pass
|
|
||||||
659 658 | # end
|
|
||||||
|
|
||||||
E30.py:667:5: E303 [*] Too many blank lines (2)
|
|
||||||
|
|
|
||||||
667 | a = 2
|
|
||||||
| ^ E303
|
|
||||||
668 | # end
|
|
||||||
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
663 663 | if True:
|
|
||||||
664 664 | a = 1
|
|
||||||
665 665 |
|
|
||||||
666 |-
|
|
||||||
667 666 | a = 2
|
|
||||||
668 667 | # end
|
|
||||||
669 668 |
|
|
||||||
|
|
||||||
E30.py:675:5: E303 [*] Too many blank lines (2)
|
|
||||||
|
|
|
||||||
675 | # comment
|
|
||||||
| ^^^^^^^^^ E303
|
|
||||||
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
|
||||||
|
|
||||||
ℹ Safe fix
|
|
||||||
671 671 | # E303
|
|
||||||
672 672 | class Test:
|
|
||||||
673 673 |
|
673 673 |
|
||||||
674 |-
|
674 |-
|
||||||
675 674 | # comment
|
675 674 | print()
|
||||||
676 675 |
|
676 675 | # end
|
||||||
677 676 |
|
677 676 |
|
||||||
|
|
||||||
E30.py:678:5: E303 [*] Too many blank lines (2)
|
E30.py:684:1: E303 [*] Too many blank lines (3)
|
||||||
|
|
|
|
||||||
678 | # another comment
|
684 | # comment
|
||||||
|
| ^^^^^^^^^ E303
|
||||||
|
685 |
|
||||||
|
686 | print()
|
||||||
|
|
|
||||||
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
680 680 | print()
|
||||||
|
681 681 |
|
||||||
|
682 682 |
|
||||||
|
683 |-
|
||||||
|
684 683 | # comment
|
||||||
|
685 684 |
|
||||||
|
686 685 | print()
|
||||||
|
|
||||||
|
E30.py:695:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
||||||
|
695 | # comment
|
||||||
|
| ^^^^^^^^^ E303
|
||||||
|
|
|
||||||
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
691 691 | def a():
|
||||||
|
692 692 | print()
|
||||||
|
693 693 |
|
||||||
|
694 |-
|
||||||
|
695 694 | # comment
|
||||||
|
696 695 |
|
||||||
|
697 696 |
|
||||||
|
|
||||||
|
E30.py:698:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
||||||
|
698 | # another comment
|
||||||
| ^^^^^^^^^^^^^^^^^ E303
|
| ^^^^^^^^^^^^^^^^^ E303
|
||||||
679 |
|
699 |
|
||||||
680 | def test(self): pass
|
700 | print()
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
674 674 |
|
694 694 |
|
||||||
675 675 | # comment
|
695 695 | # comment
|
||||||
676 676 |
|
696 696 |
|
||||||
677 |-
|
697 |-
|
||||||
678 677 | # another comment
|
698 697 | # another comment
|
||||||
679 678 |
|
699 698 |
|
||||||
680 679 | def test(self): pass
|
700 699 | print()
|
||||||
|
|
||||||
E30.py:692:5: E303 [*] Too many blank lines (2)
|
E30.py:709:1: E303 [*] Too many blank lines (3)
|
||||||
|
|
|
|
||||||
692 | def b(self):
|
709 | / """This class docstring comes on line 5.
|
||||||
|
710 | | It gives error E303: too many blank lines (3)
|
||||||
|
711 | | """
|
||||||
|
| |___^ E303
|
||||||
|
712 | # end
|
||||||
|
|
|
||||||
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
705 705 | #!python
|
||||||
|
706 706 |
|
||||||
|
707 707 |
|
||||||
|
708 |-
|
||||||
|
709 708 | """This class docstring comes on line 5.
|
||||||
|
710 709 | It gives error E303: too many blank lines (3)
|
||||||
|
711 710 | """
|
||||||
|
|
||||||
|
E30.py:721:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
||||||
|
721 | def b(self):
|
||||||
| ^^^ E303
|
| ^^^ E303
|
||||||
693 | pass
|
722 | pass
|
||||||
694 | # end
|
723 | # end
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
688 688 |
|
717 717 | def a(self):
|
||||||
689 689 | # wrongly indented comment
|
718 718 | pass
|
||||||
690 690 |
|
719 719 |
|
||||||
691 |-
|
720 |-
|
||||||
692 691 | def b(self):
|
721 720 | def b(self):
|
||||||
693 692 | pass
|
722 721 | pass
|
||||||
694 693 | # end
|
723 722 | # end
|
||||||
|
|
||||||
E30.py:702:5: E303 [*] Too many blank lines (2)
|
E30.py:731:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
|
||||||
702 | pass
|
731 | a = 2
|
||||||
|
| ^ E303
|
||||||
|
732 | # end
|
||||||
|
|
|
||||||
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
727 727 | if True:
|
||||||
|
728 728 | a = 1
|
||||||
|
729 729 |
|
||||||
|
730 |-
|
||||||
|
731 730 | a = 2
|
||||||
|
732 731 | # end
|
||||||
|
733 732 |
|
||||||
|
|
||||||
|
E30.py:739:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
||||||
|
739 | # comment
|
||||||
|
| ^^^^^^^^^ E303
|
||||||
|
|
|
||||||
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
735 735 | # E303
|
||||||
|
736 736 | class Test:
|
||||||
|
737 737 |
|
||||||
|
738 |-
|
||||||
|
739 738 | # comment
|
||||||
|
740 739 |
|
||||||
|
741 740 |
|
||||||
|
|
||||||
|
E30.py:742:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
||||||
|
742 | # another comment
|
||||||
|
| ^^^^^^^^^^^^^^^^^ E303
|
||||||
|
743 |
|
||||||
|
744 | def test(self): pass
|
||||||
|
|
|
||||||
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
738 738 |
|
||||||
|
739 739 | # comment
|
||||||
|
740 740 |
|
||||||
|
741 |-
|
||||||
|
742 741 | # another comment
|
||||||
|
743 742 |
|
||||||
|
744 743 | def test(self): pass
|
||||||
|
|
||||||
|
E30.py:756:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
||||||
|
756 | def b(self):
|
||||||
|
| ^^^ E303
|
||||||
|
757 | pass
|
||||||
|
758 | # end
|
||||||
|
|
|
||||||
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
752 752 |
|
||||||
|
753 753 | # wrongly indented comment
|
||||||
|
754 754 |
|
||||||
|
755 |-
|
||||||
|
756 755 | def b(self):
|
||||||
|
757 756 | pass
|
||||||
|
758 757 | # end
|
||||||
|
|
||||||
|
E30.py:766:5: E303 [*] Too many blank lines (2)
|
||||||
|
|
|
||||||
|
766 | pass
|
||||||
| ^^^^ E303
|
| ^^^^ E303
|
||||||
703 | # end
|
767 | # end
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
698 698 | def fn():
|
762 762 | def fn():
|
||||||
699 699 | pass
|
763 763 | pass
|
||||||
700 700 |
|
764 764 |
|
||||||
701 |-
|
765 |-
|
||||||
702 701 | pass
|
766 765 | pass
|
||||||
703 702 | # end
|
767 766 | # end
|
||||||
704 703 |
|
768 767 |
|
||||||
|
|
|
@ -1,65 +1,63 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||||
---
|
---
|
||||||
E30.py:709:1: E304 [*] Blank lines found after function decorator (1)
|
E30.py:773:1: E304 [*] Blank lines found after function decorator (1)
|
||||||
|
|
|
|
||||||
707 | @decorator
|
771 | @decorator
|
||||||
708 |
|
772 |
|
||||||
709 | def function():
|
773 | def function():
|
||||||
| ^^^ E304
|
| ^^^ E304
|
||||||
710 | pass
|
774 | pass
|
||||||
711 | # end
|
775 | # end
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
705 705 |
|
769 769 |
|
||||||
706 706 | # E304
|
770 770 | # E304
|
||||||
707 707 | @decorator
|
771 771 | @decorator
|
||||||
708 |-
|
772 |-
|
||||||
709 708 | def function():
|
773 772 | def function():
|
||||||
710 709 | pass
|
774 773 | pass
|
||||||
711 710 | # end
|
775 774 | # end
|
||||||
|
|
||||||
E30.py:718:1: E304 [*] Blank lines found after function decorator (1)
|
E30.py:782:1: E304 [*] Blank lines found after function decorator (1)
|
||||||
|
|
|
|
||||||
717 | # comment E304 not expected
|
781 | # comment E304 not expected
|
||||||
718 | def function():
|
782 | def function():
|
||||||
| ^^^ E304
|
| ^^^ E304
|
||||||
719 | pass
|
783 | pass
|
||||||
720 | # end
|
784 | # end
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
713 713 |
|
777 777 |
|
||||||
714 714 | # E304
|
778 778 | # E304
|
||||||
715 715 | @decorator
|
779 779 | @decorator
|
||||||
716 |-
|
780 |-
|
||||||
717 716 | # comment E304 not expected
|
781 780 | # comment E304 not expected
|
||||||
718 717 | def function():
|
782 781 | def function():
|
||||||
719 718 | pass
|
783 782 | pass
|
||||||
|
|
||||||
E30.py:730:1: E304 [*] Blank lines found after function decorator (2)
|
E30.py:794:1: E304 [*] Blank lines found after function decorator (2)
|
||||||
|
|
|
|
||||||
729 | # second comment E304 not expected
|
793 | # second comment E304 not expected
|
||||||
730 | def function():
|
794 | def function():
|
||||||
| ^^^ E304
|
| ^^^ E304
|
||||||
731 | pass
|
795 | pass
|
||||||
732 | # end
|
796 | # end
|
||||||
|
|
|
|
||||||
= help: Remove extraneous blank line(s)
|
= help: Remove extraneous blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
722 722 |
|
786 786 |
|
||||||
723 723 | # E304
|
787 787 | # E304
|
||||||
724 724 | @decorator
|
788 788 | @decorator
|
||||||
725 |-
|
789 |-
|
||||||
726 725 | # comment E304 not expected
|
790 789 | # comment E304 not expected
|
||||||
727 |-
|
791 |-
|
||||||
728 |-
|
792 |-
|
||||||
729 726 | # second comment E304 not expected
|
793 790 | # second comment E304 not expected
|
||||||
730 727 | def function():
|
794 791 | def function():
|
||||||
731 728 | pass
|
795 792 | pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,102 +1,100 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||||
---
|
---
|
||||||
E30.py:742:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
E30.py:806:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
||||||
|
|
|
|
||||||
741 | # another comment
|
805 | # another comment
|
||||||
742 | fn()
|
806 | fn()
|
||||||
| ^^ E305
|
| ^^ E305
|
||||||
743 | # end
|
807 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
739 739 | # comment
|
803 803 | # comment
|
||||||
740 740 |
|
804 804 |
|
||||||
741 741 | # another comment
|
805 805 | # another comment
|
||||||
742 |+
|
806 |+
|
||||||
743 |+
|
807 |+
|
||||||
742 744 | fn()
|
806 808 | fn()
|
||||||
743 745 | # end
|
807 809 | # end
|
||||||
744 746 |
|
808 810 |
|
||||||
|
|
||||||
E30.py:753:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
E30.py:817:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
||||||
|
|
|
|
||||||
752 | # another comment
|
816 | # another comment
|
||||||
753 | a = 1
|
817 | a = 1
|
||||||
| ^ E305
|
| ^ E305
|
||||||
754 | # end
|
818 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
750 750 | # comment
|
814 814 | # comment
|
||||||
751 751 |
|
815 815 |
|
||||||
752 752 | # another comment
|
816 816 | # another comment
|
||||||
753 |+
|
817 |+
|
||||||
754 |+
|
818 |+
|
||||||
753 755 | a = 1
|
817 819 | a = 1
|
||||||
754 756 | # end
|
818 820 | # end
|
||||||
755 757 |
|
819 821 |
|
||||||
|
|
||||||
E30.py:765:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
E30.py:829:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
||||||
|
|
|
|
||||||
763 | # another comment
|
827 | # another comment
|
||||||
764 |
|
828 |
|
||||||
765 | try:
|
829 | try:
|
||||||
| ^^^ E305
|
| ^^^ E305
|
||||||
766 | fn()
|
830 | fn()
|
||||||
767 | except Exception:
|
831 | except Exception:
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
762 762 |
|
826 826 |
|
||||||
763 763 | # another comment
|
827 827 | # another comment
|
||||||
764 764 |
|
828 828 |
|
||||||
765 |+
|
829 |+
|
||||||
765 766 | try:
|
829 830 | try:
|
||||||
766 767 | fn()
|
830 831 | fn()
|
||||||
767 768 | except Exception:
|
831 832 | except Exception:
|
||||||
|
|
||||||
E30.py:777:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
E30.py:841:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
||||||
|
|
|
|
||||||
776 | # Two spaces before comments, too.
|
840 | # Two spaces before comments, too.
|
||||||
777 | if a():
|
841 | if a():
|
||||||
| ^^ E305
|
| ^^ E305
|
||||||
778 | a()
|
842 | a()
|
||||||
779 | # end
|
843 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
774 774 | print()
|
838 838 | print()
|
||||||
775 775 |
|
839 839 |
|
||||||
776 776 | # Two spaces before comments, too.
|
840 840 | # Two spaces before comments, too.
|
||||||
777 |+
|
841 |+
|
||||||
778 |+
|
842 |+
|
||||||
777 779 | if a():
|
841 843 | if a():
|
||||||
778 780 | a()
|
842 844 | a()
|
||||||
779 781 | # end
|
843 845 | # end
|
||||||
|
|
||||||
E30.py:790:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
E30.py:854:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
|
||||||
|
|
|
|
||||||
788 | blah, blah
|
852 | blah, blah
|
||||||
789 |
|
853 |
|
||||||
790 | if __name__ == '__main__':
|
854 | if __name__ == '__main__':
|
||||||
| ^^ E305
|
| ^^ E305
|
||||||
791 | main()
|
855 | main()
|
||||||
792 | # end
|
856 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line(s)
|
= help: Add missing blank line(s)
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
787 787 | def main():
|
851 851 | def main():
|
||||||
788 788 | blah, blah
|
852 852 | blah, blah
|
||||||
789 789 |
|
853 853 |
|
||||||
790 |+
|
854 |+
|
||||||
790 791 | if __name__ == '__main__':
|
854 855 | if __name__ == '__main__':
|
||||||
791 792 | main()
|
855 856 | main()
|
||||||
792 793 | # end
|
856 857 | # end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,223 +1,221 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||||
---
|
---
|
||||||
E30.py:798:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
796 | def a():
|
860 | def a():
|
||||||
797 | x = 1
|
861 | x = 1
|
||||||
798 | def b():
|
862 | def b():
|
||||||
| ^^^ E306
|
| ^^^ E306
|
||||||
799 | pass
|
863 | pass
|
||||||
800 | # end
|
864 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
795 795 | # E306:3:5
|
859 859 | # E306:3:5
|
||||||
796 796 | def a():
|
860 860 | def a():
|
||||||
797 797 | x = 1
|
861 861 | x = 1
|
||||||
798 |+
|
862 |+
|
||||||
798 799 | def b():
|
862 863 | def b():
|
||||||
799 800 | pass
|
863 864 | pass
|
||||||
800 801 | # end
|
864 865 | # end
|
||||||
|
|
||||||
E30.py:806:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
804 | async def a():
|
868 | async def a():
|
||||||
805 | x = 1
|
869 | x = 1
|
||||||
806 | def b():
|
870 | def b():
|
||||||
| ^^^ E306
|
| ^^^ E306
|
||||||
807 | pass
|
871 | pass
|
||||||
808 | # end
|
872 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
803 803 | #: E306:3:5
|
867 867 | #: E306:3:5
|
||||||
804 804 | async def a():
|
868 868 | async def a():
|
||||||
805 805 | x = 1
|
869 869 | x = 1
|
||||||
806 |+
|
870 |+
|
||||||
806 807 | def b():
|
870 871 | def b():
|
||||||
807 808 | pass
|
871 872 | pass
|
||||||
808 809 | # end
|
872 873 | # end
|
||||||
|
|
||||||
E30.py:814:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:878:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
812 | def a():
|
876 | def a():
|
||||||
813 | x = 2
|
877 | x = 2
|
||||||
814 | def b():
|
878 | def b():
|
||||||
| ^^^ E306
|
| ^^^ E306
|
||||||
815 | x = 1
|
879 | x = 1
|
||||||
816 | def c():
|
880 | def c():
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
811 811 | #: E306:3:5 E306:5:9
|
875 875 | #: E306:3:5 E306:5:9
|
||||||
812 812 | def a():
|
876 876 | def a():
|
||||||
813 813 | x = 2
|
877 877 | x = 2
|
||||||
814 |+
|
878 |+
|
||||||
814 815 | def b():
|
878 879 | def b():
|
||||||
815 816 | x = 1
|
879 880 | x = 1
|
||||||
816 817 | def c():
|
880 881 | def c():
|
||||||
|
|
||||||
E30.py:816:9: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:880:9: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
814 | def b():
|
878 | def b():
|
||||||
815 | x = 1
|
879 | x = 1
|
||||||
816 | def c():
|
880 | def c():
|
||||||
| ^^^ E306
|
| ^^^ E306
|
||||||
817 | pass
|
881 | pass
|
||||||
818 | # end
|
882 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
813 813 | x = 2
|
877 877 | x = 2
|
||||||
814 814 | def b():
|
878 878 | def b():
|
||||||
815 815 | x = 1
|
879 879 | x = 1
|
||||||
816 |+
|
880 |+
|
||||||
816 817 | def c():
|
880 881 | def c():
|
||||||
817 818 | pass
|
881 882 | pass
|
||||||
818 819 | # end
|
882 883 | # end
|
||||||
|
|
||||||
E30.py:824:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:888:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
822 | def a():
|
886 | def a():
|
||||||
823 | x = 1
|
887 | x = 1
|
||||||
824 | class C:
|
888 | class C:
|
||||||
| ^^^^^ E306
|
| ^^^^^ E306
|
||||||
825 | pass
|
889 | pass
|
||||||
826 | x = 2
|
890 | x = 2
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
821 821 | # E306:3:5 E306:6:5
|
885 885 | # E306:3:5 E306:6:5
|
||||||
822 822 | def a():
|
886 886 | def a():
|
||||||
823 823 | x = 1
|
887 887 | x = 1
|
||||||
824 |+
|
888 |+
|
||||||
824 825 | class C:
|
888 889 | class C:
|
||||||
825 826 | pass
|
889 890 | pass
|
||||||
826 827 | x = 2
|
890 891 | x = 2
|
||||||
|
|
||||||
E30.py:827:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:891:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
825 | pass
|
889 | pass
|
||||||
826 | x = 2
|
890 | x = 2
|
||||||
827 | def b():
|
891 | def b():
|
||||||
| ^^^ E306
|
| ^^^ E306
|
||||||
828 | pass
|
892 | pass
|
||||||
829 | # end
|
893 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
824 824 | class C:
|
888 888 | class C:
|
||||||
825 825 | pass
|
889 889 | pass
|
||||||
826 826 | x = 2
|
890 890 | x = 2
|
||||||
827 |+
|
891 |+
|
||||||
827 828 | def b():
|
891 892 | def b():
|
||||||
828 829 | pass
|
892 893 | pass
|
||||||
829 830 | # end
|
893 894 | # end
|
||||||
|
|
||||||
E30.py:836:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:900:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
834 | def bar():
|
898 | def bar():
|
||||||
835 | pass
|
899 | pass
|
||||||
836 | def baz(): pass
|
900 | def baz(): pass
|
||||||
| ^^^ E306
|
| ^^^ E306
|
||||||
837 | # end
|
901 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
833 833 | def foo():
|
897 897 | def foo():
|
||||||
834 834 | def bar():
|
898 898 | def bar():
|
||||||
835 835 | pass
|
899 899 | pass
|
||||||
836 |+
|
900 |+
|
||||||
836 837 | def baz(): pass
|
900 901 | def baz(): pass
|
||||||
837 838 | # end
|
901 902 | # end
|
||||||
838 839 |
|
902 903 |
|
||||||
|
|
||||||
E30.py:843:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
841 | def foo():
|
905 | def foo():
|
||||||
842 | def bar(): pass
|
906 | def bar(): pass
|
||||||
843 | def baz():
|
907 | def baz():
|
||||||
| ^^^ E306
|
| ^^^ E306
|
||||||
844 | pass
|
908 | pass
|
||||||
845 | # end
|
909 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
840 840 | # E306:3:5
|
904 904 | # E306:3:5
|
||||||
841 841 | def foo():
|
905 905 | def foo():
|
||||||
842 842 | def bar(): pass
|
906 906 | def bar(): pass
|
||||||
843 |+
|
907 |+
|
||||||
843 844 | def baz():
|
907 908 | def baz():
|
||||||
844 845 | pass
|
908 909 | pass
|
||||||
845 846 | # end
|
909 910 | # end
|
||||||
|
|
||||||
E30.py:851:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:915:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
849 | def a():
|
913 | def a():
|
||||||
850 | x = 2
|
914 | x = 2
|
||||||
851 | @decorator
|
915 | @decorator
|
||||||
| ^ E306
|
| ^ E306
|
||||||
852 | def b():
|
916 | def b():
|
||||||
853 | pass
|
917 | pass
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
848 848 | # E306
|
912 912 | # E306
|
||||||
849 849 | def a():
|
913 913 | def a():
|
||||||
850 850 | x = 2
|
914 914 | x = 2
|
||||||
851 |+
|
915 |+
|
||||||
851 852 | @decorator
|
915 916 | @decorator
|
||||||
852 853 | def b():
|
916 917 | def b():
|
||||||
853 854 | pass
|
917 918 | pass
|
||||||
|
|
||||||
E30.py:860:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:924:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
858 | def a():
|
922 | def a():
|
||||||
859 | x = 2
|
923 | x = 2
|
||||||
860 | @decorator
|
924 | @decorator
|
||||||
| ^ E306
|
| ^ E306
|
||||||
861 | async def b():
|
925 | async def b():
|
||||||
862 | pass
|
926 | pass
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
857 857 | # E306
|
921 921 | # E306
|
||||||
858 858 | def a():
|
922 922 | def a():
|
||||||
859 859 | x = 2
|
923 923 | x = 2
|
||||||
860 |+
|
924 |+
|
||||||
860 861 | @decorator
|
924 925 | @decorator
|
||||||
861 862 | async def b():
|
925 926 | async def b():
|
||||||
862 863 | pass
|
926 927 | pass
|
||||||
|
|
||||||
E30.py:869:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
E30.py:933:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
||||||
|
|
|
|
||||||
867 | def a():
|
931 | def a():
|
||||||
868 | x = 2
|
932 | x = 2
|
||||||
869 | async def b():
|
933 | async def b():
|
||||||
| ^^^^^ E306
|
| ^^^^^ E306
|
||||||
870 | pass
|
934 | pass
|
||||||
871 | # end
|
935 | # end
|
||||||
|
|
|
|
||||||
= help: Add missing blank line
|
= help: Add missing blank line
|
||||||
|
|
||||||
ℹ Safe fix
|
ℹ Safe fix
|
||||||
866 866 | # E306
|
930 930 | # E306
|
||||||
867 867 | def a():
|
931 931 | def a():
|
||||||
868 868 | x = 2
|
932 932 | x = 2
|
||||||
869 |+
|
933 |+
|
||||||
869 870 | async def b():
|
933 934 | async def b():
|
||||||
870 871 | pass
|
934 935 | pass
|
||||||
871 872 | # end
|
935 936 | # end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue