mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:52:01 +00:00
Implement Black's rules around newlines before and after class docstrings (#6209)
## Summary Black allows up to one blank line _before_ a class docstring, and enforces one blank line _after_ a class docstring. This PR implements that handling. The cases in `crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/class_definition.py` match Black identically.
This commit is contained in:
parent
5e41f2fc7d
commit
a82eb9544c
4 changed files with 224 additions and 503 deletions
|
@ -43,3 +43,52 @@ class TestTrailingComment2: # trailing comment
|
|||
pass
|
||||
|
||||
|
||||
class Test:
|
||||
"""Docstring"""
|
||||
|
||||
|
||||
class Test:
|
||||
# comment
|
||||
"""Docstring"""
|
||||
|
||||
|
||||
class Test:
|
||||
"""Docstring"""
|
||||
x = 1
|
||||
|
||||
|
||||
class Test:
|
||||
"""Docstring"""
|
||||
# comment
|
||||
x = 1
|
||||
|
||||
|
||||
class Test:
|
||||
|
||||
"""Docstring"""
|
||||
|
||||
|
||||
class Test:
|
||||
# comment
|
||||
|
||||
"""Docstring"""
|
||||
|
||||
|
||||
class Test:
|
||||
|
||||
# comment
|
||||
|
||||
"""Docstring"""
|
||||
|
||||
|
||||
class Test:
|
||||
|
||||
"""Docstring"""
|
||||
x = 1
|
||||
|
||||
|
||||
class Test:
|
||||
|
||||
"""Docstring"""
|
||||
# comment
|
||||
x = 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue