You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
There's still a problem here. Given:
```python
class Class():
pass
# comment
# another comment
a = 1
```
We only add one newline before `a = 1` on the first pass, because
`max_precedling_blank_lines` is 1... We then add the second newline on
the second pass, so it ends up in the right state, but the logic is
clearly wonky.
Closes#11508.
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap
+29-14
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,9 @@ E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition
15
15
796 796 |
16
16
797 797 | # anothercomment
17
17
798 |+
18
-
799 |+
19
-
798 800 | fn()
20
-
799 801 | # end
21
-
800 802 |
18
+
798 799 | fn()
19
+
799 800 | # end
20
+
800 801 |
22
21
23
22
E30.py:809:1: E305 [*] Expected 2 blanklinesafterclassorfunctiondefinition, found (1)
24
23
|
@@ -34,10 +33,9 @@ E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition
34
33
807 807 |
35
34
808 808 | # anothercomment
36
35
809 |+
37
-
810 |+
38
-
809 811 | a = 1
39
-
810 812 | # end
40
-
811 813 |
36
+
809 810 | a = 1
37
+
810 811 | # end
38
+
811 812 |
41
39
42
40
E30.py:821:1: E305 [*] Expected 2 blanklinesafterclassorfunctiondefinition, found (1)
43
41
|
@@ -70,14 +68,13 @@ E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition
70
68
= help: Addmissingblankline(s)
71
69
72
70
ℹ Safefix
71
+
829 829 | defa():
73
72
830 830 | print()
74
73
831 831 |
75
-
832 832 | # Twospacesbeforecomments, too.
76
-
833 |+
77
-
834 |+
78
-
833 835 | ifa():
79
-
834 836 | a()
80
-
835 837 | # end
74
+
832 |+
75
+
832 833 | # Twospacesbeforecomments, too.
76
+
833 834 | ifa():
77
+
834 835 | a()
81
78
82
79
E30.py:846:1: E305 [*] Expected 2 blanklinesafterclassorfunctiondefinition, found (1)
83
80
|
@@ -98,3 +95,21 @@ E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition
98
95
846 847 | if__name__ == '__main__':
99
96
847 848 | main()
100
97
848 849 | # end
98
+
99
+
E30.py:973:1: E305 [*] Expected 2 blanklinesafterclassorfunctiondefinition, found (1)
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap
+3-4
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,6 @@ E30.ipynb:55:1: E305 [*] Expected 2 blank lines after class or function definiti
0 commit comments