-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pycodestyle
] Implement continued indentation related rules (E12x
)
#13585
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #13585 will not alter performanceComparing Summary
|
fb038ab
to
bf09ebb
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
E128 | 390 | 390 | 0 | 0 | 0 |
RUF001 | 361 | 0 | 361 | 0 | 0 |
RUF003 | 224 | 0 | 224 | 0 | 0 |
E302 | 220 | 0 | 220 | 0 | 0 |
I001 | 182 | 0 | 182 | 0 | 0 |
F401 | 182 | 0 | 182 | 0 | 0 |
E251 | 162 | 0 | 162 | 0 | 0 |
E231 | 161 | 0 | 161 | 0 | 0 |
RUF002 | 147 | 0 | 147 | 0 | 0 |
E701 | 132 | 0 | 132 | 0 | 0 |
E261 | 122 | 0 | 122 | 0 | 0 |
E127 | 116 | 116 | 0 | 0 | 0 |
E226 | 97 | 0 | 97 | 0 | 0 |
E126 | 82 | 82 | 0 | 0 | 0 |
E121 | 77 | 77 | 0 | 0 | 0 |
E131 | 63 | 63 | 0 | 0 | 0 |
I002 | 63 | 0 | 63 | 0 | 0 |
E252 | 60 | 0 | 60 | 0 | 0 |
E122 | 52 | 52 | 0 | 0 | 0 |
F541 | 49 | 0 | 49 | 0 | 0 |
C416 | 49 | 0 | 49 | 0 | 0 |
E722 | 41 | 0 | 41 | 0 | 0 |
F841 | 40 | 0 | 40 | 0 | 0 |
E402 | 40 | 0 | 40 | 0 | 0 |
E303 | 38 | 0 | 38 | 0 | 0 |
E401 | 36 | 0 | 36 | 0 | 0 |
T201 | 35 | 0 | 35 | 0 | 0 |
E125 | 31 | 31 | 0 | 0 | 0 |
B007 | 28 | 0 | 28 | 0 | 0 |
E123 | 27 | 27 | 0 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 0 | 0 |
INP001 | 3 | 0 | 3 | 0 | 0 |
SIM105 | 2 | 0 | 2 | 0 | 0 |
RUF027 | 2 | 0 | 2 | 0 | 0 |
RUF010 | 2 | 0 | 2 | 0 | 0 |
SIM118 | 2 | 0 | 2 | 0 | 0 |
C419 | 2 | 0 | 2 | 0 | 0 |
RUF005 | 2 | 0 | 2 | 0 | 0 |
UP028 | 2 | 0 | 2 | 0 | 0 |
RUF029 | 2 | 0 | 2 | 0 | 0 |
S311 | 2 | 0 | 2 | 0 | 0 |
ANN001 | 2 | 0 | 2 | 0 | 0 |
PLR2004 | 1 | 0 | 1 | 0 | 0 |
RUF015 | 1 | 0 | 1 | 0 | 0 |
SIM115 | 1 | 0 | 1 | 0 | 0 |
B005 | 1 | 0 | 1 | 0 | 0 |
SIM300 | 1 | 0 | 1 | 0 | 0 |
E502 | 1 | 0 | 1 | 0 | 0 |
SIM223 | 1 | 0 | 1 | 0 | 0 |
UP031 | 1 | 0 | 1 | 0 | 0 |
UP034 | 1 | 0 | 1 | 0 | 0 |
E202 | 1 | 0 | 1 | 0 | 0 |
PGH003 | 1 | 0 | 1 | 0 | 0 |
C414 | 1 | 0 | 1 | 0 | 0 |
C403 | 1 | 0 | 1 | 0 | 0 |
SIM201 | 1 | 0 | 1 | 0 | 0 |
UP009 | 1 | 0 | 1 | 0 | 0 |
UP025 | 1 | 0 | 1 | 0 | 0 |
C420 | 1 | 0 | 1 | 0 | 0 |
B020 | 1 | 0 | 1 | 0 | 0 |
C408 | 1 | 0 | 1 | 0 | 0 |
B028 | 1 | 0 | 1 | 0 | 0 |
W291 | 1 | 0 | 1 | 0 | 0 |
N816 | 1 | 0 | 1 | 0 | 0 |
RET504 | 1 | 0 | 1 | 0 | 0 |
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
bf09ebb
to
8906f45
Compare
+589 new violations is a bit nicer than +56549 |
There's some overlap with #11349 and we would have to look into the performance regressions. |
That's what I get for not checking existing PRs. I'd imagine much of the performance regression is to do with the |
8906f45
to
0be255e
Compare
Quick push to show I'm still working on it - I know the tests are still broken, but I'm happy that E12{1,2,3} are correct now. (But probably still slow) |
c0b57e9
to
fd85355
Compare
pycodestyle
] Implement continued indentation related rules (E12x
)
fd85355
to
f990a5a
Compare
I'm calling this ready. The output matches pycodestyle for all added warnings (though there's no testing for E133 here or in pycodestyle) There's still a couple of TODOs in the code, and honestly the code itself is a big blob. Hopefully someone has some better ideas for how to achieve things :) |
5f483eb
to
8bd05ab
Compare
1833555
to
539e21d
Compare
Guess ruff is getting close to the limit of the number of rules - I've bumped |
539e21d
to
42126d3
Compare
@MichaReiser et al, do let me know if there's anything more I can do (sorry, I know how annoying these sort of pings can be!) |
crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/continued_indentation.rs
Outdated
Show resolved
Hide resolved
42126d3
to
991b923
Compare
// record initial indent | ||
// TODO: A better way of doing this? | ||
relative_line_indent[line_no] = | ||
isize::try_from(token_indent).unwrap() - isize::try_from(indent_level).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flagging this ugly line for review
} else if tok.kind() == TokenKind::Colon | ||
&& logical_line | ||
.text_after(tok) | ||
.chars() | ||
.all(char::is_whitespace) | ||
{ | ||
// If there's only whitespace following this token, it can't be a dictionary construction | ||
// TODO: Is this always correct? | ||
open_lines[bracket_depth].push(line_no); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flagging this to see if there's a better way of doing it (and indeed if it's logically correct)
991b923
to
5492cde
Compare
077873f
to
732dae3
Compare
732dae3
to
f2c0bbe
Compare
Summary
I've made a start at implementing the remaining pycodestyle E12x warnings. Largely by translating the implementation in pycodestyle
See #2402
Test Plan
Copied E12.py from pycodestyle and added the relevant test cases.
E133 is untested (the same as pycodestyle!)