-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 blank-line-at-end-of-file
(W391
)
#10243
[pycodestyle
] Implement blank-line-at-end-of-file
(W391
)
#10243
Conversation
pycodestyle
] Implement blank-line-at-end-of-file
(W391)
pycodestyle
] Implement blank-line-at-end-of-file
(W391)pycodestyle
] Implement blank-line-at-end-of-file
(W391
)
CodSpeed Performance ReportMerging #10243 will not alter performanceComparing Summary
|
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
W391 | 27 | 27 | 0 | 0 | 0 |
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
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.
Thanks for your contribution.
We should convert this to a token based rule OR avoid using a regex to fix the performance regression.
crates/ruff_linter/src/rules/pycodestyle/rules/too_many_newlines_at_end_of_file.rs
Outdated
Show resolved
Hide resolved
/// W391 | ||
pub(crate) fn too_many_newlines_at_end_of_file( | ||
diagnostics: &mut Vec<Diagnostic>, | ||
lxr: &[LexResult], |
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.
I removed the Locator
. I don't think we need to guard on empty files here -- that's just for the "no trailing newline" check, since empty files would be a false positive.
8794854
to
dbc0825
Compare
dbc0825
to
2d4e2fe
Compare
One more step towards #9057 🎉 |
Summary
Implements the blank line at end of file rule (W391) from pycodestyle. Renamed to TooManyNewlinesAtEndOfFile for clarity.
Test Plan
New fixtures have been added
Part of #2402