mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 14:44:17 -05:00
Implement no_blank_line_before_class_docstring preview style (#9154)
## Summary This PR implements the `no_blank_line_before_class_docstring` preview style. ## Test Plan Update existing snapshots. ### Formatter ecosystem `main` | project | similarity index | total files | changed files | |----------------|------------------:|------------------:|------------------:| | cpython | 0.75804 | 1799 | 1648 | | django | 0.99984 | 2772 | 34 | | home-assistant | 0.99955 | 10596 | 213 | | poetry | 0.99905 | 321 | 15 | | transformers | 0.99967 | 2657 | 324 | | twine | 1.00000 | 33 | 0 | | typeshed | 0.99980 | 3669 | 18 | | warehouse | 0.99976 | 654 | 14 | | zulip | 0.99958 | 1459 | 36 | `dhruv/no-blank-line-docstring` | project | similarity index | total files | changed files | |----------------|------------------:|------------------:|------------------:| | cpython | 0.75804 | 1799 | 1648 | | django | 0.99984 | 2772 | 34 | | home-assistant | 0.99955 | 10596 | 213 | | poetry | 0.99905 | 321 | 15 | | transformers | 0.99967 | 2657 | 324 | | twine | 1.00000 | 33 | 0 | | typeshed | 0.99980 | 3669 | 18 | | warehouse | 0.99976 | 654 | 14 | | zulip | 0.99958 | 1459 | 36 | fixes: #8888
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
[
|
||||
{
|
||||
"preview": "enabled"
|
||||
}
|
||||
]
|
||||
38
crates/ruff_python_formatter/resources/test/fixtures/ruff/blank_line_before_class_docstring.py
vendored
Normal file
38
crates/ruff_python_formatter/resources/test/fixtures/ruff/blank_line_before_class_docstring.py
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
class NormalDocstring:
|
||||
|
||||
"""This is a docstring."""
|
||||
|
||||
|
||||
class DocstringWithComment0:
|
||||
# This is a comment
|
||||
"""This is a docstring."""
|
||||
|
||||
|
||||
class DocstringWithComment1:
|
||||
# This is a comment
|
||||
|
||||
"""This is a docstring."""
|
||||
|
||||
|
||||
class DocstringWithComment2:
|
||||
|
||||
# This is a comment
|
||||
"""This is a docstring."""
|
||||
|
||||
|
||||
class DocstringWithComment3:
|
||||
|
||||
# This is a comment
|
||||
|
||||
"""This is a docstring."""
|
||||
|
||||
|
||||
class DocstringWithComment4:
|
||||
|
||||
|
||||
# This is a comment
|
||||
|
||||
|
||||
"""This is a docstring."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user