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,
)
foo = 3,
foo = 3,
class A(object):
foo = 3
@ -443,13 +443,13 @@ multiline_index_access[
]
multiline_index_access[
lambda fine,
fine,
fine: (0,)
lambda fine1,
fine2,
fine3: (0,)
:
lambda fine,
fine,
fine: (0,),
lambda fine1,
fine2,
fine3: (0,),
"fine"
:
"fine",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,67 +1,65 @@
---
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 | #: E271 E272
20 | 1 and b
19 | a and 2
20 | #: E271 E272
21 | 1 and b
| ^^ E272
21 | #: E271 E272
22 | a and 2
22 | #: E271 E272
23 | a and 2
|
= help: Replace with single space
Safe fix
17 17 | #: E271
18 18 | a and 2
19 19 | #: E271 E272
20 |-1 and b
20 |+1 and b
21 21 | #: E271 E272
22 22 | a and 2
23 23 | #: E272
18 18 | #: E271
19 19 | a and 2
20 20 | #: E271 E272
21 |-1 and b
21 |+1 and b
22 22 | #: E271 E272
23 23 | a and 2
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 | #: E271 E272
22 | a and 2
21 | 1 and b
22 | #: E271 E272
23 | a and 2
| ^^ E272
23 | #: E272
24 | this and False
24 | #: E272
25 | this and False
|
= help: Replace with single space
Safe fix
19 19 | #: E271 E272
20 20 | 1 and b
21 21 | #: E271 E272
22 |-a and 2
22 |+a and 2
23 23 | #: E272
24 24 | this and False
25 25 | #: E273
20 20 | #: E271 E272
21 21 | 1 and b
22 22 | #: E271 E272
23 |-a and 2
23 |+a and 2
24 24 | #: E272
25 25 | this and False
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 | #: E272
24 | this and False
23 | a and 2
24 | #: E272
25 | this and False
| ^^ E272
25 | #: E273
26 | a and b
26 | #: E273
27 | a and b
|
= help: Replace with single space
Safe fix
21 21 | #: E271 E272
22 22 | a and 2
23 23 | #: E272
24 |-this and False
24 |+this and False
25 25 | #: E273
26 26 | a and b
27 27 | #: E274
22 22 | #: E271 E272
23 23 | a and 2
24 24 | #: E272
25 |-this and False
25 |+this and False
26 26 | #: E273
27 27 | a and b
28 28 | #: E274

View file

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

View file

@ -1,46 +1,44 @@
---
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 | #: E274
28 | a and b
27 | a and b
28 | #: E274
29 | a and b
| ^^^^^^^ E274
29 | #: E273 E274
30 | this and False
30 | #: E273 E274
31 | this and False
|
= help: Replace with single space
Safe fix
25 25 | #: E273
26 26 | a and b
27 27 | #: E274
28 |-a and b
28 |+a and b
29 29 | #: E273 E274
30 30 | this and False
31 31 | #: Okay
26 26 | #: E273
27 27 | a and b
28 28 | #: E274
29 |-a and b
29 |+a and b
30 30 | #: E273 E274
31 31 | this and False
32 32 | #: Okay
E27.py:30:5: E274 [*] Tab before keyword
E27.py:31:5: E274 [*] Tab before keyword
|
28 | a and b
29 | #: E273 E274
30 | this and False
29 | a and b
30 | #: E273 E274
31 | this and False
| ^^^^^^^^ E274
31 | #: Okay
32 | from u import (a, b)
32 | #: Okay
33 | from u import (a, b)
|
= help: Replace with single space
Safe fix
27 27 | #: E274
28 28 | a and b
29 29 | #: E273 E274
30 |-this and False
30 |+this and False
31 31 | #: Okay
32 32 | from u import (a, b)
33 33 | from v import c, d
28 28 | #: E274
29 29 | a and b
30 30 | #: E273 E274
31 |-this and False
31 |+this and False
32 32 | #: Okay
33 33 | from u import (a, b)
34 34 | from v import c, d

View file

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

View file

@ -1,101 +1,101 @@
---
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():
485 | pass
486 | def func2():
476 | def func1():
477 | pass
478 | def func2():
| ^^^ 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
488 | # end
|
= 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():
488 | # comment
489 | def fn2():
| ^^^ E301
498 | pass
499 | # end
490 | pass
491 | # 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
485 485 |
486 486 | def fn1():
487 487 | pass
488 |+
488 489 | # comment
489 490 | def fn2():
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 = []
507 | @classmethod
498 | columns = []
499 | @classmethod
| ^ E301
508 | def cls_method(cls) -> None:
509 | pass
500 | def cls_method(cls) -> None:
501 | 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
496 496 | """Class for minimal repo."""
497 497 |
498 498 | columns = []
499 |+
499 500 | @classmethod
500 501 | def cls_method(cls) -> None:
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:
518 | pass
519 | @classmethod
509 | def method(cls) -> None:
510 | pass
511 | @classmethod
| ^ E301
520 | def cls_method(cls) -> None:
521 | pass
512 | def cls_method(cls) -> None:
513 | 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
508 508 |
509 509 | def method(cls) -> None:
510 510 | pass
511 |+
511 512 | @classmethod
512 513 | def cls_method(cls) -> None:
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:
533 | ...
534 | def bar(self, x: int | str) -> int | str:
524 | def bar(self, x: str) -> str:
525 | ...
526 | def bar(self, x: int | str) -> int | str:
| ^^^ E301
535 | return x
536 | # end
527 | return x
528 | # 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
523 523 | @overload
524 524 | def bar(self, x: str) -> str:
525 525 | ...
526 |+
526 527 | def bar(self, x: int | str) -> int | str:
527 528 | return x
528 529 | # end

View file

@ -1,225 +1,225 @@
---
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
540 | """Main module."""
541 | def fn():
531 | # E302
532 | """Main module."""
533 | def fn():
| ^^^ E302
542 | pass
543 | # end
534 | pass
535 | # end
|
= help: Add missing blank line(s)
Safe fix
538 538 |
539 539 | # E302
540 540 | """Main module."""
530 530 |
531 531 | # E302
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 |+
542 |+
541 543 | def fn():
542 544 | pass
543 545 | # end
540 542 | def get_sys_path():
541 543 | return sys.path
542 544 | # 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 | import sys
548 | def get_sys_path():
547 | pass
548 |
549 | def b():
| ^^^ E302
549 | return sys.path
550 | # end
550 | pass
551 | # end
|
= help: Add missing blank line(s)
Safe fix
545 545 |
546 546 | # E302
547 547 | import sys
548 |+
546 546 | def a():
547 547 | pass
548 548 |
549 |+
548 550 | def get_sys_path():
549 551 | return sys.path
550 552 | # end
549 550 | def b():
550 551 | pass
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
556 |
557 | def b():
558 | # comment
559 |
560 | def b():
| ^^^ E302
558 | pass
559 | # end
561 | pass
562 | # end
|
= help: Add missing blank line(s)
Safe fix
554 554 | def a():
555 555 | pass
556 556 |
557 |+
557 558 | def b():
558 559 | pass
559 560 | # end
557 557 |
558 558 | # comment
559 559 |
560 |+
560 561 | def b():
561 562 | pass
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 |
568 | def b():
567 | pass
568 |
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
569 | pass
570 | # end
587 | # 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 |
583 583 | # E302
584 584 | def bar():
585 585 | pass
586 |+
586 587 | async def x(y: int = 1):
587 588 | pass
588 589 | # end
587 |+
586 588 | def baz(): pass
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
594 | def baz(): pass
| ^^^ E302
595 | # end
594 | # 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 |
589 589 |
590 590 | # E302
591 591 | def bar(): pass
592 |+
593 |+
592 594 | def baz():
593 595 | pass
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
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
601 | # comment
602 | @decorator
| ^ E302
611 | def g():
612 | pass
603 | def g():
604 | pass
|
= help: Add missing blank line(s)
Safe fix
606 606 | def f():
607 607 | pass
608 608 |
609 |+
610 |+
609 611 | # comment
610 612 | @decorator
611 613 | def g():
598 598 | def f():
599 599 | pass
600 600 |
601 |+
602 |+
601 603 | # comment
602 604 | @decorator
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
631 | class A:...
632 | class B: ...
622 | # E302
623 | class A:...
624 | class B: ...
| ^^^^^ E302
633 | # end
625 | # 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 |
621 621 |
622 622 | # E302
623 623 | class A:...
624 |+
625 |+
624 626 | class B: ...
625 627 | # end
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: ...
641 |
642 | def fn(a: int | str) -> int | str:
632 | def fn(a: str) -> str: ...
633 |
634 | def fn(a: int | str) -> int | str:
| ^^^ E302
643 | ...
644 | # end
635 | ...
636 | # 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
631 631 | @overload
632 632 | def fn(a: str) -> str: ...
633 633 |
634 |+
634 635 | def fn(a: int | str) -> int | str:
635 636 | ...
636 637 | # end

View file

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

View file

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

View file

@ -1,100 +1,100 @@
---
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
806 | fn()
797 | # another comment
798 | fn()
| ^^ E305
807 | # end
799 | # end
|
= help: Add missing blank line(s)
Safe fix
803 803 | # comment
804 804 |
805 805 | # another comment
806 |+
807 |+
806 808 | fn()
807 809 | # end
808 810 |
795 795 | # comment
796 796 |
797 797 | # another comment
798 |+
799 |+
798 800 | fn()
799 801 | # end
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
817 | a = 1
808 | # another comment
809 | a = 1
| ^ E305
818 | # end
810 | # end
|
= help: Add missing blank line(s)
Safe fix
814 814 | # comment
815 815 |
816 816 | # another comment
817 |+
818 |+
817 819 | a = 1
818 820 | # end
819 821 |
806 806 | # comment
807 807 |
808 808 | # another comment
809 |+
810 |+
809 811 | a = 1
810 812 | # end
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
828 |
829 | try:
819 | # another comment
820 |
821 | try:
| ^^^ E305
830 | fn()
831 | except Exception:
822 | fn()
823 | except Exception:
|
= help: Add missing blank line(s)
Safe fix
826 826 |
827 827 | # another comment
828 828 |
829 |+
829 830 | try:
830 831 | fn()
831 832 | except Exception:
818 818 |
819 819 | # another comment
820 820 |
821 |+
821 822 | try:
822 823 | fn()
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.
841 | if a():
832 | # Two spaces before comments, too.
833 | if a():
| ^^ E305
842 | a()
843 | # end
834 | a()
835 | # end
|
= help: Add missing blank line(s)
Safe fix
838 838 | print()
839 839 |
840 840 | # Two spaces before comments, too.
841 |+
842 |+
841 843 | if a():
842 844 | a()
843 845 | # end
830 830 | print()
831 831 |
832 832 | # Two spaces before comments, too.
833 |+
834 |+
833 835 | if a():
834 836 | a()
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
853 |
854 | if __name__ == '__main__':
844 | blah, blah
845 |
846 | if __name__ == '__main__':
| ^^ E305
855 | main()
856 | # end
847 | main()
848 | # end
|
= help: Add missing blank line(s)
Safe fix
851 851 | def main():
852 852 | blah, blah
853 853 |
854 |+
854 855 | if __name__ == '__main__':
855 856 | main()
856 857 | # end
843 843 | def main():
844 844 | blah, blah
845 845 |
846 |+
846 847 | if __name__ == '__main__':
847 848 | main()
848 849 | # end

View file

@ -1,9 +1,29 @@
---
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
|
860 | def a():
860 | async def a():
861 | x = 1
862 | def b():
| ^^^ 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
Safe fix
859 859 | # E306:3:5
860 860 | def a():
859 859 | #: E306:3:5
860 860 | async def a():
861 861 | x = 1
862 |+
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
|
868 | async def a():
869 | x = 1
868 | def a():
869 | x = 2
870 | def b():
| ^^^ E306
871 | pass
872 | # end
871 | x = 1
872 | def c():
|
= help: Add missing blank line
Safe fix
867 867 | #: E306:3:5
868 868 | async def a():
869 869 | x = 1
867 867 | #: E306:3:5 E306:5:9
868 868 | def a():
869 869 | x = 2
870 |+
870 871 | def b():
871 872 | pass
872 873 | # end
871 872 | x = 1
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():
877 | x = 2
878 | def b():
| ^^^ 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():
870 | def b():
871 | x = 1
872 | def c():
| ^^^ E306
881 | pass
882 | # end
873 | pass
874 | # end
|
= help: Add missing blank line
Safe fix
877 877 | x = 2
878 878 | def b():
879 879 | x = 1
880 |+
880 881 | def c():
881 882 | pass
882 883 | # end
869 869 | x = 2
870 870 | def b():
871 871 | x = 1
872 |+
872 873 | def c():
873 874 | pass
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():
887 | x = 1
888 | class C:
878 | def a():
879 | x = 1
880 | class C:
| ^^^^^ E306
889 | pass
890 | x = 2
881 | pass
882 | x = 2
|
= help: Add missing blank line
Safe fix
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
877 877 | # E306:3:5 E306:6:5
878 878 | def a():
879 879 | x = 1
880 |+
880 881 | class C:
881 882 | pass
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
890 | x = 2
891 | def b():
881 | pass
882 | x = 2
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
892 | pass
893 | # end
|
= help: Add missing blank line
Safe fix
888 888 | class C:
889 889 | pass
890 890 | x = 2
891 |+
891 892 | def b():
892 893 | pass
889 889 | def foo():
890 890 | def bar():
891 891 | pass
892 |+
892 893 | def baz(): pass
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():
899 | pass
900 | def baz(): pass
897 | def foo():
898 | def bar(): pass
899 | def baz():
| ^^^ E306
900 | pass
901 | # end
|
= help: Add missing blank line
Safe fix
896 896 | # E306:3:5
897 897 | def foo():
898 898 | def bar():
899 899 | pass
900 |+
900 901 | def baz(): pass
898 898 | def bar(): pass
899 |+
899 900 | def baz():
900 901 | pass
901 902 | # end
902 903 |
E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0
|
905 | def foo():
906 | def bar(): pass
907 | def baz():
| ^^^ E306
908 | pass
909 | # end
905 | def a():
906 | x = 2
907 | @decorator
| ^ E306
908 | def b():
909 | pass
|
= help: Add missing blank line
Safe fix
904 904 | # E306:3:5
905 905 | def foo():
906 906 | def bar(): pass
904 904 | # E306
905 905 | def a():
906 906 | x = 2
907 |+
907 908 | def baz():
908 909 | pass
909 910 | # end
907 908 | @decorator
908 909 | def b():
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 | x = 2
915 | @decorator
914 | def a():
915 | x = 2
916 | @decorator
| ^ E306
916 | def b():
917 | pass
917 | async def b():
918 | pass
|
= help: Add missing blank line
Safe fix
912 912 | # E306
913 913 | def a():
914 914 | x = 2
915 |+
915 916 | @decorator
916 917 | def b():
917 918 | pass
913 913 | # E306
914 914 | def a():
915 915 | x = 2
916 |+
916 917 | @decorator
917 918 | async def b():
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 | x = 2
924 | @decorator
| ^ E306
923 | def a():
924 | x = 2
925 | async def b():
| ^^^^^ E306
926 | pass
927 | # end
|
= help: Add missing blank line
Safe fix
921 921 | # E306
922 922 | def a():
923 923 | x = 2
924 |+
924 925 | @decorator
922 922 | # E306
923 923 | def a():
924 924 | x = 2
925 |+
925 926 | async def b():
926 927 | pass
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
927 928 | # end

View file

@ -178,7 +178,7 @@ W19.py:76:1: W191 Indentation contains tabs
|
74 | foo.bar("bop")
75 | )):
76 | print "yes"
76 | print("yes")
| ^^^^ W191
77 | #: E101 W191 W504
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
80 | foo.bar("bop"))):
81 | print "yes"
81 | print("yes")
| ^^^^ W191
82 | #: E101 W191 W504
83 | if (a == 2 or
@ -364,5 +364,3 @@ W19.py:161:1: W191 Indentation contains tabs
| ^^^^ W191
162 | } <- this tab is fine"""
|