[`pycodestyle`] Add blank line(s) rules (`E301`, `E302`, `E303`, `E304`, `E305`, `E306`) #9266
Add V1 version.
32ec9e76
Keep track of previous streak of blank lines to fix 301.
624c7a59
Fix 302.
cd02e117
Fix 305.
f9a19ef1
Fix 306.
a10bea32
Fix 303 regression.
f57b6142
Add snapshots.
42c6f12f
Update nursery rules list
22830193
Add a non-error test and its corresponding fix.
06618c2f
Add a TODO comment.
09b6ba1e
Update snapshots following 06618c2.
1bdd1815
Clippy fixes.
2a7b4cb9
Store line.is_comment_only()'s result in a variable. Use config more.
aa7b6e69
Do not ignore first logical line when it comes to tracked vars.
8d3744d5
Merge branch 'astral-sh:main' into add_blank_lines_E30_V2
d6701004
Remove unnecessary check.
bd282ec6
Update snapshots (Fix -> Safe fix)
2ef4d02a
Fix first logical line issue.
36d2547a
Fix false positive caused by a class's docstring.
0f610114
Only trigger E302 on non-indented classes/functions.
0e9ca4ea
Fix decorator linked false positive.
3f6f207c
Fix E301 false positive.
b667c5cb
Fix decorator + async false positive.
0bf4c45e
Fix E302 error message.
7de1e058
Improve E302's fix interaction with comments.
0c1450a7
Fix E301 regression and improve E301 fix.
7b9b277d
Fix E302 fix's interaction with comments.
1d7b2353
Clippy fix.
73e5ba9f
Fix docstring + comment leading to false positive.
c1a7a7c0
Fix E305 false positive for indented classes/defs
b484ca4a
Make rules independent.
6d0fbf2e
Fix typo.
f7b2f893
Rule simplification.
53658304
Fix E306 false negative when using async or decorator.
bafddf94
Simplify/fix E301's condition.
ea9d9c83
Make if condition more readable.
4d2f7b5b
Simplify E301's if condition.
0867011a
Remove unnecessary clone.
9f2d339f
Merge branch 'astral-sh:main' into add_blank_lines_E30_V2
46b0c46b
Modify E303 to use top-levelness instead of class/def.
3eb5c627
Remove unnecessary clone derive.
9b15d8c0
Update E306
fd65c701
is_first_logical_line -> is_not_first_logical_line to be able to deriā¦
883818b1
Remove BlankLinesConfig struct and use module level constants instead.
29f0e6b4
Use an enum to keep track of class and fn status.
0b6bfdf3
Remove for loop, clippy fixes.
304115ae
Remove unnecessary Option from is_docstring.
083f4f5f
Use an enum to keep track of what the line is following.
60311c3f
Update crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/bā¦
dc2fe49c
BlankLinesTrackingVars -> BlankLinesChecker
727a17bf
WIP
0635407a
Started building LogicalLine replacement.
199257d5
Mostly finished renaming variable.
2002a6bd
Remove blank line counting in logical lines.
92da66c5
Bug fixes.
7099fca0
Clippy fixes.
5a59006f
Add comment.
f1205a18
Move the blank_lines outside the logical_lines module.
69279376
Merge with upstream.
fa558509
Move check to the tokens' file.
94fe6efe
hoel-bagard
marked this pull request as draft 1 year ago
Remove unused import.
f2d49574
Fix rule placement in the registry.
c9cf6b65
Ignore clippy warnings.
6f3aa5cf
Split if conditions into multiple ifs.
55a918da
Fix 2 false positives linked to indentation.
9f2268c9
Fix false positive caused by bad async handling.
66f4dd4d
hoel-bagard
marked this pull request as ready for review 1 year ago
Add test fixture.
3aac64df
Remove async as a top level token.
b7727c5e
hoel-bagard
force pushed
from
ba036d2e
to
b7727c5e
1 year ago
Fix is_top_level_token docstring.
ba7d8d72
Use usize for preceding_blank_characters.
0bcdf7da
Use TokenKind instead of Tok
ede587a6
Use == comparison instead of matches! where possible
f3305841
Use TokenKind::is_trivia to reduce nesting.
4437cc97
Remove dead if branch.
3647ec55
Update crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs
26417b91
Give violations' u32 field a name and make it private.
8bc8960e
Simplify and explain is_docstring flag detection.
22cd072d
Replace unwrap by expect.
3f3ccfa8
check_content -> check_lines
12d80ed6
Move BlankLinesChecker struct declaration closer to its implementatioā¦
86c473cb
Remove unnecessary clip allow.
c347761e
Passing TokenKind by value.
820480f6
Remove unnecessary clip allow (too many arguments).
3df1f1b0
Update crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs
cce4d008
Update crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs
92fca249
Revert "Update crates/ruff_linter/src/rules/pycodestyle/rules/blank_lā¦
8985a398
Fix visual indent.
3941e8f9
Fix visual indent.
1831879a
Revert unrelated variable name change.
52589e43
Add tests with indentation made of 2 spaces, tabs and mixed spaces anā¦
4f2c318a
Do not use an hard coded indent size.
94c9babf
Fix missing else branch
da11f028
Remove outdated Async check.
531ce0ed
Remove unecessary if.
cc81cc36
Move follow docstring if block outside of comment only if block.
bdfb1e3a
Remove unecessary comment check condition.
894bc21e
Only store the last token's end instead of full range.
0f659b96
Rename indent_level to indent_length
0d364444
refactor: make current_blank_lines and current_blank_characters into ā¦
60547072
docs: add docstring to explain the difference between blank_lines andā¦
4c54d05a
docs: expand on the previous_blank_lines comment.
c07ccdf9
refactor: previous_blank_lines -> preceding_blank_lines
5e342ac4
Merge remote-tracking branch 'origin/main' into blank_lines_non_logical
280ba513
Fix clippy errors.
273a711a
Introduce `LogicalLineKind`
2fb48bc2
Remove the need for `line_start`
cafe5ff8
Add a few new tests, remove unnecessary `as_str` and `to_string` calls
e739a445
Merge branch 'blank_lines_non_logical' of github.com:hoel-bagard/ruffā¦
f9a0d2db
Reorder tests.
b244f22f
Add comments to the text fixture.
f8149908
hoel-bagard
force pushed
from
e8d9ac4a
to
f8149908
1 year ago
Use BlankLines enum and keep track of the blank lines range.
2c08381d
Remove line.blank_lines_len and use BlankLines enum instead.
fddc7401
Add E304 fixture.
c2f6a0c2
Improve E304 fix.
7ee8946a
hoel-bagard
force pushed
from
695517ce
to
7ee8946a
1 year ago
Match pycodestyle error message for E305.
24bf5859
docs: add comment about preceding_blank_lines vs blank_lines.
71d90576
hoel-bagard
force pushed
from
9f4eafad
to
71d90576
1 year ago
Merge branch 'main' into blank_lines_non_logical
181fdee9
Move status update logic into its own function, mark rules as preview
8392f204
Introduce `blank_lines.range` method
0ddcca43
Use `universal_newlines` for decorator fix
de559d8c
Small code simpliciations
db137d91
add wrongly indented comment test
85302d5d
hoel-bagard
force pushed
from
6820cbeb
to
85302d5d
1 year ago
zanieb
commented
on 2024-02-06
zanieb
commented
on 2024-02-06
zanieb
commented
on 2024-02-06
zanieb
commented
on 2024-02-06
zanieb
commented
on 2024-02-06
fix E301 docstring.
3d5cc845
fix E302 docstring.
0596eda0
Fix E301's fix message
d188e200
Fix E304's docstring.
e89c20f8
Fix error message capitalization.
a28f916c
hoel-bagard
force pushed
from
ba8ee058
to
a28f916c
1 year ago
Remove unnecessary state variables
aea3493e
Assignees
No one assigned
Login to write a write a comment.
Login via GitHub