[pycodestyle
] Do not ignore lines before the first logical line in blank lines rules.
#10382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Ignoring all lines until the first logical line does not match the behavior from pycodestyle. This PR therefore removes the
if state.is_not_first_logical_line
skipping the line check before the first logical line, and applies it only toE302
.For example, in the snippet below a rule violation should be detected on the second comment and on the import.
Fixes #10374
Test Plan
It was tested on the example given on the issue, and by running cargo test. Since this is an issue about the first line(s) of a file I did not add a fixture for it.
The ruff-ecosystem check should help verify that the PR does not have unintended side-effects.