Skip to content

Commit

Permalink
remove state.is_not_first_logical_line
Browse files Browse the repository at this point in the history
Ignoring all lines until the first logical line does not match the
behavior from pycodestyle.

Fixes #10374
  • Loading branch information
hoel-bagard committed Mar 13, 2024
1 parent 32d6f84 commit feb5e45
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,7 @@ impl<'a> BlankLinesChecker<'a> {
state.class_status.update(&logical_line);
state.fn_status.update(&logical_line);

if state.is_not_first_logical_line {
self.check_line(&logical_line, &state, prev_indent_length, diagnostics);
}
self.check_line(&logical_line, &state, prev_indent_length, diagnostics);

match logical_line.kind {
LogicalLineKind::Class => {
Expand Down Expand Up @@ -733,8 +731,6 @@ impl<'a> BlankLinesChecker<'a> {
}

if !logical_line.is_comment_only {
state.is_not_first_logical_line = true;

state.last_non_comment_line_end = logical_line.logical_line_end;

if logical_line.indent_length == 0 {
Expand Down Expand Up @@ -994,8 +990,6 @@ struct BlankLinesState {
follows: Follows,
fn_status: Status,
class_status: Status,
/// First line that is not a comment.
is_not_first_logical_line: bool,
/// Used for the fix in case a comment separates two non-comment logical lines to make the comment "stick"
/// to the second line instead of the first.
last_non_comment_line_end: TextSize,
Expand Down

0 comments on commit feb5e45

Please sign in to comment.