Skip to content

Commit

Permalink
fix first line of each cell being ignored for all rules in notebooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoel-bagard committed Mar 22, 2024
1 parent bce6989 commit c5c648f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,7 @@ impl<'a> BlankLinesChecker<'a> {
state.class_status.update(&logical_line);
state.fn_status.update(&logical_line);

// Ignore the first logical line (and any comment preceding it) of each cell in notebooks.
if !logical_line.is_beginning_of_cell {
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 @@ -872,6 +869,8 @@ impl<'a> BlankLinesChecker<'a> {
&& !self.source_type.is_stub()
// Do not expect blank lines before the first logical line.
&& state.is_not_first_logical_line
// Ignore the first logical line (and any comment preceding it) of each cell in notebooks.
&& !line.is_beginning_of_cell
{
// E302
let mut diagnostic = Diagnostic::new(
Expand Down

0 comments on commit c5c648f

Please sign in to comment.