mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-09 10:00:25 +00:00
Implement blank_line_after_nested_stub_class
preview style (#9155)
## Summary This PR implements the `blank_line_after_nested_stub_class` preview style in the formatter. The logic is divided into 3 parts: 1. In between preceding and following nodes at top level and nested suite 2. When there's a trailing comment after the class 3. When there is no following node from (1) which is the case when it's the last or the only node in a suite We handle (3) with `FormatLeadingAlternateBranchComments`. ## Test Plan - Add new test cases and update existing snapshots - Checked the `typeshed` diff fixes: #8891
This commit is contained in:
parent
79f0522eb7
commit
541aef4e6c
13 changed files with 891 additions and 29 deletions
|
@ -48,6 +48,13 @@ pub(crate) const fn is_wrap_multiple_context_managers_in_parens_enabled(
|
|||
context.is_preview()
|
||||
}
|
||||
|
||||
/// Returns `true` if the [`blank_line_after_nested_stub_class`](https://github.com/astral-sh/ruff/issues/8891) preview style is enabled.
|
||||
pub(crate) const fn is_blank_line_after_nested_stub_class_enabled(
|
||||
context: &PyFormatContext,
|
||||
) -> bool {
|
||||
context.is_preview()
|
||||
}
|
||||
|
||||
/// Returns `true` if the [`module_docstring_newlines`](https://github.com/astral-sh/ruff/issues/7995) preview style is enabled.
|
||||
pub(crate) const fn is_module_docstring_newlines_enabled(context: &PyFormatContext) -> bool {
|
||||
context.is_preview()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue