mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +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
|
||||
|
||||
|
||||
# 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
|
||||
class Class(object):
|
||||
|
||||
|
@ -489,6 +522,20 @@ class Class:
|
|||
# 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
|
||||
"""Main module."""
|
||||
def fn():
|
||||
|
@ -580,6 +627,23 @@ class Test:
|
|||
# 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
|
||||
def fn():
|
||||
_ = None
|
||||
|
|
|
@ -635,11 +635,26 @@ enum Follows {
|
|||
Other,
|
||||
Decorator,
|
||||
Def,
|
||||
/// A function whose body is a dummy (...), if the ellipsis is on the same line as the def.
|
||||
DummyDef,
|
||||
Import,
|
||||
FromImport,
|
||||
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 {
|
||||
const fn is_any_import(self) -> bool {
|
||||
matches!(self, Follows::Import | Follows::FromImport)
|
||||
|
@ -755,7 +770,11 @@ impl<'a> BlankLinesChecker<'a> {
|
|||
if matches!(state.fn_status, Status::Outside) {
|
||||
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::Import => {
|
||||
|
@ -801,7 +820,8 @@ impl<'a> BlankLinesChecker<'a> {
|
|||
// Only applies to methods.
|
||||
&& matches!(line.kind, LogicalLineKind::Function | LogicalLineKind::Decorator)
|
||||
// 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(_))
|
||||
// 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).
|
||||
|
@ -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).
|
||||
&& !matches!(state.follows, Follows::Decorator)
|
||||
// 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)
|
||||
&& line.indent_length == 0
|
||||
// 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...).
|
||||
&& prev_indent_length.is_some_and(|prev_indent_length| prev_indent_length >= line.indent_length)
|
||||
// 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.
|
||||
&& !self.source_type.is_stub()
|
||||
{
|
||||
|
|
|
@ -1,83 +1,101 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
484 | def method(cls) -> None:
|
||||
484 | def func1():
|
||||
485 | pass
|
||||
486 | @classmethod
|
||||
| ^ E301
|
||||
487 | def cls_method(cls) -> None:
|
||||
488 | pass
|
||||
486 | def func2():
|
||||
| ^^^ E301
|
||||
487 | pass
|
||||
488 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
483 483 |
|
||||
484 484 | def method(cls) -> None:
|
||||
484 484 | def func1():
|
||||
485 485 | pass
|
||||
486 |+
|
||||
486 487 | @classmethod
|
||||
487 488 | def cls_method(cls) -> None:
|
||||
488 489 | pass
|
||||
486 487 | def func2():
|
||||
487 488 | 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
|
||||
---
|
||||
E30.py:494:1: E302 [*] Expected 2 blank lines, found 0
|
||||
E30.py:541:1: E302 [*] Expected 2 blank lines, found 0
|
||||
|
|
||||
492 | # E302
|
||||
493 | """Main module."""
|
||||
494 | def fn():
|
||||
539 | # E302
|
||||
540 | """Main module."""
|
||||
541 | def fn():
|
||||
| ^^^ E302
|
||||
495 | pass
|
||||
496 | # end
|
||||
542 | pass
|
||||
543 | # end
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ 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 |
|
||||
539 |+
|
||||
539 540 | async def x(y: int = 1):
|
||||
540 541 | pass
|
||||
541 542 | # end
|
||||
539 539 | # E302
|
||||
540 540 | """Main module."""
|
||||
541 |+
|
||||
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 | pass
|
||||
547 | def baz(): pass
|
||||
546 | # E302
|
||||
547 | import sys
|
||||
548 | def get_sys_path():
|
||||
| ^^^ E302
|
||||
548 | # end
|
||||
549 | return sys.path
|
||||
550 | # end
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
544 544 | # E302
|
||||
545 545 | def bar():
|
||||
546 546 | pass
|
||||
547 |+
|
||||
545 545 |
|
||||
546 546 | # E302
|
||||
547 547 | import sys
|
||||
548 |+
|
||||
547 549 | def baz(): pass
|
||||
548 550 | # end
|
||||
549 551 |
|
||||
549 |+
|
||||
548 550 | def get_sys_path():
|
||||
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
|
||||
552 | def bar(): pass
|
||||
553 | def baz():
|
||||
555 | pass
|
||||
556 |
|
||||
557 | def b():
|
||||
| ^^^ E302
|
||||
554 | pass
|
||||
555 | # end
|
||||
558 | pass
|
||||
559 | # end
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
550 550 |
|
||||
551 551 | # E302
|
||||
552 552 | def bar(): pass
|
||||
553 |+
|
||||
554 |+
|
||||
553 555 | def baz():
|
||||
554 556 | pass
|
||||
555 557 | # end
|
||||
554 554 | def a():
|
||||
555 555 | pass
|
||||
556 556 |
|
||||
557 |+
|
||||
557 558 | def b():
|
||||
558 559 | pass
|
||||
559 560 | # 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
|
||||
563 | @decorator
|
||||
566 | # comment
|
||||
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
|
||||
564 | def g():
|
||||
565 | pass
|
||||
611 | def g():
|
||||
612 | pass
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
559 559 | def f():
|
||||
560 560 | pass
|
||||
561 561 |
|
||||
562 |+
|
||||
563 |+
|
||||
562 564 | # comment
|
||||
563 565 | @decorator
|
||||
564 566 | def g():
|
||||
606 606 | def f():
|
||||
607 607 | pass
|
||||
608 608 |
|
||||
609 |+
|
||||
610 |+
|
||||
609 611 | # comment
|
||||
610 612 | @decorator
|
||||
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
|
||||
---
|
||||
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
|
||||
579 | return 22
|
||||
580 | # end
|
||||
626 | return 22
|
||||
627 | # end
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
574 574 | def method1():
|
||||
575 575 | return 1
|
||||
576 576 |
|
||||
577 |-
|
||||
578 577 | def method2():
|
||||
579 578 | return 22
|
||||
580 579 | # end
|
||||
621 621 | def method1():
|
||||
622 622 | return 1
|
||||
623 623 |
|
||||
624 |-
|
||||
625 624 | def method2():
|
||||
626 625 | return 22
|
||||
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
|
||||
589 |
|
||||
590 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||
653 |
|
||||
654 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
584 584 | def fn():
|
||||
585 585 | _ = None
|
||||
586 586 |
|
||||
587 |-
|
||||
588 587 | # arbitrary comment
|
||||
589 588 |
|
||||
590 589 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||
648 648 | def fn():
|
||||
649 649 | _ = None
|
||||
650 650 |
|
||||
651 |-
|
||||
652 651 | # arbitrary comment
|
||||
653 652 |
|
||||
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
|
||||
601 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||
602 | pass
|
||||
665 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||
666 | pass
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
596 596 | def fn():
|
||||
597 597 | _ = None
|
||||
598 598 |
|
||||
599 |-
|
||||
600 599 | # arbitrary comment
|
||||
601 600 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||
602 601 | pass
|
||||
660 660 | def fn():
|
||||
661 661 | _ = None
|
||||
662 662 |
|
||||
663 |-
|
||||
664 663 | # arbitrary comment
|
||||
665 664 | def inner(): # E306 not expected (pycodestyle detects E306)
|
||||
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
|
||||
612 | # end
|
||||
676 | # end
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
607 607 | print()
|
||||
608 608 |
|
||||
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:
|
||||
671 671 | print()
|
||||
672 672 |
|
||||
673 673 |
|
||||
674 |-
|
||||
675 674 | # comment
|
||||
676 675 |
|
||||
675 674 | print()
|
||||
676 675 | # end
|
||||
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
|
||||
679 |
|
||||
680 | def test(self): pass
|
||||
699 |
|
||||
700 | print()
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
674 674 |
|
||||
675 675 | # comment
|
||||
676 676 |
|
||||
677 |-
|
||||
678 677 | # another comment
|
||||
679 678 |
|
||||
680 679 | def test(self): pass
|
||||
694 694 |
|
||||
695 695 | # comment
|
||||
696 696 |
|
||||
697 |-
|
||||
698 697 | # another comment
|
||||
699 698 |
|
||||
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
|
||||
693 | pass
|
||||
694 | # end
|
||||
722 | pass
|
||||
723 | # end
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
688 688 |
|
||||
689 689 | # wrongly indented comment
|
||||
690 690 |
|
||||
691 |-
|
||||
692 691 | def b(self):
|
||||
693 692 | pass
|
||||
694 693 | # end
|
||||
717 717 | def a(self):
|
||||
718 718 | pass
|
||||
719 719 |
|
||||
720 |-
|
||||
721 720 | def b(self):
|
||||
722 721 | pass
|
||||
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
|
||||
703 | # end
|
||||
767 | # end
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
698 698 | def fn():
|
||||
699 699 | pass
|
||||
700 700 |
|
||||
701 |-
|
||||
702 701 | pass
|
||||
703 702 | # end
|
||||
704 703 |
|
||||
762 762 | def fn():
|
||||
763 763 | pass
|
||||
764 764 |
|
||||
765 |-
|
||||
766 765 | pass
|
||||
767 766 | # end
|
||||
768 767 |
|
||||
|
|
|
@ -1,65 +1,63 @@
|
|||
---
|
||||
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
|
||||
708 |
|
||||
709 | def function():
|
||||
771 | @decorator
|
||||
772 |
|
||||
773 | def function():
|
||||
| ^^^ E304
|
||||
710 | pass
|
||||
711 | # end
|
||||
774 | pass
|
||||
775 | # end
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
705 705 |
|
||||
706 706 | # E304
|
||||
707 707 | @decorator
|
||||
708 |-
|
||||
709 708 | def function():
|
||||
710 709 | pass
|
||||
711 710 | # end
|
||||
769 769 |
|
||||
770 770 | # E304
|
||||
771 771 | @decorator
|
||||
772 |-
|
||||
773 772 | def function():
|
||||
774 773 | pass
|
||||
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
|
||||
718 | def function():
|
||||
781 | # comment E304 not expected
|
||||
782 | def function():
|
||||
| ^^^ E304
|
||||
719 | pass
|
||||
720 | # end
|
||||
783 | pass
|
||||
784 | # end
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
713 713 |
|
||||
714 714 | # E304
|
||||
715 715 | @decorator
|
||||
716 |-
|
||||
717 716 | # comment E304 not expected
|
||||
718 717 | def function():
|
||||
719 718 | pass
|
||||
777 777 |
|
||||
778 778 | # E304
|
||||
779 779 | @decorator
|
||||
780 |-
|
||||
781 780 | # comment E304 not expected
|
||||
782 781 | def function():
|
||||
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
|
||||
730 | def function():
|
||||
793 | # second comment E304 not expected
|
||||
794 | def function():
|
||||
| ^^^ E304
|
||||
731 | pass
|
||||
732 | # end
|
||||
795 | pass
|
||||
796 | # end
|
||||
|
|
||||
= help: Remove extraneous blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
722 722 |
|
||||
723 723 | # E304
|
||||
724 724 | @decorator
|
||||
725 |-
|
||||
726 725 | # comment E304 not expected
|
||||
727 |-
|
||||
728 |-
|
||||
729 726 | # second comment E304 not expected
|
||||
730 727 | def function():
|
||||
731 728 | pass
|
||||
|
||||
|
||||
786 786 |
|
||||
787 787 | # E304
|
||||
788 788 | @decorator
|
||||
789 |-
|
||||
790 789 | # comment E304 not expected
|
||||
791 |-
|
||||
792 |-
|
||||
793 790 | # second comment E304 not expected
|
||||
794 791 | def function():
|
||||
795 792 | pass
|
||||
|
|
|
@ -1,102 +1,100 @@
|
|||
---
|
||||
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
|
||||
742 | fn()
|
||||
805 | # another comment
|
||||
806 | fn()
|
||||
| ^^ E305
|
||||
743 | # end
|
||||
807 | # end
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
739 739 | # comment
|
||||
740 740 |
|
||||
741 741 | # another comment
|
||||
742 |+
|
||||
743 |+
|
||||
742 744 | fn()
|
||||
743 745 | # end
|
||||
744 746 |
|
||||
803 803 | # comment
|
||||
804 804 |
|
||||
805 805 | # another comment
|
||||
806 |+
|
||||
807 |+
|
||||
806 808 | fn()
|
||||
807 809 | # end
|
||||
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
|
||||
753 | a = 1
|
||||
816 | # another comment
|
||||
817 | a = 1
|
||||
| ^ E305
|
||||
754 | # end
|
||||
818 | # end
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
750 750 | # comment
|
||||
751 751 |
|
||||
752 752 | # another comment
|
||||
753 |+
|
||||
754 |+
|
||||
753 755 | a = 1
|
||||
754 756 | # end
|
||||
755 757 |
|
||||
814 814 | # comment
|
||||
815 815 |
|
||||
816 816 | # another comment
|
||||
817 |+
|
||||
818 |+
|
||||
817 819 | a = 1
|
||||
818 820 | # end
|
||||
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
|
||||
764 |
|
||||
765 | try:
|
||||
827 | # another comment
|
||||
828 |
|
||||
829 | try:
|
||||
| ^^^ E305
|
||||
766 | fn()
|
||||
767 | except Exception:
|
||||
830 | fn()
|
||||
831 | except Exception:
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
762 762 |
|
||||
763 763 | # another comment
|
||||
764 764 |
|
||||
765 |+
|
||||
765 766 | try:
|
||||
766 767 | fn()
|
||||
767 768 | except Exception:
|
||||
826 826 |
|
||||
827 827 | # another comment
|
||||
828 828 |
|
||||
829 |+
|
||||
829 830 | try:
|
||||
830 831 | fn()
|
||||
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.
|
||||
777 | if a():
|
||||
840 | # Two spaces before comments, too.
|
||||
841 | if a():
|
||||
| ^^ E305
|
||||
778 | a()
|
||||
779 | # end
|
||||
842 | a()
|
||||
843 | # end
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
774 774 | print()
|
||||
775 775 |
|
||||
776 776 | # Two spaces before comments, too.
|
||||
777 |+
|
||||
778 |+
|
||||
777 779 | if a():
|
||||
778 780 | a()
|
||||
779 781 | # end
|
||||
838 838 | print()
|
||||
839 839 |
|
||||
840 840 | # Two spaces before comments, too.
|
||||
841 |+
|
||||
842 |+
|
||||
841 843 | if a():
|
||||
842 844 | a()
|
||||
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
|
||||
789 |
|
||||
790 | if __name__ == '__main__':
|
||||
852 | blah, blah
|
||||
853 |
|
||||
854 | if __name__ == '__main__':
|
||||
| ^^ E305
|
||||
791 | main()
|
||||
792 | # end
|
||||
855 | main()
|
||||
856 | # end
|
||||
|
|
||||
= help: Add missing blank line(s)
|
||||
|
||||
ℹ Safe fix
|
||||
787 787 | def main():
|
||||
788 788 | blah, blah
|
||||
789 789 |
|
||||
790 |+
|
||||
790 791 | if __name__ == '__main__':
|
||||
791 792 | main()
|
||||
792 793 | # end
|
||||
|
||||
|
||||
851 851 | def main():
|
||||
852 852 | blah, blah
|
||||
853 853 |
|
||||
854 |+
|
||||
854 855 | if __name__ == '__main__':
|
||||
855 856 | main()
|
||||
856 857 | # end
|
||||
|
|
|
@ -1,223 +1,221 @@
|
|||
---
|
||||
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():
|
||||
797 | x = 1
|
||||
798 | def b():
|
||||
860 | def a():
|
||||
861 | x = 1
|
||||
862 | def b():
|
||||
| ^^^ E306
|
||||
799 | pass
|
||||
800 | # end
|
||||
863 | pass
|
||||
864 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
795 795 | # E306:3:5
|
||||
796 796 | def a():
|
||||
797 797 | x = 1
|
||||
798 |+
|
||||
798 799 | def b():
|
||||
799 800 | pass
|
||||
800 801 | # end
|
||||
859 859 | # E306:3:5
|
||||
860 860 | def a():
|
||||
861 861 | x = 1
|
||||
862 |+
|
||||
862 863 | def b():
|
||||
863 864 | pass
|
||||
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():
|
||||
805 | x = 1
|
||||
806 | def b():
|
||||
868 | async def a():
|
||||
869 | x = 1
|
||||
870 | def b():
|
||||
| ^^^ E306
|
||||
807 | pass
|
||||
808 | # end
|
||||
871 | pass
|
||||
872 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
803 803 | #: E306:3:5
|
||||
804 804 | async def a():
|
||||
805 805 | x = 1
|
||||
806 |+
|
||||
806 807 | def b():
|
||||
807 808 | pass
|
||||
808 809 | # end
|
||||
867 867 | #: E306:3:5
|
||||
868 868 | async def a():
|
||||
869 869 | x = 1
|
||||
870 |+
|
||||
870 871 | def b():
|
||||
871 872 | pass
|
||||
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():
|
||||
813 | x = 2
|
||||
814 | def b():
|
||||
876 | def a():
|
||||
877 | x = 2
|
||||
878 | def b():
|
||||
| ^^^ E306
|
||||
815 | x = 1
|
||||
816 | def c():
|
||||
879 | x = 1
|
||||
880 | def c():
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
811 811 | #: E306:3:5 E306:5:9
|
||||
812 812 | def a():
|
||||
813 813 | x = 2
|
||||
814 |+
|
||||
814 815 | def b():
|
||||
815 816 | x = 1
|
||||
816 817 | def c():
|
||||
875 875 | #: E306:3:5 E306:5:9
|
||||
876 876 | def a():
|
||||
877 877 | x = 2
|
||||
878 |+
|
||||
878 879 | def b():
|
||||
879 880 | x = 1
|
||||
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():
|
||||
815 | x = 1
|
||||
816 | def c():
|
||||
878 | def b():
|
||||
879 | x = 1
|
||||
880 | def c():
|
||||
| ^^^ E306
|
||||
817 | pass
|
||||
818 | # end
|
||||
881 | pass
|
||||
882 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
813 813 | x = 2
|
||||
814 814 | def b():
|
||||
815 815 | x = 1
|
||||
816 |+
|
||||
816 817 | def c():
|
||||
817 818 | pass
|
||||
818 819 | # end
|
||||
877 877 | x = 2
|
||||
878 878 | def b():
|
||||
879 879 | x = 1
|
||||
880 |+
|
||||
880 881 | def c():
|
||||
881 882 | pass
|
||||
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():
|
||||
823 | x = 1
|
||||
824 | class C:
|
||||
886 | def a():
|
||||
887 | x = 1
|
||||
888 | class C:
|
||||
| ^^^^^ E306
|
||||
825 | pass
|
||||
826 | x = 2
|
||||
889 | pass
|
||||
890 | x = 2
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
821 821 | # E306:3:5 E306:6:5
|
||||
822 822 | def a():
|
||||
823 823 | x = 1
|
||||
824 |+
|
||||
824 825 | class C:
|
||||
825 826 | pass
|
||||
826 827 | x = 2
|
||||
885 885 | # E306:3:5 E306:6:5
|
||||
886 886 | def a():
|
||||
887 887 | x = 1
|
||||
888 |+
|
||||
888 889 | class C:
|
||||
889 890 | pass
|
||||
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
|
||||
826 | x = 2
|
||||
827 | def b():
|
||||
889 | pass
|
||||
890 | x = 2
|
||||
891 | def b():
|
||||
| ^^^ E306
|
||||
828 | pass
|
||||
829 | # end
|
||||
892 | pass
|
||||
893 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
824 824 | class C:
|
||||
825 825 | pass
|
||||
826 826 | x = 2
|
||||
827 |+
|
||||
827 828 | def b():
|
||||
828 829 | pass
|
||||
829 830 | # end
|
||||
888 888 | class C:
|
||||
889 889 | pass
|
||||
890 890 | x = 2
|
||||
891 |+
|
||||
891 892 | def b():
|
||||
892 893 | pass
|
||||
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():
|
||||
835 | pass
|
||||
836 | def baz(): pass
|
||||
898 | def bar():
|
||||
899 | pass
|
||||
900 | def baz(): pass
|
||||
| ^^^ E306
|
||||
837 | # end
|
||||
901 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
833 833 | def foo():
|
||||
834 834 | def bar():
|
||||
835 835 | pass
|
||||
836 |+
|
||||
836 837 | def baz(): pass
|
||||
837 838 | # end
|
||||
838 839 |
|
||||
897 897 | def foo():
|
||||
898 898 | def bar():
|
||||
899 899 | pass
|
||||
900 |+
|
||||
900 901 | def baz(): pass
|
||||
901 902 | # end
|
||||
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():
|
||||
842 | def bar(): pass
|
||||
843 | def baz():
|
||||
905 | def foo():
|
||||
906 | def bar(): pass
|
||||
907 | def baz():
|
||||
| ^^^ E306
|
||||
844 | pass
|
||||
845 | # end
|
||||
908 | pass
|
||||
909 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
840 840 | # E306:3:5
|
||||
841 841 | def foo():
|
||||
842 842 | def bar(): pass
|
||||
843 |+
|
||||
843 844 | def baz():
|
||||
844 845 | pass
|
||||
845 846 | # end
|
||||
904 904 | # E306:3:5
|
||||
905 905 | def foo():
|
||||
906 906 | def bar(): pass
|
||||
907 |+
|
||||
907 908 | def baz():
|
||||
908 909 | pass
|
||||
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():
|
||||
850 | x = 2
|
||||
851 | @decorator
|
||||
913 | def a():
|
||||
914 | x = 2
|
||||
915 | @decorator
|
||||
| ^ E306
|
||||
852 | def b():
|
||||
853 | pass
|
||||
916 | def b():
|
||||
917 | pass
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
848 848 | # E306
|
||||
849 849 | def a():
|
||||
850 850 | x = 2
|
||||
851 |+
|
||||
851 852 | @decorator
|
||||
852 853 | def b():
|
||||
853 854 | pass
|
||||
912 912 | # E306
|
||||
913 913 | def a():
|
||||
914 914 | x = 2
|
||||
915 |+
|
||||
915 916 | @decorator
|
||||
916 917 | def b():
|
||||
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():
|
||||
859 | x = 2
|
||||
860 | @decorator
|
||||
922 | def a():
|
||||
923 | x = 2
|
||||
924 | @decorator
|
||||
| ^ E306
|
||||
861 | async def b():
|
||||
862 | pass
|
||||
925 | async def b():
|
||||
926 | pass
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
857 857 | # E306
|
||||
858 858 | def a():
|
||||
859 859 | x = 2
|
||||
860 |+
|
||||
860 861 | @decorator
|
||||
861 862 | async def b():
|
||||
862 863 | pass
|
||||
921 921 | # E306
|
||||
922 922 | def a():
|
||||
923 923 | x = 2
|
||||
924 |+
|
||||
924 925 | @decorator
|
||||
925 926 | async def b():
|
||||
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():
|
||||
868 | x = 2
|
||||
869 | async def b():
|
||||
931 | def a():
|
||||
932 | x = 2
|
||||
933 | async def b():
|
||||
| ^^^^^ E306
|
||||
870 | pass
|
||||
871 | # end
|
||||
934 | pass
|
||||
935 | # end
|
||||
|
|
||||
= help: Add missing blank line
|
||||
|
||||
ℹ Safe fix
|
||||
866 866 | # E306
|
||||
867 867 | def a():
|
||||
868 868 | x = 2
|
||||
869 |+
|
||||
869 870 | async def b():
|
||||
870 871 | pass
|
||||
871 872 | # end
|
||||
|
||||
|
||||
930 930 | # E306
|
||||
931 931 | def a():
|
||||
932 932 | x = 2
|
||||
933 |+
|
||||
933 934 | async def b():
|
||||
934 935 | pass
|
||||
935 936 | # end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue