Avoid syntax errors for test cases (#11923)

## Summary

This PR removes most of the syntax errors from the test cases. This
would create noise when https://github.com/astral-sh/ruff/pull/11901 is
complete. These syntax errors are also just noise for the test itself.

## Test Plan

Update the snapshots and verify that they're still the same.
This commit is contained in:
Dhruv Manilawala 2024-06-18 17:16:27 +05:30 committed by GitHub
parent 104608b2f7
commit 13ad24b13e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 1035 additions and 1048 deletions

View File

@ -42,7 +42,7 @@ foo = (
4, 4,
) )
foo = 3, foo = 3,
class A(object): class A(object):
foo = 3 foo = 3
@ -443,13 +443,13 @@ multiline_index_access[
] ]
multiline_index_access[ multiline_index_access[
lambda fine, lambda fine1,
fine, fine2,
fine: (0,) fine3: (0,)
: :
lambda fine, lambda fine1,
fine, fine2,
fine: (0,), fine3: (0,),
"fine" "fine"
: :
"fine", "fine",

View File

@ -49,29 +49,29 @@ result = [
#: E203:1:10 #: E203:1:10
if x == 4 : if x == 4 :
print x, y print(x, y)
x, y = y, x x, y = y, x
#: E203:1:10 #: E203:1:10
if x == 4 : if x == 4 :
print x, y print(x, y)
x, y = y, x x, y = y, x
#: E203:2:15 E702:2:16 #: E203:2:15 E702:2:16
if x == 4: if x == 4:
print x, y ; x, y = y, x print(x, y) ; x, y = y, x
#: E203:2:15 E702:2:16 #: E203:2:15 E702:2:16
if x == 4: if x == 4:
print x, y ; x, y = y, x print(x, y) ; x, y = y, x
#: E203:3:13 #: E203:3:13
if x == 4: if x == 4:
print x, y print(x, y)
x, y = y , x x, y = y , x
#: E203:3:13 #: E203:3:13
if x == 4: if x == 4:
print x, y print(x, y)
x, y = y , x x, y = y , x
#: Okay #: Okay
if x == 4: if x == 4:
print x, y print(x, y)
x, y = y, x x, y = y, x
a[b1, :] == a[b1, ...] a[b1, :] == a[b1, ...]
b = a[:, b1] b = a[:, b1]
@ -123,7 +123,7 @@ ham[lower + offset : upper + offset]
ham[(lower + offset) : upper + offset] ham[(lower + offset) : upper + offset]
#: E203:1:19 #: E203:1:19
ham{lower + offset : upper + offset} {lower + offset : upper + offset}
#: E203:1:19 #: E203:1:19
ham[lower + offset : upper + offset] ham[lower + offset : upper + offset]

View File

@ -80,7 +80,7 @@ def main() -> None:
x = [ x = [
{ {
"k1":[2], # E231 "k1":[2], # E231
"k2": [2:4], "k2": x[2:4],
"k3":[2], # E231 "k3":[2], # E231
"k4": [2], "k4": [2],
"k5": [2], "k5": [2],

View File

@ -6,6 +6,7 @@ True and False
True and False True and False
#: E271 #: E271
if 1: if 1:
pass
#: E273 #: E273
True and False True and False
#: E273 E274 #: E273 E274

View File

@ -411,17 +411,9 @@ async def function1():
# no error # no error
async def function1(): async def function1():
await function2() await function2()
async with function3(): async with function3():
pass pass
# end
# no error
class Test:
async
def a(self): pass
# end # end

View File

@ -73,12 +73,12 @@ if bar:
if ((foo.bar("baz") and if ((foo.bar("baz") and
foo.bar("bop") foo.bar("bop")
)): )):
print "yes" print("yes")
#: E101 W191 W504 #: E101 W191 W504
# also ok, but starting to look like LISP # also ok, but starting to look like LISP
if ((foo.bar("baz") and if ((foo.bar("baz") and
foo.bar("bop"))): foo.bar("bop"))):
print "yes" print("yes")
#: E101 W191 W504 #: E101 W191 W504
if (a == 2 or if (a == 2 or
b == "abc def ghi" b == "abc def ghi"

View File

@ -106,7 +106,7 @@ COM81.py:45:8: COM818 Trailing comma on bare tuple prohibited
| |
43 | ) 43 | )
44 | 44 |
45 | foo = 3, 45 | foo = 3,
| ^ COM818 | ^ COM818
46 | 46 |
47 | class A(object): 47 | class A(object):
@ -977,5 +977,3 @@ COM81.py:647:49: COM812 [*] Trailing comma missing
648 648 | ) 648 648 | )
649 649 | 649 649 |
650 650 | assert False, f"<- This is not a trailing comma" 650 650 | assert False, f"<- This is not a trailing comma"

View File

@ -292,7 +292,9 @@ mod tests {
#[test_case( #[test_case(
r" r"
import pandas as pd import pandas as pd
pd.stack( x = pd.DataFrame()
y = pd.DataFrame()
x.merge(y)
", ",
"PD015_pass_merge_on_dataframe" "PD015_pass_merge_on_dataframe"
)] )]

View File

@ -6,7 +6,7 @@ E20.py:51:10: E203 [*] Whitespace before ':'
50 | #: E203:1:10 50 | #: E203:1:10
51 | if x == 4 : 51 | if x == 4 :
| ^ E203 | ^ E203
52 | print x, y 52 | print(x, y)
53 | x, y = y, x 53 | x, y = y, x
| |
= help: Remove whitespace before ':' = help: Remove whitespace before ':'
@ -17,7 +17,7 @@ E20.py:51:10: E203 [*] Whitespace before ':'
50 50 | #: E203:1:10 50 50 | #: E203:1:10
51 |-if x == 4 : 51 |-if x == 4 :
51 |+if x == 4: 51 |+if x == 4:
52 52 | print x, y 52 52 | print(x, y)
53 53 | x, y = y, x 53 53 | x, y = y, x
54 54 | #: E203:1:10 54 54 | #: E203:1:10
@ -27,27 +27,27 @@ E20.py:55:10: E203 [*] Whitespace before ':'
54 | #: E203:1:10 54 | #: E203:1:10
55 | if x == 4 : 55 | if x == 4 :
| ^^^ E203 | ^^^ E203
56 | print x, y 56 | print(x, y)
57 | x, y = y, x 57 | x, y = y, x
| |
= help: Remove whitespace before ':' = help: Remove whitespace before ':'
Safe fix Safe fix
52 52 | print x, y 52 52 | print(x, y)
53 53 | x, y = y, x 53 53 | x, y = y, x
54 54 | #: E203:1:10 54 54 | #: E203:1:10
55 |-if x == 4 : 55 |-if x == 4 :
55 |+if x == 4: 55 |+if x == 4:
56 56 | print x, y 56 56 | print(x, y)
57 57 | x, y = y, x 57 57 | x, y = y, x
58 58 | #: E203:2:15 E702:2:16 58 58 | #: E203:2:15 E702:2:16
E20.py:60:15: E203 [*] Whitespace before ';' E20.py:60:16: E203 [*] Whitespace before ';'
| |
58 | #: E203:2:15 E702:2:16 58 | #: E203:2:15 E702:2:16
59 | if x == 4: 59 | if x == 4:
60 | print x, y ; x, y = y, x 60 | print(x, y) ; x, y = y, x
| ^ E203 | ^ E203
61 | #: E203:2:15 E702:2:16 61 | #: E203:2:15 E702:2:16
62 | if x == 4: 62 | if x == 4:
| |
@ -57,37 +57,37 @@ E20.py:60:15: E203 [*] Whitespace before ';'
57 57 | x, y = y, x 57 57 | x, y = y, x
58 58 | #: E203:2:15 E702:2:16 58 58 | #: E203:2:15 E702:2:16
59 59 | if x == 4: 59 59 | if x == 4:
60 |- print x, y ; x, y = y, x 60 |- print(x, y) ; x, y = y, x
60 |+ print x, y; x, y = y, x 60 |+ print(x, y); x, y = y, x
61 61 | #: E203:2:15 E702:2:16 61 61 | #: E203:2:15 E702:2:16
62 62 | if x == 4: 62 62 | if x == 4:
63 63 | print x, y ; x, y = y, x 63 63 | print(x, y) ; x, y = y, x
E20.py:63:15: E203 [*] Whitespace before ';' E20.py:63:16: E203 [*] Whitespace before ';'
| |
61 | #: E203:2:15 E702:2:16 61 | #: E203:2:15 E702:2:16
62 | if x == 4: 62 | if x == 4:
63 | print x, y ; x, y = y, x 63 | print(x, y) ; x, y = y, x
| ^^ E203 | ^ E203
64 | #: E203:3:13 64 | #: E203:3:13
65 | if x == 4: 65 | if x == 4:
| |
= help: Remove whitespace before ';' = help: Remove whitespace before ';'
Safe fix Safe fix
60 60 | print x, y ; x, y = y, x 60 60 | print(x, y) ; x, y = y, x
61 61 | #: E203:2:15 E702:2:16 61 61 | #: E203:2:15 E702:2:16
62 62 | if x == 4: 62 62 | if x == 4:
63 |- print x, y ; x, y = y, x 63 |- print(x, y) ; x, y = y, x
63 |+ print x, y; x, y = y, x 63 |+ print(x, y); x, y = y, x
64 64 | #: E203:3:13 64 64 | #: E203:3:13
65 65 | if x == 4: 65 65 | if x == 4:
66 66 | print x, y 66 66 | print(x, y)
E20.py:67:13: E203 [*] Whitespace before ',' E20.py:67:13: E203 [*] Whitespace before ','
| |
65 | if x == 4: 65 | if x == 4:
66 | print x, y 66 | print(x, y)
67 | x, y = y , x 67 | x, y = y , x
| ^ E203 | ^ E203
68 | #: E203:3:13 68 | #: E203:3:13
@ -98,17 +98,17 @@ E20.py:67:13: E203 [*] Whitespace before ','
Safe fix Safe fix
64 64 | #: E203:3:13 64 64 | #: E203:3:13
65 65 | if x == 4: 65 65 | if x == 4:
66 66 | print x, y 66 66 | print(x, y)
67 |- x, y = y , x 67 |- x, y = y , x
67 |+ x, y = y, x 67 |+ x, y = y, x
68 68 | #: E203:3:13 68 68 | #: E203:3:13
69 69 | if x == 4: 69 69 | if x == 4:
70 70 | print x, y 70 70 | print(x, y)
E20.py:71:13: E203 [*] Whitespace before ',' E20.py:71:13: E203 [*] Whitespace before ','
| |
69 | if x == 4: 69 | if x == 4:
70 | print x, y 70 | print(x, y)
71 | x, y = y , x 71 | x, y = y , x
| ^^^^ E203 | ^^^^ E203
72 | #: Okay 72 | #: Okay
@ -119,12 +119,12 @@ E20.py:71:13: E203 [*] Whitespace before ','
Safe fix Safe fix
68 68 | #: E203:3:13 68 68 | #: E203:3:13
69 69 | if x == 4: 69 69 | if x == 4:
70 70 | print x, y 70 70 | print(x, y)
71 |- x, y = y , x 71 |- x, y = y , x
71 |+ x, y = y, x 71 |+ x, y = y, x
72 72 | #: Okay 72 72 | #: Okay
73 73 | if x == 4: 73 73 | if x == 4:
74 74 | print x, y 74 74 | print(x, y)
E20.py:86:61: E203 [*] Whitespace before ':' E20.py:86:61: E203 [*] Whitespace before ':'
| |
@ -186,11 +186,11 @@ E20.py:101:61: E203 [*] Whitespace before ':'
103 103 | 103 103 |
104 104 | #: 104 104 | #:
E20.py:126:19: E203 [*] Whitespace before ':' E20.py:126:16: E203 [*] Whitespace before ':'
| |
125 | #: E203:1:19 125 | #: E203:1:19
126 | ham{lower + offset : upper + offset} 126 | {lower + offset : upper + offset}
| ^ E203 | ^ E203
127 | 127 |
128 | #: E203:1:19 128 | #: E203:1:19
| |
@ -200,8 +200,8 @@ E20.py:126:19: E203 [*] Whitespace before ':'
123 123 | ham[(lower + offset) : upper + offset] 123 123 | ham[(lower + offset) : upper + offset]
124 124 | 124 124 |
125 125 | #: E203:1:19 125 125 | #: E203:1:19
126 |-ham{lower + offset : upper + offset} 126 |-{lower + offset : upper + offset}
126 |+ham{lower + offset: upper + offset} 126 |+{lower + offset: upper + offset}
127 127 | 127 127 |
128 128 | #: E203:1:19 128 128 | #: E203:1:19
129 129 | ham[lower + offset : upper + offset] 129 129 | ham[lower + offset : upper + offset]
@ -217,7 +217,7 @@ E20.py:129:19: E203 [*] Whitespace before ':'
= help: Remove whitespace before ':' = help: Remove whitespace before ':'
Safe fix Safe fix
126 126 | ham{lower + offset : upper + offset} 126 126 | {lower + offset : upper + offset}
127 127 | 127 127 |
128 128 | #: E203:1:19 128 128 | #: E203:1:19
129 |-ham[lower + offset : upper + offset] 129 |-ham[lower + offset : upper + offset]

View File

@ -231,7 +231,7 @@ E23.py:82:13: E231 [*] Missing whitespace after ':'
81 | { 81 | {
82 | "k1":[2], # E231 82 | "k1":[2], # E231
| ^ E231 | ^ E231
83 | "k2": [2:4], 83 | "k2": x[2:4],
84 | "k3":[2], # E231 84 | "k3":[2], # E231
| |
= help: Add missing whitespace = help: Add missing whitespace
@ -242,14 +242,14 @@ E23.py:82:13: E231 [*] Missing whitespace after ':'
81 81 | { 81 81 | {
82 |- "k1":[2], # E231 82 |- "k1":[2], # E231
82 |+ "k1": [2], # E231 82 |+ "k1": [2], # E231
83 83 | "k2": [2:4], 83 83 | "k2": x[2:4],
84 84 | "k3":[2], # E231 84 84 | "k3":[2], # E231
85 85 | "k4": [2], 85 85 | "k4": [2],
E23.py:84:13: E231 [*] Missing whitespace after ':' E23.py:84:13: E231 [*] Missing whitespace after ':'
| |
82 | "k1":[2], # E231 82 | "k1":[2], # E231
83 | "k2": [2:4], 83 | "k2": x[2:4],
84 | "k3":[2], # E231 84 | "k3":[2], # E231
| ^ E231 | ^ E231
85 | "k4": [2], 85 | "k4": [2],
@ -260,7 +260,7 @@ E23.py:84:13: E231 [*] Missing whitespace after ':'
Safe fix Safe fix
81 81 | { 81 81 | {
82 82 | "k1":[2], # E231 82 82 | "k1":[2], # E231
83 83 | "k2": [2:4], 83 83 | "k2": x[2:4],
84 |- "k3":[2], # E231 84 |- "k3":[2], # E231
84 |+ "k3": [2], # E231 84 |+ "k3": [2], # E231
85 85 | "k4": [2], 85 85 | "k4": [2],

View File

@ -41,7 +41,7 @@ E27.py:6:5: E271 [*] Multiple spaces after keyword
6 |+True and False 6 |+True and False
7 7 | #: E271 7 7 | #: E271
8 8 | if 1: 8 8 | if 1:
9 9 | #: E273 9 9 | pass
E27.py:8:3: E271 [*] Multiple spaces after keyword E27.py:8:3: E271 [*] Multiple spaces after keyword
| |
@ -49,8 +49,8 @@ E27.py:8:3: E271 [*] Multiple spaces after keyword
7 | #: E271 7 | #: E271
8 | if 1: 8 | if 1:
| ^^^ E271 | ^^^ E271
9 | #: E273 9 | pass
10 | True and False 10 | #: E273
| |
= help: Replace with single space = help: Replace with single space
@ -60,152 +60,152 @@ E27.py:8:3: E271 [*] Multiple spaces after keyword
7 7 | #: E271 7 7 | #: E271
8 |-if 1: 8 |-if 1:
8 |+if 1: 8 |+if 1:
9 9 | #: E273 9 9 | pass
10 10 | True and False 10 10 | #: E273
11 11 | #: E273 E274 11 11 | True and False
E27.py:14:6: E271 [*] Multiple spaces after keyword E27.py:15:6: E271 [*] Multiple spaces after keyword
| |
12 | True and False 13 | True and False
13 | #: E271 14 | #: E271
14 | a and b 15 | a and b
| ^^ E271 | ^^ E271
15 | #: E271 16 | #: E271
16 | 1 and b 17 | 1 and b
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
11 11 | #: E273 E274 12 12 | #: E273 E274
12 12 | True and False 13 13 | True and False
13 13 | #: E271 14 14 | #: E271
14 |-a and b 15 |-a and b
14 |+a and b 15 |+a and b
15 15 | #: E271 16 16 | #: E271
16 16 | 1 and b 17 17 | 1 and b
17 17 | #: E271 18 18 | #: E271
E27.py:16:6: E271 [*] Multiple spaces after keyword E27.py:17:6: E271 [*] Multiple spaces after keyword
| |
14 | a and b 15 | a and b
15 | #: E271 16 | #: E271
16 | 1 and b 17 | 1 and b
| ^^ E271 | ^^ E271
17 | #: E271 18 | #: E271
18 | a and 2 19 | a and 2
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
13 13 | #: E271 14 14 | #: E271
14 14 | a and b 15 15 | a and b
15 15 | #: E271 16 16 | #: E271
16 |-1 and b 17 |-1 and b
16 |+1 and b 17 |+1 and b
17 17 | #: E271 18 18 | #: E271
18 18 | a and 2 19 19 | a and 2
19 19 | #: E271 E272 20 20 | #: E271 E272
E27.py:18:6: E271 [*] Multiple spaces after keyword E27.py:19:6: E271 [*] Multiple spaces after keyword
| |
16 | 1 and b 17 | 1 and b
17 | #: E271 18 | #: E271
18 | a and 2 19 | a and 2
| ^^ E271 | ^^ E271
19 | #: E271 E272 20 | #: E271 E272
20 | 1 and b 21 | 1 and b
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
15 15 | #: E271 16 16 | #: E271
16 16 | 1 and b 17 17 | 1 and b
17 17 | #: E271 18 18 | #: E271
18 |-a and 2 19 |-a and 2
18 |+a and 2 19 |+a and 2
19 19 | #: E271 E272 20 20 | #: E271 E272
20 20 | 1 and b 21 21 | 1 and b
21 21 | #: E271 E272 22 22 | #: E271 E272
E27.py:20:7: E271 [*] Multiple spaces after keyword E27.py:21:7: E271 [*] Multiple spaces after keyword
| |
18 | a and 2 19 | a and 2
19 | #: E271 E272 20 | #: E271 E272
20 | 1 and b 21 | 1 and b
| ^^ E271 | ^^ E271
21 | #: E271 E272 22 | #: E271 E272
22 | a and 2 23 | a and 2
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
17 17 | #: E271 18 18 | #: E271
18 18 | a and 2 19 19 | a and 2
19 19 | #: E271 E272 20 20 | #: E271 E272
20 |-1 and b 21 |-1 and b
20 |+1 and b 21 |+1 and b
21 21 | #: E271 E272 22 22 | #: E271 E272
22 22 | a and 2 23 23 | a and 2
23 23 | #: E272 24 24 | #: E272
E27.py:22:7: E271 [*] Multiple spaces after keyword E27.py:23:7: E271 [*] Multiple spaces after keyword
| |
20 | 1 and b 21 | 1 and b
21 | #: E271 E272 22 | #: E271 E272
22 | a and 2 23 | a and 2
| ^^ E271 | ^^ E271
23 | #: E272 24 | #: E272
24 | this and False 25 | this and False
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
19 19 | #: E271 E272 20 20 | #: E271 E272
20 20 | 1 and b 21 21 | 1 and b
21 21 | #: E271 E272 22 22 | #: E271 E272
22 |-a and 2 23 |-a and 2
22 |+a and 2 23 |+a and 2
23 23 | #: E272 24 24 | #: E272
24 24 | this and False 25 25 | this and False
25 25 | #: E273 26 26 | #: E273
E27.py:35:14: E271 [*] Multiple spaces after keyword E27.py:36:14: E271 [*] Multiple spaces after keyword
| |
33 | from v import c, d 34 | from v import c, d
34 | #: E271 35 | #: E271
35 | from w import (e, f) 36 | from w import (e, f)
| ^^ E271 | ^^ E271
36 | #: E275 37 | #: E275
37 | from w import(e, f) 38 | from w import(e, f)
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
32 32 | from u import (a, b) 33 33 | from u import (a, b)
33 33 | from v import c, d 34 34 | from v import c, d
34 34 | #: E271 35 35 | #: E271
35 |-from w import (e, f) 36 |-from w import (e, f)
35 |+from w import (e, f) 36 |+from w import (e, f)
36 36 | #: E275 37 37 | #: E275
37 37 | from w import(e, f) 38 38 | from w import(e, f)
38 38 | #: E275 39 39 | #: E275
E27.py:70:5: E271 [*] Multiple spaces after keyword E27.py:71:5: E271 [*] Multiple spaces after keyword
| |
69 | #: E271 70 | #: E271
70 | type Number = int 71 | type Number = int
| ^^ E271 | ^^ E271
71 | 72 |
72 | #: E273 73 | #: E273
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
67 67 | # Soft keywords 68 68 | # Soft keywords
68 68 | 69 69 |
69 69 | #: E271 70 70 | #: E271
70 |-type Number = int 71 |-type Number = int
70 |+type Number = int 71 |+type Number = int
71 71 | 72 72 |
72 72 | #: E273 73 73 | #: E273
73 73 | type Number = int 74 74 | type Number = int

View File

@ -1,67 +1,65 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E27.py:20:2: E272 [*] Multiple spaces before keyword E27.py:21:2: E272 [*] Multiple spaces before keyword
| |
18 | a and 2 19 | a and 2
19 | #: E271 E272 20 | #: E271 E272
20 | 1 and b 21 | 1 and b
| ^^ E272 | ^^ E272
21 | #: E271 E272 22 | #: E271 E272
22 | a and 2 23 | a and 2
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
17 17 | #: E271 18 18 | #: E271
18 18 | a and 2 19 19 | a and 2
19 19 | #: E271 E272 20 20 | #: E271 E272
20 |-1 and b 21 |-1 and b
20 |+1 and b 21 |+1 and b
21 21 | #: E271 E272 22 22 | #: E271 E272
22 22 | a and 2 23 23 | a and 2
23 23 | #: E272 24 24 | #: E272
E27.py:22:2: E272 [*] Multiple spaces before keyword E27.py:23:2: E272 [*] Multiple spaces before keyword
| |
20 | 1 and b 21 | 1 and b
21 | #: E271 E272 22 | #: E271 E272
22 | a and 2 23 | a and 2
| ^^ E272 | ^^ E272
23 | #: E272 24 | #: E272
24 | this and False 25 | this and False
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
19 19 | #: E271 E272 20 20 | #: E271 E272
20 20 | 1 and b 21 21 | 1 and b
21 21 | #: E271 E272 22 22 | #: E271 E272
22 |-a and 2 23 |-a and 2
22 |+a and 2 23 |+a and 2
23 23 | #: E272 24 24 | #: E272
24 24 | this and False 25 25 | this and False
25 25 | #: E273 26 26 | #: E273
E27.py:24:5: E272 [*] Multiple spaces before keyword E27.py:25:5: E272 [*] Multiple spaces before keyword
| |
22 | a and 2 23 | a and 2
23 | #: E272 24 | #: E272
24 | this and False 25 | this and False
| ^^ E272 | ^^ E272
25 | #: E273 26 | #: E273
26 | a and b 27 | a and b
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
21 21 | #: E271 E272 22 22 | #: E271 E272
22 22 | a and 2 23 23 | a and 2
23 23 | #: E272 24 24 | #: E272
24 |-this and False 25 |-this and False
24 |+this and False 25 |+this and False
25 25 | #: E273 26 26 | #: E273
26 26 | a and b 27 27 | a and b
27 27 | #: E274 28 28 | #: E274

View File

@ -1,127 +1,127 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E27.py:10:9: E273 [*] Tab after keyword E27.py:11:9: E273 [*] Tab after keyword
| |
8 | if 1: 9 | pass
9 | #: E273 10 | #: E273
10 | True and False 11 | True and False
| ^^^^^^^^ E273 | ^^^^^^^^ E273
11 | #: E273 E274 12 | #: E273 E274
12 | True and False 13 | True and False
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
7 7 | #: E271
8 8 | if 1: 8 8 | if 1:
9 9 | #: E273 9 9 | pass
10 |-True and False 10 10 | #: E273
10 |+True and False 11 |-True and False
11 11 | #: E273 E274 11 |+True and False
12 12 | True and False 12 12 | #: E273 E274
13 13 | #: E271 13 13 | True and False
14 14 | #: E271
E27.py:12:5: E273 [*] Tab after keyword E27.py:13:5: E273 [*] Tab after keyword
| |
10 | True and False 11 | True and False
11 | #: E273 E274 12 | #: E273 E274
12 | True and False 13 | True and False
| ^^^^^^^^ E273 | ^^^^^^^^ E273
13 | #: E271 14 | #: E271
14 | a and b 15 | a and b
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
9 9 | #: E273 10 10 | #: E273
10 10 | True and False 11 11 | True and False
11 11 | #: E273 E274 12 12 | #: E273 E274
12 |-True and False 13 |-True and False
12 |+True and False 13 |+True and False
13 13 | #: E271 14 14 | #: E271
14 14 | a and b 15 15 | a and b
15 15 | #: E271 16 16 | #: E271
E27.py:12:10: E273 [*] Tab after keyword E27.py:13:10: E273 [*] Tab after keyword
| |
10 | True and False 11 | True and False
11 | #: E273 E274 12 | #: E273 E274
12 | True and False 13 | True and False
| ^ E273 | ^ E273
13 | #: E271 14 | #: E271
14 | a and b 15 | a and b
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
9 9 | #: E273 10 10 | #: E273
10 10 | True and False 11 11 | True and False
11 11 | #: E273 E274 12 12 | #: E273 E274
12 |-True and False 13 |-True and False
12 |+True and False 13 |+True and False
13 13 | #: E271 14 14 | #: E271
14 14 | a and b 15 15 | a and b
15 15 | #: E271 16 16 | #: E271
E27.py:26:6: E273 [*] Tab after keyword E27.py:27:6: E273 [*] Tab after keyword
| |
24 | this and False 25 | this and False
25 | #: E273 26 | #: E273
26 | a and b 27 | a and b
| ^^^ E273 | ^^^ E273
27 | #: E274 28 | #: E274
28 | a and b 29 | a and b
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
23 23 | #: E272 24 24 | #: E272
24 24 | this and False 25 25 | this and False
25 25 | #: E273 26 26 | #: E273
26 |-a and b 27 |-a and b
26 |+a and b 27 |+a and b
27 27 | #: E274 28 28 | #: E274
28 28 | a and b 29 29 | a and b
29 29 | #: E273 E274 30 30 | #: E273 E274
E27.py:30:10: E273 [*] Tab after keyword E27.py:31:10: E273 [*] Tab after keyword
| |
28 | a and b 29 | a and b
29 | #: E273 E274 30 | #: E273 E274
30 | this and False 31 | this and False
| ^ E273 | ^ E273
31 | #: Okay 32 | #: Okay
32 | from u import (a, b) 33 | from u import (a, b)
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
27 27 | #: E274 28 28 | #: E274
28 28 | a and b 29 29 | a and b
29 29 | #: E273 E274 30 30 | #: E273 E274
30 |-this and False 31 |-this and False
30 |+this and False 31 |+this and False
31 31 | #: Okay 32 32 | #: Okay
32 32 | from u import (a, b) 33 33 | from u import (a, b)
33 33 | from v import c, d 34 34 | from v import c, d
E27.py:73:5: E273 [*] Tab after keyword E27.py:74:5: E273 [*] Tab after keyword
| |
72 | #: E273 73 | #: E273
73 | type Number = int 74 | type Number = int
| ^^^^ E273 | ^^^^ E273
74 | 75 |
75 | #: E275 76 | #: E275
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
70 70 | type Number = int 71 71 | type Number = int
71 71 | 72 72 |
72 72 | #: E273 73 73 | #: E273
73 |-type Number = int 74 |-type Number = int
73 |+type Number = int 74 |+type Number = int
74 74 | 75 75 |
75 75 | #: E275 76 76 | #: E275
76 76 | match(foo): 77 77 | match(foo):

View File

@ -1,46 +1,44 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E27.py:28:2: E274 [*] Tab before keyword E27.py:29:2: E274 [*] Tab before keyword
| |
26 | a and b 27 | a and b
27 | #: E274 28 | #: E274
28 | a and b 29 | a and b
| ^^^^^^^ E274 | ^^^^^^^ E274
29 | #: E273 E274 30 | #: E273 E274
30 | this and False 31 | this and False
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
25 25 | #: E273 26 26 | #: E273
26 26 | a and b 27 27 | a and b
27 27 | #: E274 28 28 | #: E274
28 |-a and b 29 |-a and b
28 |+a and b 29 |+a and b
29 29 | #: E273 E274 30 30 | #: E273 E274
30 30 | this and False 31 31 | this and False
31 31 | #: Okay 32 32 | #: Okay
E27.py:30:5: E274 [*] Tab before keyword E27.py:31:5: E274 [*] Tab before keyword
| |
28 | a and b 29 | a and b
29 | #: E273 E274 30 | #: E273 E274
30 | this and False 31 | this and False
| ^^^^^^^^ E274 | ^^^^^^^^ E274
31 | #: Okay 32 | #: Okay
32 | from u import (a, b) 33 | from u import (a, b)
| |
= help: Replace with single space = help: Replace with single space
Safe fix Safe fix
27 27 | #: E274 28 28 | #: E274
28 28 | a and b 29 29 | a and b
29 29 | #: E273 E274 30 30 | #: E273 E274
30 |-this and False 31 |-this and False
30 |+this and False 31 |+this and False
31 31 | #: Okay 32 32 | #: Okay
32 32 | from u import (a, b) 33 33 | from u import (a, b)
33 33 | from v import c, d 34 34 | from v import c, d

View File

@ -1,144 +1,144 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E27.py:37:8: E275 [*] Missing whitespace after keyword E27.py:38:8: E275 [*] Missing whitespace after keyword
| |
35 | from w import (e, f) 36 | from w import (e, f)
36 | #: E275 37 | #: E275
37 | from w import(e, f) 38 | from w import(e, f)
| ^^^^^^ E275 | ^^^^^^ E275
38 | #: E275 39 | #: E275
39 | from importable.module import(e, f) 40 | from importable.module import(e, f)
| |
= help: Added missing whitespace after keyword = help: Added missing whitespace after keyword
Safe fix Safe fix
34 34 | #: E271 35 35 | #: E271
35 35 | from w import (e, f) 36 36 | from w import (e, f)
36 36 | #: E275 37 37 | #: E275
37 |-from w import(e, f) 38 |-from w import(e, f)
37 |+from w import (e, f) 38 |+from w import (e, f)
38 38 | #: E275 39 39 | #: E275
39 39 | from importable.module import(e, f) 40 40 | from importable.module import(e, f)
40 40 | #: E275 41 41 | #: E275
E27.py:39:24: E275 [*] Missing whitespace after keyword E27.py:40:24: E275 [*] Missing whitespace after keyword
| |
37 | from w import(e, f) 38 | from w import(e, f)
38 | #: E275 39 | #: E275
39 | from importable.module import(e, f) 40 | from importable.module import(e, f)
| ^^^^^^ E275 | ^^^^^^ E275
40 | #: E275 41 | #: E275
41 | try: 42 | try:
| |
= help: Added missing whitespace after keyword = help: Added missing whitespace after keyword
Safe fix Safe fix
36 36 | #: E275 37 37 | #: E275
37 37 | from w import(e, f) 38 38 | from w import(e, f)
38 38 | #: E275 39 39 | #: E275
39 |-from importable.module import(e, f) 40 |-from importable.module import(e, f)
39 |+from importable.module import (e, f) 40 |+from importable.module import (e, f)
40 40 | #: E275 41 41 | #: E275
41 41 | try: 42 42 | try:
42 42 | from importable.module import(e, f) 43 43 | from importable.module import(e, f)
E27.py:42:28: E275 [*] Missing whitespace after keyword E27.py:43:28: E275 [*] Missing whitespace after keyword
| |
40 | #: E275 41 | #: E275
41 | try: 42 | try:
42 | from importable.module import(e, f) 43 | from importable.module import(e, f)
| ^^^^^^ E275 | ^^^^^^ E275
43 | except ImportError: 44 | except ImportError:
44 | pass 45 | pass
| |
= help: Added missing whitespace after keyword = help: Added missing whitespace after keyword
Safe fix Safe fix
39 39 | from importable.module import(e, f) 40 40 | from importable.module import(e, f)
40 40 | #: E275 41 41 | #: E275
41 41 | try: 42 42 | try:
42 |- from importable.module import(e, f) 43 |- from importable.module import(e, f)
42 |+ from importable.module import (e, f) 43 |+ from importable.module import (e, f)
43 43 | except ImportError: 44 44 | except ImportError:
44 44 | pass 45 45 | pass
45 45 | #: E275 46 46 | #: E275
E27.py:46:1: E275 [*] Missing whitespace after keyword E27.py:47:1: E275 [*] Missing whitespace after keyword
| |
44 | pass 45 | pass
45 | #: E275 46 | #: E275
46 | if(foo): 47 | if(foo):
| ^^ E275 | ^^ E275
47 | pass 48 | pass
48 | else: 49 | else:
| |
= help: Added missing whitespace after keyword = help: Added missing whitespace after keyword
Safe fix Safe fix
43 43 | except ImportError: 44 44 | except ImportError:
44 44 | pass 45 45 | pass
45 45 | #: E275 46 46 | #: E275
46 |-if(foo): 47 |-if(foo):
46 |+if (foo): 47 |+if (foo):
47 47 | pass 48 48 | pass
48 48 | else: 49 49 | else:
49 49 | pass 50 50 | pass
E27.py:54:5: E275 [*] Missing whitespace after keyword E27.py:55:5: E275 [*] Missing whitespace after keyword
| |
52 | #: E275:2:11 53 | #: E275:2:11
53 | if True: 54 | if True:
54 | assert(1) 55 | assert(1)
| ^^^^^^ E275 | ^^^^^^ E275
55 | #: Okay 56 | #: Okay
56 | def f(): 57 | def f():
| |
= help: Added missing whitespace after keyword = help: Added missing whitespace after keyword
Safe fix Safe fix
51 51 | matched = {"true": True, "false": False} 52 52 | matched = {"true": True, "false": False}
52 52 | #: E275:2:11 53 53 | #: E275:2:11
53 53 | if True: 54 54 | if True:
54 |- assert(1) 55 |- assert(1)
54 |+ assert (1) 55 |+ assert (1)
55 55 | #: Okay 56 56 | #: Okay
56 56 | def f(): 57 57 | def f():
57 57 | print((yield)) 58 58 | print((yield))
E27.py:76:1: E275 [*] Missing whitespace after keyword E27.py:77:1: E275 [*] Missing whitespace after keyword
| |
75 | #: E275 76 | #: E275
76 | match(foo): 77 | match(foo):
| ^^^^^ E275 | ^^^^^ E275
77 | case(1): 78 | case(1):
78 | pass 79 | pass
| |
= help: Added missing whitespace after keyword = help: Added missing whitespace after keyword
Safe fix Safe fix
73 73 | type Number = int 74 74 | type Number = int
74 74 | 75 75 |
75 75 | #: E275 76 76 | #: E275
76 |-match(foo): 77 |-match(foo):
76 |+match (foo): 77 |+match (foo):
77 77 | case(1): 78 78 | case(1):
78 78 | pass 79 79 | pass
E27.py:77:5: E275 [*] Missing whitespace after keyword E27.py:78:5: E275 [*] Missing whitespace after keyword
| |
75 | #: E275 76 | #: E275
76 | match(foo): 77 | match(foo):
77 | case(1): 78 | case(1):
| ^^^^ E275 | ^^^^ E275
78 | pass 79 | pass
| |
= help: Added missing whitespace after keyword = help: Added missing whitespace after keyword
Safe fix Safe fix
74 74 | 75 75 |
75 75 | #: E275 76 76 | #: E275
76 76 | match(foo): 77 77 | match(foo):
77 |- case(1): 78 |- case(1):
77 |+ case (1): 78 |+ case (1):
78 78 | pass 79 79 | pass

View File

@ -1,101 +1,101 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E30.py:486:5: E301 [*] Expected 1 blank line, found 0 E30.py:478:5: E301 [*] Expected 1 blank line, found 0
| |
484 | def func1(): 476 | def func1():
485 | pass 477 | pass
486 | def func2(): 478 | def func2():
| ^^^ E301 | ^^^ E301
479 | pass
480 | # end
|
= help: Add missing blank line
Safe fix
475 475 |
476 476 | def func1():
477 477 | pass
478 |+
478 479 | def func2():
479 480 | pass
480 481 | # end
E30.py:489:5: E301 [*] Expected 1 blank line, found 0
|
487 | pass 487 | pass
488 | # end 488 | # comment
| 489 | def fn2():
= help: Add missing blank line
Safe fix
483 483 |
484 484 | def func1():
485 485 | pass
486 |+
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 | ^^^ E301
498 | pass 490 | pass
499 | # end 491 | # end
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
493 493 | 485 485 |
494 494 | def fn1(): 486 486 | def fn1():
495 495 | pass 487 487 | pass
496 |+ 488 |+
496 497 | # comment 488 489 | # comment
497 498 | def fn2(): 489 490 | def fn2():
498 499 | pass 490 491 | pass
E30.py:507:5: E301 [*] Expected 1 blank line, found 0 E30.py:499:5: E301 [*] Expected 1 blank line, found 0
| |
506 | columns = [] 498 | columns = []
507 | @classmethod 499 | @classmethod
| ^ E301 | ^ E301
508 | def cls_method(cls) -> None: 500 | def cls_method(cls) -> None:
509 | pass 501 | pass
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
504 504 | """Class for minimal repo.""" 496 496 | """Class for minimal repo."""
505 505 | 497 497 |
506 506 | columns = [] 498 498 | columns = []
507 |+ 499 |+
507 508 | @classmethod 499 500 | @classmethod
508 509 | def cls_method(cls) -> None: 500 501 | def cls_method(cls) -> None:
509 510 | pass 501 502 | pass
E30.py:519:5: E301 [*] Expected 1 blank line, found 0 E30.py:511:5: E301 [*] Expected 1 blank line, found 0
| |
517 | def method(cls) -> None: 509 | def method(cls) -> None:
518 | pass 510 | pass
519 | @classmethod 511 | @classmethod
| ^ E301 | ^ E301
520 | def cls_method(cls) -> None: 512 | def cls_method(cls) -> None:
521 | pass 513 | pass
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
516 516 | 508 508 |
517 517 | def method(cls) -> None: 509 509 | def method(cls) -> None:
518 518 | pass 510 510 | pass
519 |+ 511 |+
519 520 | @classmethod 511 512 | @classmethod
520 521 | def cls_method(cls) -> None: 512 513 | def cls_method(cls) -> None:
521 522 | pass 513 514 | pass
E30.py:534:5: E301 [*] Expected 1 blank line, found 0 E30.py:526:5: E301 [*] Expected 1 blank line, found 0
| |
532 | def bar(self, x: str) -> str: 524 | def bar(self, x: str) -> str:
533 | ... 525 | ...
534 | def bar(self, x: int | str) -> int | str: 526 | def bar(self, x: int | str) -> int | str:
| ^^^ E301 | ^^^ E301
535 | return x 527 | return x
536 | # end 528 | # end
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
531 531 | @overload 523 523 | @overload
532 532 | def bar(self, x: str) -> str: 524 524 | def bar(self, x: str) -> str:
533 533 | ... 525 525 | ...
534 |+ 526 |+
534 535 | def bar(self, x: int | str) -> int | str: 526 527 | def bar(self, x: int | str) -> int | str:
535 536 | return x 527 528 | return x
536 537 | # end 528 529 | # end

View File

@ -1,225 +1,225 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E30.py:541:1: E302 [*] Expected 2 blank lines, found 0 E30.py:533:1: E302 [*] Expected 2 blank lines, found 0
| |
539 | # E302 531 | # E302
540 | """Main module.""" 532 | """Main module."""
541 | def fn(): 533 | def fn():
| ^^^ E302 | ^^^ E302
542 | pass 534 | pass
543 | # end 535 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
538 538 | 530 530 |
539 539 | # E302 531 531 | # E302
540 540 | """Main module.""" 532 532 | """Main module."""
533 |+
534 |+
533 535 | def fn():
534 536 | pass
535 537 | # end
E30.py:540:1: E302 [*] Expected 2 blank lines, found 0
|
538 | # E302
539 | import sys
540 | def get_sys_path():
| ^^^ E302
541 | return sys.path
542 | # end
|
= help: Add missing blank line(s)
Safe fix
537 537 |
538 538 | # E302
539 539 | import sys
540 |+
541 |+ 541 |+
542 |+ 540 542 | def get_sys_path():
541 543 | def fn(): 541 543 | return sys.path
542 544 | pass 542 544 | # end
543 545 | # end
E30.py:548:1: E302 [*] Expected 2 blank lines, found 0 E30.py:549:1: E302 [*] Expected 2 blank lines, found 1
| |
546 | # E302 547 | pass
547 | import sys 548 |
548 | def get_sys_path(): 549 | def b():
| ^^^ E302 | ^^^ E302
549 | return sys.path 550 | pass
550 | # end 551 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
545 545 | 546 546 | def a():
546 546 | # E302 547 547 | pass
547 547 | import sys 548 548 |
548 |+
549 |+ 549 |+
548 550 | def get_sys_path(): 549 550 | def b():
549 551 | return sys.path 550 551 | pass
550 552 | # end 551 552 | # end
E30.py:557:1: E302 [*] Expected 2 blank lines, found 1 E30.py:560:1: E302 [*] Expected 2 blank lines, found 1
| |
555 | pass 558 | # comment
556 | 559 |
557 | def b(): 560 | def b():
| ^^^ E302 | ^^^ E302
558 | pass 561 | pass
559 | # end 562 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
554 554 | def a(): 557 557 |
555 555 | pass 558 558 | # comment
556 556 | 559 559 |
557 |+ 560 |+
557 558 | def b(): 560 561 | def b():
558 559 | pass 561 562 | pass
559 560 | # end 562 563 | # end
E30.py:568:1: E302 [*] Expected 2 blank lines, found 1 E30.py:569:1: E302 [*] Expected 2 blank lines, found 1
| |
566 | # comment 567 | pass
567 | 568 |
568 | def b(): 569 | async def b():
| ^^^^^ E302
570 | pass
571 | # end
|
= help: Add missing blank line(s)
Safe fix
566 566 | def a():
567 567 | pass
568 568 |
569 |+
569 570 | async def b():
570 571 | pass
571 572 | # end
E30.py:578:1: E302 [*] Expected 2 blank lines, found 1
|
576 | pass
577 |
578 | async def x(y: int = 1):
| ^^^^^ E302
579 | pass
580 | # end
|
= help: Add missing blank line(s)
Safe fix
575 575 | async def x():
576 576 | pass
577 577 |
578 |+
578 579 | async def x(y: int = 1):
579 580 | pass
580 581 | # end
E30.py:586:1: E302 [*] Expected 2 blank lines, found 0
|
584 | def bar():
585 | pass
586 | def baz(): pass
| ^^^ E302 | ^^^ E302
569 | pass 587 | # end
570 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
565 565 | 583 583 | # E302
566 566 | # comment 584 584 | def bar():
567 567 | 585 585 | pass
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 |+
586 587 | async def x(y: int = 1): 587 |+
587 588 | pass 586 588 | def baz(): pass
588 589 | # end 587 589 | # end
588 590 |
E30.py:594:1: E302 [*] Expected 2 blank lines, found 0 E30.py:592:1: E302 [*] Expected 2 blank lines, found 0
| |
592 | def bar(): 590 | # E302
591 | def bar(): pass
592 | def baz():
| ^^^ E302
593 | pass 593 | pass
594 | def baz(): pass 594 | # end
| ^^^ E302
595 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
591 591 | # E302 589 589 |
592 592 | def bar(): 590 590 | # E302
593 593 | pass 591 591 | def bar(): pass
594 |+ 592 |+
595 |+ 593 |+
594 596 | def baz(): pass 592 594 | def baz():
595 597 | # end 593 595 | pass
596 598 | 594 596 | # end
E30.py:600:1: E302 [*] Expected 2 blank lines, found 0 E30.py:602:1: E302 [*] Expected 2 blank lines, found 1
| |
598 | # E302 601 | # comment
599 | def bar(): pass 602 | @decorator
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
611 | def g(): 603 | def g():
612 | pass 604 | pass
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
606 606 | def f(): 598 598 | def f():
607 607 | pass 599 599 | pass
608 608 | 600 600 |
609 |+ 601 |+
610 |+ 602 |+
609 611 | # comment 601 603 | # comment
610 612 | @decorator 602 604 | @decorator
611 613 | def g(): 603 605 | def g():
E30.py:632:1: E302 [*] Expected 2 blank lines, found 0 E30.py:624:1: E302 [*] Expected 2 blank lines, found 0
| |
630 | # E302 622 | # E302
631 | class A:... 623 | class A:...
632 | class B: ... 624 | class B: ...
| ^^^^^ E302 | ^^^^^ E302
633 | # end 625 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
629 629 | 621 621 |
630 630 | # E302 622 622 | # E302
631 631 | class A:... 623 623 | class A:...
632 |+ 624 |+
633 |+ 625 |+
632 634 | class B: ... 624 626 | class B: ...
633 635 | # end 625 627 | # end
634 636 | 626 628 |
E30.py:642:1: E302 [*] Expected 2 blank lines, found 1 E30.py:634:1: E302 [*] Expected 2 blank lines, found 1
| |
640 | def fn(a: str) -> str: ... 632 | def fn(a: str) -> str: ...
641 | 633 |
642 | def fn(a: int | str) -> int | str: 634 | def fn(a: int | str) -> int | str:
| ^^^ E302 | ^^^ E302
643 | ... 635 | ...
644 | # end 636 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
639 639 | @overload 631 631 | @overload
640 640 | def fn(a: str) -> str: ... 632 632 | def fn(a: str) -> str: ...
641 641 | 633 633 |
642 |+ 634 |+
642 643 | def fn(a: int | str) -> int | str: 634 635 | def fn(a: int | str) -> int | str:
643 644 | ... 635 636 | ...
644 645 | # end 636 637 | # end

View File

@ -1,248 +1,248 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E30.py:625:2: E303 [*] Too many blank lines (2) E30.py:617:2: E303 [*] Too many blank lines (2)
| |
625 | def method2(): 617 | def method2():
| ^^^ E303 | ^^^ E303
626 | return 22 618 | return 22
627 | # end 619 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
621 621 | def method1(): 613 613 | def method1():
622 622 | return 1 614 614 | return 1
623 623 | 615 615 |
624 |- 616 |-
625 624 | def method2(): 617 616 | def method2():
626 625 | return 22 618 617 | return 22
627 626 | # end 619 618 | # end
E30.py:652:5: E303 [*] Too many blank lines (2) E30.py:644:5: E303 [*] Too many blank lines (2)
| |
652 | # arbitrary comment 644 | # arbitrary comment
| ^^^^^^^^^^^^^^^^^^^ E303 | ^^^^^^^^^^^^^^^^^^^ E303
653 | 645 |
654 | def inner(): # E306 not expected (pycodestyle detects E306) 646 | def inner(): # E306 not expected (pycodestyle detects E306)
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
648 648 | def fn(): 640 640 | def fn():
649 649 | _ = None 641 641 | _ = None
650 650 | 642 642 |
651 |- 643 |-
652 651 | # arbitrary comment 644 643 | # arbitrary comment
653 652 | 645 644 |
654 653 | def inner(): # E306 not expected (pycodestyle detects E306) 646 645 | def inner(): # E306 not expected (pycodestyle detects E306)
E30.py:664:5: E303 [*] Too many blank lines (2) E30.py:656:5: E303 [*] Too many blank lines (2)
| |
664 | # arbitrary comment 656 | # arbitrary comment
| ^^^^^^^^^^^^^^^^^^^ E303 | ^^^^^^^^^^^^^^^^^^^ E303
665 | def inner(): # E306 not expected (pycodestyle detects E306) 657 | def inner(): # E306 not expected (pycodestyle detects E306)
666 | pass 658 | pass
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
660 660 | def fn(): 652 652 | def fn():
661 661 | _ = None 653 653 | _ = None
662 662 | 654 654 |
663 |- 655 |-
664 663 | # arbitrary comment 656 655 | # arbitrary comment
665 664 | def inner(): # E306 not expected (pycodestyle detects E306) 657 656 | def inner(): # E306 not expected (pycodestyle detects E306)
666 665 | pass 658 657 | pass
E30.py:675:1: E303 [*] Too many blank lines (3) E30.py:667:1: E303 [*] Too many blank lines (3)
| |
675 | print() 667 | print()
| ^^^^^ E303 | ^^^^^ E303
676 | # end 668 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
671 671 | print() 663 663 | print()
672 672 | 664 664 |
673 673 | 665 665 |
674 |- 666 |-
675 674 | print() 667 666 | print()
676 675 | # end 668 667 | # end
677 676 | 669 668 |
E30.py:684:1: E303 [*] Too many blank lines (3) E30.py:676:1: E303 [*] Too many blank lines (3)
| |
684 | # comment 676 | # comment
| ^^^^^^^^^ E303 | ^^^^^^^^^ E303
685 | 677 |
686 | print() 678 | print()
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
680 680 | print() 672 672 | print()
681 681 | 673 673 |
682 682 | 674 674 |
683 |- 675 |-
684 683 | # comment 676 675 | # comment
685 684 | 677 676 |
686 685 | print() 678 677 | print()
E30.py:695:5: E303 [*] Too many blank lines (2) E30.py:687:5: E303 [*] Too many blank lines (2)
| |
695 | # comment 687 | # comment
| ^^^^^^^^^ E303 | ^^^^^^^^^ E303
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
691 691 | def a(): 683 683 | def a():
692 692 | print() 684 684 | print()
693 693 | 685 685 |
694 |- 686 |-
695 694 | # comment 687 686 | # comment
696 695 | 688 687 |
697 696 | 689 688 |
E30.py:698:5: E303 [*] Too many blank lines (2) E30.py:690:5: E303 [*] Too many blank lines (2)
| |
698 | # another comment 690 | # another comment
| ^^^^^^^^^^^^^^^^^ E303 | ^^^^^^^^^^^^^^^^^ E303
699 | 691 |
700 | print() 692 | print()
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
694 694 | 686 686 |
695 695 | # comment 687 687 | # comment
696 696 | 688 688 |
697 |- 689 |-
698 697 | # another comment 690 689 | # another comment
699 698 | 691 690 |
700 699 | print() 692 691 | print()
E30.py:709:1: E303 [*] Too many blank lines (3) E30.py:701:1: E303 [*] Too many blank lines (3)
| |
709 | / """This class docstring comes on line 5. 701 | / """This class docstring comes on line 5.
710 | | It gives error E303: too many blank lines (3) 702 | | It gives error E303: too many blank lines (3)
711 | | """ 703 | | """
| |___^ E303 | |___^ E303
712 | # end 704 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
705 705 | #!python 697 697 | #!python
706 706 | 698 698 |
707 707 | 699 699 |
708 |- 700 |-
709 708 | """This class docstring comes on line 5. 701 700 | """This class docstring comes on line 5.
710 709 | It gives error E303: too many blank lines (3) 702 701 | It gives error E303: too many blank lines (3)
711 710 | """ 703 702 | """
E30.py:721:5: E303 [*] Too many blank lines (2) E30.py:713:5: E303 [*] Too many blank lines (2)
| |
721 | def b(self): 713 | def b(self):
| ^^^ E303 | ^^^ E303
722 | pass 714 | pass
723 | # end 715 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
717 717 | def a(self): 709 709 | def a(self):
718 718 | pass 710 710 | pass
719 719 | 711 711 |
720 |- 712 |-
721 720 | def b(self): 713 712 | def b(self):
722 721 | pass 714 713 | pass
723 722 | # end 715 714 | # end
E30.py:723:5: E303 [*] Too many blank lines (2)
|
723 | a = 2
| ^ E303
724 | # end
|
= help: Remove extraneous blank line(s)
Safe fix
719 719 | if True:
720 720 | a = 1
721 721 |
722 |-
723 722 | a = 2
724 723 | # end
725 724 |
E30.py:731:5: E303 [*] Too many blank lines (2) E30.py:731:5: E303 [*] Too many blank lines (2)
| |
731 | a = 2 731 | # comment
| ^ 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 | ^^^^^^^^^ E303
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
735 735 | # E303 727 727 | # E303
736 736 | class Test: 728 728 | class Test:
737 737 | 729 729 |
738 |- 730 |-
739 738 | # comment 731 730 | # comment
740 739 | 732 731 |
741 740 | 733 732 |
E30.py:742:5: E303 [*] Too many blank lines (2) E30.py:734:5: E303 [*] Too many blank lines (2)
| |
742 | # another comment 734 | # another comment
| ^^^^^^^^^^^^^^^^^ E303 | ^^^^^^^^^^^^^^^^^ E303
743 | 735 |
744 | def test(self): pass 736 | def test(self): pass
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
738 738 | 730 730 |
739 739 | # comment 731 731 | # comment
740 740 | 732 732 |
741 |- 733 |-
742 741 | # another comment 734 733 | # another comment
743 742 | 735 734 |
744 743 | def test(self): pass 736 735 | def test(self): pass
E30.py:756:5: E303 [*] Too many blank lines (2) E30.py:748:5: E303 [*] Too many blank lines (2)
| |
756 | def b(self): 748 | def b(self):
| ^^^ E303 | ^^^ E303
757 | pass 749 | pass
758 | # end 750 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
752 752 | 744 744 |
753 753 | # wrongly indented comment 745 745 | # wrongly indented comment
754 754 | 746 746 |
755 |- 747 |-
756 755 | def b(self): 748 747 | def b(self):
757 756 | pass 749 748 | pass
758 757 | # end 750 749 | # end
E30.py:766:5: E303 [*] Too many blank lines (2) E30.py:758:5: E303 [*] Too many blank lines (2)
| |
766 | pass 758 | pass
| ^^^^ E303 | ^^^^ E303
767 | # end 759 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
762 762 | def fn(): 754 754 | def fn():
763 763 | pass 755 755 | pass
764 764 | 756 756 |
765 |- 757 |-
766 765 | pass 758 757 | pass
767 766 | # end 759 758 | # end
768 767 | 760 759 |

View File

@ -1,14 +1,33 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E30.py:773:1: E304 [*] Blank lines found after function decorator (1) E30.py:765:1: E304 [*] Blank lines found after function decorator (1)
| |
771 | @decorator 763 | @decorator
772 | 764 |
773 | def function(): 765 | def function():
| ^^^ E304 | ^^^ E304
774 | pass 766 | pass
775 | # end 767 | # end
|
= help: Remove extraneous blank line(s)
Safe fix
761 761 |
762 762 | # E304
763 763 | @decorator
764 |-
765 764 | def function():
766 765 | pass
767 766 | # end
E30.py:774:1: E304 [*] Blank lines found after function decorator (1)
|
773 | # comment E304 not expected
774 | def function():
| ^^^ E304
775 | pass
776 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
@ -17,47 +36,28 @@ E30.py:773:1: E304 [*] Blank lines found after function decorator (1)
770 770 | # E304 770 770 | # E304
771 771 | @decorator 771 771 | @decorator
772 |- 772 |-
773 772 | def function(): 773 772 | # comment E304 not expected
774 773 | pass 774 773 | def function():
775 774 | # end 775 774 | pass
E30.py:782:1: E304 [*] Blank lines found after function decorator (1) E30.py:786:1: E304 [*] Blank lines found after function decorator (2)
| |
781 | # comment E304 not expected 785 | # second comment E304 not expected
782 | def function(): 786 | def function():
| ^^^ E304 | ^^^ E304
783 | pass 787 | pass
784 | # end 788 | # end
| |
= help: Remove extraneous blank line(s) = help: Remove extraneous blank line(s)
Safe fix Safe fix
777 777 | 778 778 |
778 778 | # E304 779 779 | # E304
779 779 | @decorator 780 780 | @decorator
780 |- 781 |-
781 780 | # comment E304 not expected 782 781 | # comment E304 not expected
782 781 | def function(): 783 |-
783 782 | pass 784 |-
785 782 | # second comment E304 not expected
E30.py:794:1: E304 [*] Blank lines found after function decorator (2) 786 783 | def function():
| 787 784 | pass
793 | # second comment E304 not expected
794 | def function():
| ^^^ E304
795 | pass
796 | # end
|
= help: Remove extraneous blank line(s)
Safe fix
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

View File

@ -1,100 +1,100 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E30.py:806:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
| |
805 | # another comment 797 | # another comment
806 | fn() 798 | fn()
| ^^ E305 | ^^ E305
807 | # end 799 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
803 803 | # comment 795 795 | # comment
804 804 | 796 796 |
805 805 | # another comment 797 797 | # another comment
806 |+ 798 |+
807 |+ 799 |+
806 808 | fn() 798 800 | fn()
807 809 | # end 799 801 | # end
808 810 | 800 802 |
E30.py:817:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
| |
816 | # another comment 808 | # another comment
817 | a = 1 809 | a = 1
| ^ E305 | ^ E305
818 | # end 810 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
814 814 | # comment 806 806 | # comment
815 815 | 807 807 |
816 816 | # another comment 808 808 | # another comment
817 |+ 809 |+
818 |+ 810 |+
817 819 | a = 1 809 811 | a = 1
818 820 | # end 810 812 | # end
819 821 | 811 813 |
E30.py:829:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
| |
827 | # another comment 819 | # another comment
828 | 820 |
829 | try: 821 | try:
| ^^^ E305 | ^^^ E305
830 | fn() 822 | fn()
831 | except Exception: 823 | except Exception:
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
826 826 | 818 818 |
827 827 | # another comment 819 819 | # another comment
828 828 | 820 820 |
829 |+ 821 |+
829 830 | try: 821 822 | try:
830 831 | fn() 822 823 | fn()
831 832 | except Exception: 823 824 | except Exception:
E30.py:841:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
| |
840 | # Two spaces before comments, too. 832 | # Two spaces before comments, too.
841 | if a(): 833 | if a():
| ^^ E305 | ^^ E305
842 | a() 834 | a()
843 | # end 835 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
838 838 | print() 830 830 | print()
839 839 | 831 831 |
840 840 | # Two spaces before comments, too. 832 832 | # Two spaces before comments, too.
841 |+ 833 |+
842 |+ 834 |+
841 843 | if a(): 833 835 | if a():
842 844 | a() 834 836 | a()
843 845 | # end 835 837 | # end
E30.py:854:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition, found (1)
| |
852 | blah, blah 844 | blah, blah
853 | 845 |
854 | if __name__ == '__main__': 846 | if __name__ == '__main__':
| ^^ E305 | ^^ E305
855 | main() 847 | main()
856 | # end 848 | # end
| |
= help: Add missing blank line(s) = help: Add missing blank line(s)
Safe fix Safe fix
851 851 | def main(): 843 843 | def main():
852 852 | blah, blah 844 844 | blah, blah
853 853 | 845 845 |
854 |+ 846 |+
854 855 | if __name__ == '__main__': 846 847 | if __name__ == '__main__':
855 856 | main() 847 848 | main()
856 857 | # end 848 849 | # end

View File

@ -1,9 +1,29 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
--- ---
E30.py:854:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
852 | def a():
853 | x = 1
854 | def b():
| ^^^ E306
855 | pass
856 | # end
|
= help: Add missing blank line
Safe fix
851 851 | # E306:3:5
852 852 | def a():
853 853 | x = 1
854 |+
854 855 | def b():
855 856 | pass
856 857 | # end
E30.py:862: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
| |
860 | def a(): 860 | async def a():
861 | x = 1 861 | x = 1
862 | def b(): 862 | def b():
| ^^^ E306 | ^^^ E306
@ -13,8 +33,8 @@ E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
859 859 | # E306:3:5 859 859 | #: E306:3:5
860 860 | def a(): 860 860 | async def a():
861 861 | x = 1 861 861 | x = 1
862 |+ 862 |+
862 863 | def b(): 862 863 | def b():
@ -23,199 +43,179 @@ E30.py:862: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 E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0
| |
868 | async def a(): 868 | def a():
869 | x = 1 869 | x = 2
870 | def b(): 870 | def b():
| ^^^ E306 | ^^^ E306
871 | pass 871 | x = 1
872 | # end 872 | def c():
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
867 867 | #: E306:3:5 867 867 | #: E306:3:5 E306:5:9
868 868 | async def a(): 868 868 | def a():
869 869 | x = 1 869 869 | x = 2
870 |+ 870 |+
870 871 | def b(): 870 871 | def b():
871 872 | pass 871 872 | x = 1
872 873 | # end 872 873 | def c():
E30.py:878:5: E306 [*] Expected 1 blank line before a nested definition, found 0 E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0
| |
876 | def a(): 870 | def b():
877 | x = 2 871 | x = 1
878 | def b(): 872 | def c():
| ^^^ E306
879 | x = 1
880 | def c():
|
= help: Add missing blank line
Safe fix
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:880:9: E306 [*] Expected 1 blank line before a nested definition, found 0
|
878 | def b():
879 | x = 1
880 | def c():
| ^^^ E306 | ^^^ E306
881 | pass 873 | pass
882 | # end 874 | # end
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
877 877 | x = 2 869 869 | x = 2
878 878 | def b(): 870 870 | def b():
879 879 | x = 1 871 871 | x = 1
880 |+ 872 |+
880 881 | def c(): 872 873 | def c():
881 882 | pass 873 874 | pass
882 883 | # end 874 875 | # end
E30.py:888:5: E306 [*] Expected 1 blank line before a nested definition, found 0 E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0
| |
886 | def a(): 878 | def a():
887 | x = 1 879 | x = 1
888 | class C: 880 | class C:
| ^^^^^ E306 | ^^^^^ E306
889 | pass 881 | pass
890 | x = 2 882 | x = 2
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
885 885 | # E306:3:5 E306:6:5 877 877 | # E306:3:5 E306:6:5
886 886 | def a(): 878 878 | def a():
887 887 | x = 1 879 879 | x = 1
888 |+ 880 |+
888 889 | class C: 880 881 | class C:
889 890 | pass 881 882 | pass
890 891 | x = 2 882 883 | x = 2
E30.py:891:5: E306 [*] Expected 1 blank line before a nested definition, found 0 E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0
| |
889 | pass 881 | pass
890 | x = 2 882 | x = 2
891 | def b(): 883 | def b():
| ^^^ E306
884 | pass
885 | # end
|
= help: Add missing blank line
Safe fix
880 880 | class C:
881 881 | pass
882 882 | x = 2
883 |+
883 884 | def b():
884 885 | pass
885 886 | # end
E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
890 | def bar():
891 | pass
892 | def baz(): pass
| ^^^ E306 | ^^^ E306
892 | pass
893 | # end 893 | # end
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
888 888 | class C: 889 889 | def foo():
889 889 | pass 890 890 | def bar():
890 890 | x = 2 891 891 | pass
891 |+ 892 |+
891 892 | def b(): 892 893 | def baz(): pass
892 893 | pass
893 894 | # end 893 894 | # end
894 895 |
E30.py:900:5: E306 [*] Expected 1 blank line before a nested definition, found 0 E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0
| |
898 | def bar(): 897 | def foo():
899 | pass 898 | def bar(): pass
900 | def baz(): pass 899 | def baz():
| ^^^ E306 | ^^^ E306
900 | pass
901 | # end 901 | # end
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
896 896 | # E306:3:5
897 897 | def foo(): 897 897 | def foo():
898 898 | def bar(): 898 898 | def bar(): pass
899 899 | pass 899 |+
900 |+ 899 900 | def baz():
900 901 | def baz(): pass 900 901 | pass
901 902 | # end 901 902 | # end
902 903 |
E30.py:907: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
| |
905 | def foo(): 905 | def a():
906 | def bar(): pass 906 | x = 2
907 | def baz(): 907 | @decorator
| ^^^ E306 | ^ E306
908 | pass 908 | def b():
909 | # end 909 | pass
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
904 904 | # E306:3:5 904 904 | # E306
905 905 | def foo(): 905 905 | def a():
906 906 | def bar(): pass 906 906 | x = 2
907 |+ 907 |+
907 908 | def baz(): 907 908 | @decorator
908 909 | pass 908 909 | def b():
909 910 | # end 909 910 | pass
E30.py:915:5: E306 [*] Expected 1 blank line before a nested definition, found 0 E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0
| |
913 | def a(): 914 | def a():
914 | x = 2 915 | x = 2
915 | @decorator 916 | @decorator
| ^ E306 | ^ E306
916 | def b(): 917 | async def b():
917 | pass 918 | pass
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
912 912 | # E306 913 913 | # E306
913 913 | def a(): 914 914 | def a():
914 914 | x = 2 915 915 | x = 2
915 |+ 916 |+
915 916 | @decorator 916 917 | @decorator
916 917 | def b(): 917 918 | async def b():
917 918 | pass 918 919 | pass
E30.py:924:5: E306 [*] Expected 1 blank line before a nested definition, found 0 E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0
| |
922 | def a(): 923 | def a():
923 | x = 2 924 | x = 2
924 | @decorator
| ^ E306
925 | async def b(): 925 | async def b():
| ^^^^^ E306
926 | pass 926 | pass
927 | # end
| |
= help: Add missing blank line = help: Add missing blank line
Safe fix Safe fix
921 921 | # E306 922 922 | # E306
922 922 | def a(): 923 923 | def a():
923 923 | x = 2 924 924 | x = 2
924 |+ 925 |+
924 925 | @decorator
925 926 | async def b(): 925 926 | async def b():
926 927 | pass 926 927 | pass
927 928 | # end
E30.py:933:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
931 | def a():
932 | x = 2
933 | async def b():
| ^^^^^ E306
934 | pass
935 | # end
|
= help: Add missing blank line
Safe fix
930 930 | # E306
931 931 | def a():
932 932 | x = 2
933 |+
933 934 | async def b():
934 935 | pass
935 936 | # end

View File

@ -178,7 +178,7 @@ W19.py:76:1: W191 Indentation contains tabs
| |
74 | foo.bar("bop") 74 | foo.bar("bop")
75 | )): 75 | )):
76 | print "yes" 76 | print("yes")
| ^^^^ W191 | ^^^^ W191
77 | #: E101 W191 W504 77 | #: E101 W191 W504
78 | # also ok, but starting to look like LISP 78 | # also ok, but starting to look like LISP
@ -188,7 +188,7 @@ W19.py:81:1: W191 Indentation contains tabs
| |
79 | if ((foo.bar("baz") and 79 | if ((foo.bar("baz") and
80 | foo.bar("bop"))): 80 | foo.bar("bop"))):
81 | print "yes" 81 | print("yes")
| ^^^^ W191 | ^^^^ W191
82 | #: E101 W191 W504 82 | #: E101 W191 W504
83 | if (a == 2 or 83 | if (a == 2 or
@ -364,5 +364,3 @@ W19.py:161:1: W191 Indentation contains tabs
| ^^^^ W191 | ^^^^ W191
162 | } <- this tab is fine""" 162 | } <- this tab is fine"""
| |