diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs index 59effe7f944da..9cbbb556f56b3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs @@ -658,8 +658,10 @@ impl BlankLinesChecker { if self.is_not_first_logical_line { if line.preceding_blank_lines == 0 // Only applies to methods. - && matches!(line.kind, LogicalLineKind::Function) - && matches!(self.class_status, Status::Inside(_)) + && matches!(line.kind, LogicalLineKind::Function | LogicalLineKind::Decorator) + // Allow groups of one-liners. + && !(matches!(state.follows, Follows::Def) && !matches!(line.last_token, TokenKind::Colon)) + && matches!(state.class_status, Status::Inside(_)) // The class/parent method's docstring can directly precede the def. // Allow following a decorator (if there is an error it will be triggered on the first decorator). && !matches!(self.follows, Follows::Docstring | Follows::Decorator)